Skip to content

Commit 80eeb10

Browse files
BugenZhaozwang28
authored andcommitted
feat: enable verbose await-tree by default in production (#10144)
Signed-off-by: Bugen Zhao <[email protected]>
1 parent 9fa4d8d commit 80eeb10

File tree

13 files changed

+46
-15
lines changed

13 files changed

+46
-15
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ license = "Apache-2.0"
5858
repository = "https://github.com/risingwavelabs/risingwave"
5959

6060
[workspace.dependencies]
61+
await-tree = "0.1.1"
6162
aws-config = { version = "0.51", default-features = false, features = ["rt-tokio", "native-tls"] }
6263
aws-sdk-kinesis = { version = "0.21", default-features = false, features = ["rt-tokio", "native-tls"] }
6364
aws-sdk-s3 = { version = "0.21", default-features = false, features = ["rt-tokio","native-tls"] }

src/common/src/config.rs

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -419,12 +419,27 @@ pub struct FileCacheConfig {
419419
pub unrecognized: Unrecognized<Self>,
420420
}
421421

422-
#[derive(Debug, Default, Clone, ValueEnum, Serialize, Deserialize)]
422+
#[derive(Debug, Default, Clone, Copy, ValueEnum, Serialize, Deserialize)]
423423
pub enum AsyncStackTraceOption {
424+
/// Disabled.
424425
Off,
425-
#[default]
426+
/// Enabled with basic instruments.
426427
On,
427-
Verbose,
428+
/// Enabled with extra verbose instruments in release build.
429+
/// Behaves the same as `on` in debug build due to performance concern.
430+
#[default]
431+
#[clap(alias = "verbose")]
432+
ReleaseVerbose,
433+
}
434+
435+
impl AsyncStackTraceOption {
436+
pub fn is_verbose(self) -> Option<bool> {
437+
match self {
438+
Self::Off => None,
439+
Self::On => Some(false),
440+
Self::ReleaseVerbose => Some(!cfg!(debug_assertions)),
441+
}
442+
}
428443
}
429444

430445
serde_with::with_prefix!(streaming_prefix "stream_");
@@ -726,7 +741,7 @@ mod default {
726741
}
727742

728743
pub fn async_stack_trace() -> AsyncStackTraceOption {
729-
AsyncStackTraceOption::On
744+
AsyncStackTraceOption::default()
730745
}
731746

732747
pub fn unique_user_stream_errors() -> usize {

src/compute/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ normal = ["workspace-hack"]
1616
[dependencies]
1717
anyhow = "1"
1818
async-trait = "0.1"
19-
await-tree = "0.1.1"
19+
await-tree = { workspace = true }
2020
clap = { version = "4", features = ["derive"] }
2121
either = "1"
2222
futures = { version = "0.3", default-features = false, features = ["alloc"] }

src/compute/src/server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ pub async fn compute_node_serve(
263263
let await_tree_config = match &config.streaming.async_stack_trace {
264264
AsyncStackTraceOption::Off => None,
265265
c => await_tree::ConfigBuilder::default()
266-
.verbose(matches!(c, AsyncStackTraceOption::Verbose))
266+
.verbose(c.is_verbose().unwrap())
267267
.build()
268268
.ok(),
269269
};

src/config/example.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ batch_chunk_size = 1024
3535
[streaming]
3636
in_flight_barrier_nums = 10000
3737
enable_jaeger_tracing = false
38-
async_stack_trace = "On"
38+
async_stack_trace = "ReleaseVerbose"
3939
unique_user_stream_errors = 10
4040

4141
[streaming.developer]

src/expr/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ arrow-array = "36"
2121
arrow-schema = "36"
2222
async-trait = "0.1"
2323
auto_enums = "0.8"
24+
await-tree = { workspace = true }
2425
chrono = { version = "0.4", default-features = false, features = ["clock", "std"] }
2526
chrono-tz = { version = "0.7", features = ["case-insensitive"] }
2627
ctor = "0.1"

src/expr/src/expr/expr_udf.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use std::convert::TryFrom;
1616
use std::sync::Arc;
1717

1818
use arrow_schema::{Field, Schema, SchemaRef};
19+
use await_tree::InstrumentAwait;
1920
use risingwave_common::array::{ArrayImpl, ArrayRef, DataChunk};
2021
use risingwave_common::row::OwnedRow;
2122
use risingwave_common::types::{DataType, Datum};
@@ -35,6 +36,7 @@ pub struct UdfExpression {
3536
arg_schema: SchemaRef,
3637
client: ArrowFlightUdfClient,
3738
identifier: String,
39+
span: await_tree::Span,
3840
}
3941

4042
#[cfg(not(madsim))]
@@ -84,7 +86,11 @@ impl UdfExpression {
8486
let input =
8587
arrow_array::RecordBatch::try_new_with_options(self.arg_schema.clone(), columns, &opts)
8688
.expect("failed to build record batch");
87-
let output = self.client.call(&self.identifier, input).await?;
89+
let output = self
90+
.client
91+
.call(&self.identifier, input)
92+
.instrument_await(self.span.clone())
93+
.await?;
8894
if output.num_rows() != vis.len() {
8995
bail!(
9096
"UDF returned {} rows, but expected {}",
@@ -128,6 +134,7 @@ impl<'a> TryFrom<&'a ExprNode> for UdfExpression {
128134
arg_schema,
129135
client,
130136
identifier: udf.identifier.clone(),
137+
span: format!("expr_udf_call ({})", udf.identifier).into(),
131138
})
132139
}
133140
}

src/object_store/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ repository = { workspace = true }
1010

1111
[dependencies]
1212
async-trait = "0.1"
13-
await-tree = "0.1.1"
13+
await-tree = { workspace = true }
1414
aws-config = { workspace = true }
1515
aws-sdk-s3 = { version = "0.2.15", package = "madsim-aws-sdk-s3" }
1616
aws-smithy-http = { workspace = true }

src/storage/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ normal = ["workspace-hack"]
1717
arc-swap = "1"
1818
async-trait = "0.1"
1919
auto_enums = { version = "0.8", features = ["futures03"] }
20-
await-tree = "0.1.1"
20+
await-tree = { workspace = true }
2121
bytes = { version = "1", features = ["serde"] }
2222
crossbeam = "0.8.1"
2323
dashmap = { version = "5", default-features = false }

src/storage/src/monitor/monitored_store.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,11 @@ impl<S: LocalStateStore> LocalStateStore for MonitoredStateStore<S> {
185185
.may_exist_duration
186186
.with_label_values(&[table_id_label.as_str()])
187187
.start_timer();
188-
let res = self.inner.may_exist(key_range, read_options).await;
188+
let res = self
189+
.inner
190+
.may_exist(key_range, read_options)
191+
.verbose_instrument_await("store_may_exist")
192+
.await;
189193
timer.observe_duration();
190194
res
191195
}
@@ -217,7 +221,9 @@ impl<S: LocalStateStore> LocalStateStore for MonitoredStateStore<S> {
217221

218222
fn flush(&mut self, delete_ranges: Vec<(Bound<Bytes>, Bound<Bytes>)>) -> Self::FlushFuture<'_> {
219223
// TODO: collect metrics
220-
self.inner.flush(delete_ranges)
224+
self.inner
225+
.flush(delete_ranges)
226+
.verbose_instrument_await("store_flush")
221227
}
222228

223229
fn epoch(&self) -> u64 {
@@ -264,7 +270,7 @@ impl<S: StateStore> StateStore for MonitoredStateStore<S> {
264270
let sync_result = self
265271
.inner
266272
.sync(epoch)
267-
.instrument_await("store_await_sync")
273+
.instrument_await("store_sync")
268274
.await
269275
.inspect_err(|e| error!("Failed in sync: {:?}", e))?;
270276
timer.observe_duration();

src/stream/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ anyhow = "1"
1919
async-recursion = "1"
2020
async-stream = "0.3"
2121
async-trait = "0.1"
22-
await-tree = "0.1.1"
22+
await-tree = { workspace = true }
2323
bytes = "1"
2424
dyn-clone = "1"
2525
educe = "0.4"

src/utils/runtime/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ ignored = ["workspace-hack"]
1515
normal = ["workspace-hack"]
1616

1717
[dependencies]
18-
await-tree = "0.1.1"
18+
await-tree = { workspace = true }
1919
console = "0.15"
2020
console-subscriber = "0.1.8"
2121
futures = { version = "0.3", default-features = false, features = ["alloc"] }

0 commit comments

Comments
 (0)