Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
467 changes: 435 additions & 32 deletions bottlecap/src/config/mod.rs

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions bottlecap/src/lifecycle/invocation/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2293,7 +2293,7 @@ mod tests {
appsec: None,
processor: Arc::new(trace_processor::ServerlessTraceProcessor {
obfuscation_config: Arc::new(ObfuscationConfig::default()),
error_sampler: trace_processor::enabled_error_sampler(),
error_sampler: trace_processor::default_error_sampler(),
error_rare_sample_tracer_drop: false,
}),
trace_tx: tokio::sync::mpsc::channel(1).0,
Expand Down Expand Up @@ -2403,7 +2403,7 @@ mod tests {
appsec: None,
processor: Arc::new(trace_processor::ServerlessTraceProcessor {
obfuscation_config: Arc::new(ObfuscationConfig::default()),
error_sampler: trace_processor::enabled_error_sampler(),
error_sampler: trace_processor::default_error_sampler(),
error_rare_sample_tracer_drop: false,
}),
trace_tx: tokio::sync::mpsc::channel(1).0,
Expand Down Expand Up @@ -3041,7 +3041,7 @@ mod tests {
appsec: None,
processor: Arc::new(trace_processor::ServerlessTraceProcessor {
obfuscation_config: Arc::new(ObfuscationConfig::default()),
error_sampler: trace_processor::enabled_error_sampler(),
error_sampler: trace_processor::default_error_sampler(),
error_rare_sample_tracer_drop: false,
}),
trace_tx: tokio::sync::mpsc::channel(1).0,
Expand Down Expand Up @@ -3622,7 +3622,7 @@ mod tests {
appsec: None,
processor: Arc::new(trace_processor::ServerlessTraceProcessor {
obfuscation_config: Arc::new(ObfuscationConfig::default()),
error_sampler: trace_processor::enabled_error_sampler(),
error_sampler: trace_processor::default_error_sampler(),
error_rare_sample_tracer_drop: false,
}),
trace_tx,
Expand Down
2 changes: 1 addition & 1 deletion bottlecap/src/lifecycle/invocation/processor_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@ mod tests {
use std::collections::HashMap;
use tokio::time::{Duration, timeout};

let error_sampler = trace_processor::new_error_sampler(false);
let error_sampler = trace_processor::new_error_sampler(0.0);

let timeout_dur = Duration::from_millis(500);

Expand Down
21 changes: 8 additions & 13 deletions bottlecap/src/startup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
//! together trace, stats, proxy, lifecycle, tags, appsec, and flushing
//! pieces: it is orchestration, not a trace-domain API.

use std::{env, sync::Arc};
use std::sync::Arc;

use dogstatsd::api_key::ApiKeyFactory;
use libdd_common::regex_engine::{Regex, Replacer};
Expand Down Expand Up @@ -157,29 +157,24 @@ pub fn build_trace_agent(
..Default::default()
};

// The Agent's error sampler knob has no effect here: the extension's
// sampler is a plain on/off switch, not a TPS budget.
if env::var("DD_APM_ERROR_TPS").is_ok_and(|v| !v.trim().is_empty()) {
warn!(
"DD_APM_ERROR_TPS is not supported by the Lambda extension; error trace rescue is an on/off switch controlled by DD_SERVERLESS_ERROR_SAMPLER_ENABLED"
);
if let Some(message) = config.ext.legacy_error_sampler_warning() {
warn!("{message}");
}
let error_tps = config.ext.error_sampler_target_tps();

// One-time startup warning: the feature only widens rescue eligibility, it
// does not enable the sampler.
// does not change the rescue budget.
let error_rare_sample_tracer_drop =
trace_processor::error_rare_sample_tracer_drop_enabled(config);
if error_rare_sample_tracer_drop && !config.ext.serverless_error_sampler_enabled {
if error_rare_sample_tracer_drop && error_tps <= 0.0 {
warn!(
"DD_APM_FEATURES includes error_rare_sample_tracer_drop, but DD_SERVERLESS_ERROR_SAMPLER_ENABLED is false: errored traces dropped by the tracer will not be rescued"
"DD_APM_FEATURES includes error_rare_sample_tracer_drop, but error trace rescue is disabled (effective DD_APM_ERROR_TPS {error_tps}): errored traces dropped by the tracer will not be rescued"
);
}

let trace_processor = Arc::new(trace_processor::ServerlessTraceProcessor {
obfuscation_config: Arc::new(obfuscation_config),
error_sampler: trace_processor::new_error_sampler(
config.ext.serverless_error_sampler_enabled,
),
error_sampler: trace_processor::new_error_sampler(error_tps),
error_rare_sample_tracer_drop,
});

Expand Down
2 changes: 1 addition & 1 deletion bottlecap/src/traces/trace_agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1145,7 +1145,7 @@ mod tests {
tokio::spawn(dedup_svc.run());
let trace_processor = Arc::new(trace_processor::ServerlessTraceProcessor {
obfuscation_config: Arc::new(ObfuscationConfig::default()),
error_sampler: trace_processor::new_error_sampler(false),
error_sampler: trace_processor::new_error_sampler(0.0),
error_rare_sample_tracer_drop: false,
});
let stats_aggregator = Arc::new(Mutex::new(
Expand Down
Loading
Loading