Skip to content

Commit

Permalink
Rename exception replay snapshot fields
Browse files Browse the repository at this point in the history
Signed-off-by: Bob Weinand <[email protected]>
  • Loading branch information
bwoebi committed Oct 1, 2024
1 parent 263eca4 commit a70f928
Show file tree
Hide file tree
Showing 5 changed files with 478 additions and 8 deletions.
468 changes: 463 additions & 5 deletions LICENSE-3rdparty.yml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion live-debugger/src/debugger_defs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ pub struct SnapshotStackFrame {
}

#[derive(Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Snapshot<'a> {
pub language: Cow<'a, str>,
pub id: Cow<'a, str>,
Expand All @@ -64,7 +65,6 @@ pub struct Snapshot<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
pub probe: Option<ProbeMetadata<'a>>,
#[serde(skip_serializing_if = "Vec::is_empty")]
#[serde(rename = "evaluationErrors")]
pub evaluation_errors: Vec<SnapshotEvaluationError>,
#[serde(skip_serializing_if = "Vec::is_empty")]
pub stack: Vec<SnapshotStackFrame>,
Expand Down
8 changes: 8 additions & 0 deletions sidecar/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ const ENV_SIDECAR_IPC_MODE: &str = "_DD_DEBUG_SIDECAR_IPC_MODE";
const SIDECAR_IPC_MODE_SHARED: &str = "shared";
const SIDECAR_IPC_MODE_PER_PROCESS: &str = "instance_per_process";

const ENV_SIDECAR_LOG_LEVEL: &str = "_DD_DEBUG_SIDECAR_LOG_LEVEL";

const ENV_SIDECAR_LOG_METHOD: &str = "_DD_DEBUG_SIDECAR_LOG_METHOD";
const SIDECAR_LOG_METHOD_DISABLED: &str = "disabled";
const SIDECAR_LOG_METHOD_STDOUT: &str = "stdout";
Expand Down Expand Up @@ -80,6 +82,7 @@ impl std::fmt::Display for LogMethod {
pub struct Config {
pub ipc_mode: IpcMode,
pub log_method: LogMethod,
pub log_level: String,
pub idle_linger_time: Duration,
pub self_telemetry: bool,
pub library_dependencies: Vec<LibDependency>,
Expand Down Expand Up @@ -185,6 +188,10 @@ impl FromEnv {
}
}

pub fn log_level() -> String {
std::env::var(ENV_SIDECAR_LOG_LEVEL).unwrap_or_default()
}

fn idle_linger_time() -> Duration {
std::env::var(ENV_IDLE_LINGER_TIME_SECS)
.unwrap_or_default()
Expand All @@ -205,6 +212,7 @@ impl FromEnv {
Config {
ipc_mode: Self::ipc_mode(),
log_method: Self::log_method(),
log_level: Self::log_level(),
idle_linger_time: Self::idle_linger_time(),
self_telemetry: Self::self_telemetry(),
library_dependencies: vec![],
Expand Down
6 changes: 5 additions & 1 deletion sidecar/src/log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,11 @@ pub(crate) fn enable_logging() -> anyhow::Result<()> {
MULTI_LOG_FILTER.add(env); // this also immediately drops it, but will retain it for few
// seconds during startup
}
MULTI_LOG_WRITER.add(config::Config::get().log_method); // same than MULTI_LOG_FILTER
let config = config::Config::get();
if !config.log_level.is_empty() {
MULTI_LOG_FILTER.add(config.log_level.clone());
}
MULTI_LOG_WRITER.add(config.log_method); // same than MULTI_LOG_FILTER

LogTracer::init()?;

Expand Down
2 changes: 1 addition & 1 deletion sidecar/src/watchdog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ impl WatchdogHandle {
impl Watchdog {
pub fn from_receiver(shutdown_receiver: Receiver<()>) -> Self {
Watchdog {
interval: tokio::time::interval(Duration::from_secs(5)),
interval: tokio::time::interval(Duration::from_secs(10)),
max_memory_usage_bytes: 1024 * 1024 * 1024, // 1 GB
shutdown_receiver,
}
Expand Down

0 comments on commit a70f928

Please sign in to comment.