Skip to content

Commit 4238fa4

Browse files
feat(managed-instance): warn user for unsupported flush strategy configuration
1 parent 87e3d36 commit 4238fa4

4 files changed

Lines changed: 24 additions & 10 deletions

File tree

bottlecap/src/bin/bottlecap/main.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ use std::{collections::hash_map, env, path::Path, str::FromStr, sync::Arc};
9999
use tokio::time::{Duration, Instant};
100100
use tokio::{sync::Mutex as TokioMutex, sync::mpsc::Sender, task::JoinHandle};
101101
use tokio_util::sync::CancellationToken;
102-
use tracing::{debug, error};
102+
use tracing::{debug, error, warn};
103103
use tracing_subscriber::EnvFilter;
104104
use ustr::Ustr;
105105

@@ -443,12 +443,15 @@ fn get_flush_strategy_for_mode(
443443
if let FlushStrategy::Continuously(_) = configured_strategy {
444444
configured_strategy
445445
} else {
446-
debug!(
447-
"Managed Instance mode detected. Flush strategy '{}' is not compatible with managed instance mode. \
448-
Enforcing continuous flush strategy with {}ms interval for optimal performance.",
449-
configured_strategy.name(),
450-
DEFAULT_CONTINUOUS_FLUSH_INTERVAL
451-
);
446+
// Only log if the user explicitly configured a non-default strategy
447+
if !matches!(configured_strategy, FlushStrategy::Default) {
448+
warn!(
449+
"Managed Instance mode detected. Flush strategy '{}' is not compatible with managed instance mode. \
450+
Enforcing continuous flush strategy with {}ms interval for optimal performance.",
451+
configured_strategy.name(),
452+
DEFAULT_CONTINUOUS_FLUSH_INTERVAL
453+
);
454+
}
452455

453456
FlushStrategy::Continuously(PeriodicStrategy {
454457
interval: DEFAULT_CONTINUOUS_FLUSH_INTERVAL,

bottlecap/src/extension/telemetry/events.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,12 +432,20 @@ mod tests {
432432
spans: Some(vec![
433433
TelemetrySpan {
434434
name: "responseLatency".to_string(),
435-
start: chrono::Utc.with_ymd_and_hms(2025, 9, 19, 19, 36, 50).unwrap().with_nanosecond(880_000_000).unwrap(),
435+
start: chrono::Utc.with_ymd_and_hms(2025, 9, 19, 19, 36, 50)
436+
.single()
437+
.expect("test date should be valid")
438+
.with_nanosecond(880_000_000)
439+
.expect("test nanosecond should be valid"),
436440
duration_ms: 0.847,
437441
},
438442
TelemetrySpan {
439443
name: "responseDuration".to_string(),
440-
start: chrono::Utc.with_ymd_and_hms(2025, 9, 19, 19, 36, 50).unwrap().with_nanosecond(880_000_000).unwrap(),
444+
start: chrono::Utc.with_ymd_and_hms(2025, 9, 19, 19, 36, 50)
445+
.single()
446+
.expect("test date should be valid")
447+
.with_nanosecond(880_000_000)
448+
.expect("test nanosecond should be valid"),
441449
duration_ms: 0.127,
442450
},
443451
]),

bottlecap/src/secrets/decrypt.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,7 @@ mod tests {
543543
sandbox_init_time: Instant::now(),
544544
runtime_api: String::new(),
545545
exec_wrapper: None,
546+
initialization_type: "on-demand".into(),
546547
}),
547548
&AwsCredentials{
548549
aws_access_key_id: "AKIDEXAMPLE".to_string(),
@@ -602,6 +603,7 @@ mod tests {
602603
sandbox_init_time: Instant::now(),
603604
runtime_api: String::new(),
604605
exec_wrapper: None,
606+
initialization_type: "on-demand".into(),
605607
}),
606608
&AwsCredentials{
607609
aws_access_key_id: "AKIDEXAMPLE".to_string(),

local_tests/managed-instance/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ ARG TARGET=managed-instance
88
ENV LOG_LEVEL=debug
99
ENV DD_LOG_LEVEL=debug
1010
# Enforce flushing
11-
ENV DD_SERVERLESS_FLUSH_STRATEGY=continuously,1000
11+
# ENV DD_SERVERLESS_FLUSH_STRATEGY=continuously,60000
12+
# ENV DD_SERVERLESS_FLUSH_STRATEGY=periodically,60000
1213

1314

1415
# ---- Add remote dev tooling ----

0 commit comments

Comments
 (0)