risingwave_common/config/streaming/async_stack_trace.rs
1// Copyright 2025 RisingWave Labs
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15use clap::ValueEnum;
16use serde::{Deserialize, Serialize};
17
18#[derive(Debug, Default, Clone, Copy, ValueEnum, Serialize, Deserialize)]
19pub enum AsyncStackTraceOption {
20 /// Disabled.
21 Off,
22 /// Enabled with basic instruments.
23 On,
24 /// Enabled with extra verbose instruments in release build.
25 /// Behaves the same as `on` in debug build due to performance concern.
26 #[default]
27 #[clap(alias = "verbose")]
28 ReleaseVerbose,
29}
30
31impl AsyncStackTraceOption {
32 pub fn is_verbose(self) -> Option<bool> {
33 match self {
34 Self::Off => None,
35 Self::On => Some(false),
36 Self::ReleaseVerbose => Some(!cfg!(debug_assertions)),
37 }
38 }
39}