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
12 changes: 12 additions & 0 deletions .changesets/fix_bryn_datadog_timeout.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
### Prevent Datadog timeout errors in logs ([Issue #2058](https://github.com/apollographql/router/issue/2058))

The telemetry Datadog exporter uses connection pooling by default. However, these pools connections are frequently closed leading to errors in the router logs.

For example:
```
2024-07-19T15:28:22.970360Z ERROR OpenTelemetry trace error occurred: error sending request for url (http://127.0.0.1:8126/v0.5/traces): connection error: Connection reset by peer (os error 54)
```

The pool timeout for the Datadog exporter is now set to 1 millisecond, which will greatly reduce the frequency that this occurs.

By [@BrynCooke](https://github.com/BrynCooke) in https://github.com/apollographql/router/pull/5692
9 changes: 8 additions & 1 deletion apollo-router/src/plugins/telemetry/tracing/datadog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

use std::fmt::Debug;
use std::fmt::Formatter;
use std::time::Duration;

use ahash::HashMap;
use ahash::HashMapExt;
Expand Down Expand Up @@ -196,7 +197,13 @@ impl TracingConfigurator for Config {
.expect("cargo version is set as a resource default;qed")
.to_string(),
)
.with_http_client(reqwest::Client::builder().build()?)
.with_http_client(
reqwest::Client::builder()
// https://github.com/open-telemetry/opentelemetry-rust-contrib/issues/7
// Set the idle timeout to something low to prevent termination of connections.
.pool_idle_timeout(Duration::from_millis(1))
.build()?,
)
.with_trace_config(common)
.build_exporter()?;

Expand Down