feat(dogstatsd)!: add shared_runtime buffered sink#2224
Conversation
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
📚 Documentation Check Results📦
|
Clippy Allow Annotation ReportComparing clippy allow annotations between branches:
Summary by Rule
Annotation Counts by File
Annotation Stats by Crate
About This ReportThis report tracks Clippy allow annotations for specific rules, showing how they've changed in this PR. Decreasing the number of these annotations generally improves code quality. |
🔒 Cargo Deny Results📦
|
|
Artifact Size Benchmark Reportaarch64-alpine-linux-musl
aarch64-unknown-linux-gnu
libdatadog-x64-windows
libdatadog-x86-windows
x86_64-alpine-linux-musl
x86_64-unknown-linux-gnu
|
8eb7bc6 to
fed7da4
Compare
597364e to
b905f96
Compare
fed7da4 to
7bafd9b
Compare
b905f96 to
30d94f8
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7bafd9bcfa
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| std::future::pending::<()>().await; | ||
| } | ||
| } | ||
| println!("Received metric: {:#?}", self.pending); |
There was a problem hiding this comment.
Remove per-metric stdout logging
When the shared-runtime client is used, trigger runs once per metric, so this println! writes the full DogStatsD line (including tags) to the host process's stdout before forwarding it. Because libdatadog is embedded in customer runtimes, this creates an unsolicited global side effect, can leak metric/tag data into application logs, and can flood or block the hot metric path; use structured tracing at a disabled-by-default level or remove it.
Useful? React with 👍 / 👎.
| tracing = { version = "0.1", default-features = false } | ||
| anyhow = { version = "1.0" } | ||
| http = "1.1" | ||
| libdd-shared-runtime = { version = "2.0.0", path = "../libdd-shared-runtime", optional = true } |
There was a problem hiding this comment.
Preserve FIPS feature wiring for shared runtime
With this optional dependency using default features, enabling shared-runtime also enables libdd-shared-runtime's default https feature, and libdd-dogstatsd-client's fips feature only reaches its direct libdd-common dependency. In a --no-default-features --features shared-runtime,fips build this pulls the shared runtime's non-FIPS HTTPS stack instead of propagating libdd-shared-runtime/fips, unlike the other crates in this workspace that depend on the shared runtime with default-features = false and wire both https and fips through.
Useful? React with 👍 / 👎.
BenchmarksComparisonBenchmark execution time: 2026-07-10 14:44:30 Comparing candidate commit 7bafd9b in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 142 metrics, 0 unstable metrics.
|
7bafd9b to
8f5b1cf
Compare
8f5b1cf to
0e35cfd
Compare

What does this PR do?
Provide a SharedRuntime based buffered sink. The current
QueuingMetricSinkspawns a thread which isn't forksafe. This provides an alternative that can be used in forking context.Motivation
Currently the dogstatsd client doesn't survive a fork and all metrics submitted after the fork are never sent.
Additional Notes
Anything else we should know when reviewing?
How to test the change?
Describe here in detail how the change can be validated.