Skip to content
Merged
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
6 changes: 4 additions & 2 deletions bottlecap/src/bin/bottlecap/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use bottlecap::{
telemetry::{
self,
client::TelemetryApiClient,
events::{TelemetryEvent, TelemetryRecord},
events::{Status, TelemetryEvent, TelemetryRecord},
listener::TelemetryListener,
},
traces::{
Expand Down Expand Up @@ -452,7 +452,9 @@ async fn extension_loop_active(
// pass the invocation deadline to
// flush tasks here, so they can
// retry if we have more time
if flush_control.should_flush_end() {
//
// We always want to flush on a timeout
if flush_control.should_flush_end() || status == Status::Timeout {
tokio::join!(
logs_flusher.flush(),
metrics_flusher.flush(),
Expand Down
12 changes: 12 additions & 0 deletions bottlecap/src/lifecycle/invocation/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,18 @@ impl Processor {
// Increment the error type metric
if status == Status::Timeout {
self.enhanced_metrics.increment_timeout_metric();

// Invocation Span will never have the `trace_id` or `span_id` set
self.span.trace_id = generate_span_id();
self.span.span_id = generate_span_id();
self.span.error = 1;
self.span.meta.insert(
"error.msg".to_string(),
"Datadog detected an Impending Timeout".to_string(),
);
self.span
.meta
.insert("error.type".to_string(), "Impending Timeout".to_string());
}
}

Expand Down
Loading