Skip to content

Commit cd71b03

Browse files
committed
Rename exception replay snapshot fields
Signed-off-by: Bob Weinand <[email protected]>
1 parent 263eca4 commit cd71b03

File tree

4 files changed

+15
-3
lines changed

4 files changed

+15
-3
lines changed

live-debugger/src/debugger_defs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ pub struct SnapshotStackFrame {
4949
}
5050

5151
#[derive(Default, Serialize, Deserialize)]
52+
#[serde(rename_all = "camelCase")]
5253
pub struct Snapshot<'a> {
5354
pub language: Cow<'a, str>,
5455
pub id: Cow<'a, str>,
@@ -64,7 +65,6 @@ pub struct Snapshot<'a> {
6465
#[serde(skip_serializing_if = "Option::is_none")]
6566
pub probe: Option<ProbeMetadata<'a>>,
6667
#[serde(skip_serializing_if = "Vec::is_empty")]
67-
#[serde(rename = "evaluationErrors")]
6868
pub evaluation_errors: Vec<SnapshotEvaluationError>,
6969
#[serde(skip_serializing_if = "Vec::is_empty")]
7070
pub stack: Vec<SnapshotStackFrame>,

sidecar/src/config.rs

+8
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ const ENV_SIDECAR_IPC_MODE: &str = "_DD_DEBUG_SIDECAR_IPC_MODE";
1212
const SIDECAR_IPC_MODE_SHARED: &str = "shared";
1313
const SIDECAR_IPC_MODE_PER_PROCESS: &str = "instance_per_process";
1414

15+
const ENV_SIDECAR_LOG_LEVEL: &str = "_DD_DEBUG_SIDECAR_LOG_LEVEL";
16+
1517
const ENV_SIDECAR_LOG_METHOD: &str = "_DD_DEBUG_SIDECAR_LOG_METHOD";
1618
const SIDECAR_LOG_METHOD_DISABLED: &str = "disabled";
1719
const SIDECAR_LOG_METHOD_STDOUT: &str = "stdout";
@@ -80,6 +82,7 @@ impl std::fmt::Display for LogMethod {
8082
pub struct Config {
8183
pub ipc_mode: IpcMode,
8284
pub log_method: LogMethod,
85+
pub log_level: String,
8386
pub idle_linger_time: Duration,
8487
pub self_telemetry: bool,
8588
pub library_dependencies: Vec<LibDependency>,
@@ -184,6 +187,10 @@ impl FromEnv {
184187
_ => LogMethod::default(),
185188
}
186189
}
190+
191+
pub fn log_level() -> String {
192+
std::env::var(ENV_SIDECAR_LOG_LEVEL).unwrap_or_default()
193+
}
187194

188195
fn idle_linger_time() -> Duration {
189196
std::env::var(ENV_IDLE_LINGER_TIME_SECS)
@@ -205,6 +212,7 @@ impl FromEnv {
205212
Config {
206213
ipc_mode: Self::ipc_mode(),
207214
log_method: Self::log_method(),
215+
log_level: Self::log_level(),
208216
idle_linger_time: Self::idle_linger_time(),
209217
self_telemetry: Self::self_telemetry(),
210218
library_dependencies: vec![],

sidecar/src/log.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,11 @@ pub(crate) fn enable_logging() -> anyhow::Result<()> {
381381
MULTI_LOG_FILTER.add(env); // this also immediately drops it, but will retain it for few
382382
// seconds during startup
383383
}
384-
MULTI_LOG_WRITER.add(config::Config::get().log_method); // same than MULTI_LOG_FILTER
384+
let config = config::Config::get();
385+
if !config.log_level.is_empty() {
386+
MULTI_LOG_FILTER.add(config.log_level.clone());
387+
}
388+
MULTI_LOG_WRITER.add(config.log_method); // same than MULTI_LOG_FILTER
385389

386390
LogTracer::init()?;
387391

sidecar/src/watchdog.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ impl WatchdogHandle {
3636
impl Watchdog {
3737
pub fn from_receiver(shutdown_receiver: Receiver<()>) -> Self {
3838
Watchdog {
39-
interval: tokio::time::interval(Duration::from_secs(5)),
39+
interval: tokio::time::interval(Duration::from_secs(10)),
4040
max_memory_usage_bytes: 1024 * 1024 * 1024, // 1 GB
4141
shutdown_receiver,
4242
}

0 commit comments

Comments
 (0)