feat(dogstatsd): add units for timed metrics#1565
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 399dd0254b
ℹ️ 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".
tobz
left a comment
There was a problem hiding this comment.
We should use MetaString instead of Arc<str> because otherwise we're always allocating for a string that can be inlined.
Send unit information for aggregate metrics calculated from timed metrics. Currently there is no way to distinguish between abstract histograms and timed metrics which are represented as histograms. To disambiguate, we send the unit information with the aggregate metrics calculated from the histogram values. Signed-off-by: Mark Kirichenko <mark.kirichenko@datadoghq.com>
399dd02 to
a53e5a9
Compare
Binary Size Analysis (Agent Data Plane)Target: 507d913 (baseline) vs a53e5a9 (comparison) diff
|
| Module | File Size | Symbols |
|---|---|---|
saluki_env::helpers::remote_agent |
+22.18 KiB | 2 |
backon |
-16.86 KiB | 1 |
tower_layer |
-9.07 KiB | 9 |
tonic |
+4.33 KiB | 11 |
anon.556381182ece2d1a34385503d73c0a9e.62.llvm.2819371484686640837 |
+3.47 KiB | 1 |
anon.94dd6a447bf9f9fbd0442074f35f7515.1.llvm.5913085556691654484 |
-3.47 KiB | 1 |
anon.f553f6e9457fd909f79c926efd29eb66.22.llvm.1648316244533297028 |
+2.63 KiB | 1 |
anon.40340ab29c26454e228b882d4ecb70d4.0.llvm.14605026808982526804 |
-2.63 KiB | 1 |
tokio_util |
+2.41 KiB | 6 |
[sections] |
+2.17 KiB | 7 |
saluki_components::transforms::aggregate |
+2.00 KiB | 3 |
h2 |
-1.87 KiB | 24 |
anon.f83dfb2c1817ba3cab755df2ab972865.513.llvm.15290961048654791904 |
-1.70 KiB | 1 |
anon.3c5982eca991f49048e400a152bf1b31.1.llvm.14102024339487881263 |
+1.69 KiB | 1 |
anon.ecdd43b268ff7a1e667e42f6ad0a8f5e.120.llvm.12321406416096248332 |
-1.66 KiB | 1 |
anon.0fe9e463a009e606f5a30416b38b62f1.3.llvm.9230630131155697409 |
+1.66 KiB | 1 |
otlp_protos::otlp_include::opentelemetry |
+1.40 KiB | 32 |
anon.ff07114ed2750c9bbe4cae6748dc8434.728.llvm.15665205255274019542 |
+1.33 KiB | 1 |
anon.3ed47645e4aa12c6a9402ef231b44275.5.llvm.12051301733971437701 |
-1.33 KiB | 1 |
saluki_io::deser::framing |
-1.24 KiB | 2 |
Detailed Symbol Changes
FILE SIZE VM SIZE
-------------- --------------
[NEW] +21.8Ki [NEW] +21.6Ki saluki_env::helpers::remote_agent::client::RemoteAgentClient::from_configuration::_{{closure}}::_{{closure}}::_{{closure}}::hd91eede76d55b01a
[NEW] +3.67Ki [NEW] +3.50Ki _<futures_util::future::try_future::AndThen<Fut1,Fut2,F> as core::future::future::Future>::poll::h262539ce92b8b8ea
[NEW] +3.47Ki [NEW] +16 anon.556381182ece2d1a34385503d73c0a9e.62.llvm.2819371484686640837
[NEW] +2.63Ki [NEW] +80 anon.f553f6e9457fd909f79c926efd29eb66.22.llvm.1648316244533297028
[NEW] +2.56Ki [NEW] +147 _<std::sync::poison::PoisonError<T> as core::fmt::Debug>::fmt::hd6b6612e86e8e73c
+98% +2.19Ki +103% +2.19Ki tonic::transport::channel::service::connection::Connection::new::h4781e93189c77695
+88% +2.06Ki +92% +2.06Ki tonic::transport::channel::service::connection::Connection::new::h62edff03ab540486
+7.2% +2.00Ki +7.3% +2.00Ki _<saluki_components::transforms::aggregate::Aggregate as saluki_core::components::transforms::Transform>::run::_{{closure}}::hf3bb4cb9d5f8836a
[NEW] +1.89Ki [NEW] +1.07Ki core::ptr::drop_in_place<saluki_core::data_model::event::metric::metadata::MetricMetadata>::h585763ecc6b086e0
[NEW] +1.79Ki [NEW] +315 core::ptr::drop_in_place<tokio::sync::mpsc::bounded::Permit<saluki_components::sources::otlp::OtlpResource>>::h4e161ccc5730da5a
[NEW] +1.69Ki [NEW] +97 anon.3c5982eca991f49048e400a152bf1b31.1.llvm.14102024339487881263
[NEW] +1.66Ki [NEW] +77 anon.0fe9e463a009e606f5a30416b38b62f1.3.llvm.9230630131155697409
[DEL] -1.66Ki [DEL] -77 anon.ecdd43b268ff7a1e667e42f6ad0a8f5e.120.llvm.12321406416096248332
[DEL] -1.70Ki [DEL] -97 anon.f83dfb2c1817ba3cab755df2ab972865.513.llvm.15290961048654791904
[DEL] -1.70Ki [DEL] -1.02Ki core::ptr::drop_in_place<saluki_core::data_model::event::metric::metadata::MetricMetadata>::hb3a7e3a5c655a987
[DEL] -1.80Ki [DEL] -315 core::ptr::drop_in_place<tokio::sync::mpsc::bounded::Permit<saluki_components::relays::otlp::OtlpPayload>>::hf384fa397e3644cb
[DEL] -2.63Ki [DEL] -80 anon.40340ab29c26454e228b882d4ecb70d4.0.llvm.14605026808982526804
[DEL] -3.47Ki [DEL] -16 anon.94dd6a447bf9f9fbd0442074f35f7515.1.llvm.5913085556691654484
[DEL] -3.73Ki [DEL] -3.50Ki _<futures_util::future::try_future::try_flatten::TryFlatten<Fut,<Fut as futures_core::future::TryFuture>::Ok> as core::future::future::Future>::poll::hc4f1f75d8f6192a2
-0.1% -8.80Ki -0.1% -6.04Ki [6983 Others]
-91.4% -16.9Ki -92.2% -16.9Ki _<backon::retry::Retry<B,T,E,Fut,FutureFn,SF$C&C$NF,AF> as core::future::future::Future>::poll::he82a83420d3eaeff
+0.0% +5.10Ki +0.0% +5.16Ki TOTAL
Regression Detector (Agent Data Plane)Regression Detector ResultsRun ID: e054e046-3629-4561-ad27-e567a1b7bb7d Baseline: 507d913 Optimization Goals: ✅ No significant changes detected
|
| perf | experiment | goal | Δ mean % | Δ mean % CI | trials | links |
|---|---|---|---|---|---|---|
| ➖ | otlp_ingest_logs_5mb_memory | memory utilization | +2.30 | [+1.99, +2.61] | 1 | (metrics) (profiles) (logs) |
| ➖ | otlp_ingest_logs_5mb_throughput | ingress throughput | +0.02 | [-0.10, +0.15] | 1 | (metrics) (profiles) (logs) |
| ➖ | otlp_ingest_logs_5mb_cpu | % cpu utilization | -2.47 | [-7.10, +2.15] | 1 | (metrics) (profiles) (logs) |
Fine details of change detection per experiment
| perf | experiment | goal | Δ mean % | Δ mean % CI | trials | links |
|---|---|---|---|---|---|---|
| ➖ | otlp_ingest_metrics_5mb_memory | memory utilization | +4.29 | [+4.09, +4.49] | 1 | (metrics) (profiles) (logs) |
| ➖ | dsd_uds_10mb_3k_contexts_cpu | % cpu utilization | +3.22 | [-26.23, +32.67] | 1 | (metrics) (profiles) (logs) |
| ➖ | otlp_ingest_traces_5mb_cpu | % cpu utilization | +2.60 | [+0.68, +4.51] | 1 | (metrics) (profiles) (logs) |
| ➖ | otlp_ingest_logs_5mb_memory | memory utilization | +2.30 | [+1.99, +2.61] | 1 | (metrics) (profiles) (logs) |
| ➖ | quality_gates_rss_dsd_heavy | memory utilization | +1.40 | [+1.27, +1.53] | 1 | (metrics) (profiles) (logs) |
| ➖ | quality_gates_rss_dsd_ultraheavy | memory utilization | +1.03 | [+0.90, +1.16] | 1 | (metrics) (profiles) (logs) |
| ➖ | quality_gates_rss_dsd_medium | memory utilization | +0.72 | [+0.56, +0.89] | 1 | (metrics) (profiles) (logs) |
| ➖ | dsd_uds_500mb_3k_contexts_memory | memory utilization | +0.59 | [+0.45, +0.74] | 1 | (metrics) (profiles) (logs) |
| ➖ | quality_gates_rss_idle | memory utilization | +0.41 | [+0.37, +0.44] | 1 | (metrics) (profiles) (logs) |
| ➖ | dsd_uds_1mb_3k_contexts_memory | memory utilization | +0.38 | [+0.23, +0.53] | 1 | (metrics) (profiles) (logs) |
| ➖ | dsd_uds_10mb_3k_contexts_memory | memory utilization | +0.38 | [+0.22, +0.54] | 1 | (metrics) (profiles) (logs) |
| ➖ | otlp_ingest_traces_5mb_throughput | ingress throughput | +0.34 | [+0.26, +0.41] | 1 | (metrics) (profiles) (logs) |
| ➖ | otlp_ingest_traces_ottl_filtering_5mb_throughput | ingress throughput | +0.18 | [+0.10, +0.25] | 1 | (metrics) (profiles) (logs) |
| ➖ | quality_gates_rss_dsd_low | memory utilization | +0.14 | [-0.02, +0.31] | 1 | (metrics) (profiles) (logs) |
| ➖ | otlp_ingest_traces_ottl_filtering_5mb_memory | memory utilization | +0.07 | [-0.17, +0.31] | 1 | (metrics) (profiles) (logs) |
| ➖ | otlp_ingest_logs_5mb_throughput | ingress throughput | +0.02 | [-0.10, +0.15] | 1 | (metrics) (profiles) (logs) |
| ➖ | dsd_uds_512kb_3k_contexts_memory | memory utilization | +0.01 | [-0.13, +0.16] | 1 | (metrics) (profiles) (logs) |
| ➖ | otlp_ingest_metrics_5mb_throughput | ingress throughput | +0.01 | [-0.16, +0.17] | 1 | (metrics) (profiles) (logs) |
| ➖ | dsd_uds_10mb_3k_contexts_throughput | ingress throughput | +0.01 | [-0.16, +0.17] | 1 | (metrics) (profiles) (logs) |
| ➖ | dsd_uds_1mb_3k_contexts_throughput | ingress throughput | +0.00 | [-0.06, +0.06] | 1 | (metrics) (profiles) (logs) |
| ➖ | dsd_uds_512kb_3k_contexts_throughput | ingress throughput | -0.00 | [-0.05, +0.05] | 1 | (metrics) (profiles) (logs) |
| ➖ | otlp_ingest_traces_ottl_transform_5mb_throughput | ingress throughput | -0.00 | [-0.08, +0.07] | 1 | (metrics) (profiles) (logs) |
| ➖ | dsd_uds_100mb_3k_contexts_throughput | ingress throughput | -0.01 | [-0.05, +0.03] | 1 | (metrics) (profiles) (logs) |
| ➖ | dsd_uds_100mb_3k_contexts_memory | memory utilization | -0.04 | [-0.19, +0.12] | 1 | (metrics) (profiles) (logs) |
| ➖ | otlp_ingest_traces_ottl_transform_5mb_memory | memory utilization | -0.12 | [-0.28, +0.04] | 1 | (metrics) (profiles) (logs) |
| ➖ | otlp_ingest_traces_5mb_memory | memory utilization | -0.17 | [-0.33, -0.00] | 1 | (metrics) (profiles) (logs) |
| ➖ | otlp_ingest_metrics_5mb_cpu | % cpu utilization | -0.28 | [-5.92, +5.37] | 1 | (metrics) (profiles) (logs) |
| ➖ | otlp_ingest_traces_ottl_filtering_5mb_cpu | % cpu utilization | -0.47 | [-2.84, +1.90] | 1 | (metrics) (profiles) (logs) |
| ➖ | otlp_ingest_traces_ottl_transform_5mb_cpu | % cpu utilization | -0.57 | [-2.59, +1.45] | 1 | (metrics) (profiles) (logs) |
| ➖ | dsd_uds_100mb_3k_contexts_cpu | % cpu utilization | -0.76 | [-6.40, +4.88] | 1 | (metrics) (profiles) (logs) |
| ➖ | dsd_uds_500mb_3k_contexts_cpu | % cpu utilization | -0.83 | [-2.23, +0.57] | 1 | (metrics) (profiles) (logs) |
| ➖ | dsd_uds_512kb_3k_contexts_cpu | % cpu utilization | -0.97 | [-56.63, +54.69] | 1 | (metrics) (profiles) (logs) |
| ➖ | dsd_uds_500mb_3k_contexts_throughput | ingress throughput | -1.27 | [-1.39, -1.15] | 1 | (metrics) (profiles) (logs) |
| ➖ | otlp_ingest_logs_5mb_cpu | % cpu utilization | -2.47 | [-7.10, +2.15] | 1 | (metrics) (profiles) (logs) |
| ➖ | dsd_uds_1mb_3k_contexts_cpu | % cpu utilization | -3.50 | [-55.36, +48.35] | 1 | (metrics) (profiles) (logs) |
Bounds Checks: ✅ Passed
| perf | experiment | bounds_check_name | replicates_passed | observed_value | links |
|---|---|---|---|---|---|
| ✅ | quality_gates_rss_dsd_heavy | memory_usage | 10/10 | 122.66MiB ≤ 140MiB | (metrics) (profiles) (logs) |
| ✅ | quality_gates_rss_dsd_low | memory_usage | 10/10 | 40.11MiB ≤ 50MiB | (metrics) (profiles) (logs) |
| ✅ | quality_gates_rss_dsd_medium | memory_usage | 10/10 | 62.03MiB ≤ 75MiB | (metrics) (profiles) (logs) |
| ✅ | quality_gates_rss_dsd_ultraheavy | memory_usage | 10/10 | 178.83MiB ≤ 200MiB | (metrics) (profiles) (logs) |
| ✅ | quality_gates_rss_idle | memory_usage | 10/10 | 27.55MiB ≤ 40MiB | (metrics) (profiles) (logs) |
Explanation
Confidence level: 90.00%
Effect size tolerance: |Δ mean %| ≥ 5.00%
Performance changes are noted in the perf column of each table:
- ✅ = significantly better comparison variant performance
- ❌ = significantly worse comparison variant performance
- ➖ = no significant change in performance
A regression test is an A/B test of target performance in a repeatable rig, where "performance" is measured as "comparison variant minus baseline variant" for an optimization goal (e.g., ingress throughput). Due to intrinsic variability in measuring that goal, we can only estimate its mean value for each experiment; we report uncertainty in that value as a 90.00% confidence interval denoted "Δ mean % CI".
For each experiment, we decide whether a change in performance is a "regression" -- a change worth investigating further -- if all of the following criteria are true:
-
Its estimated |Δ mean %| ≥ 5.00%, indicating the change is big enough to merit a closer look.
-
Its 90.00% confidence interval "Δ mean % CI" does not contain zero, indicating that if our statistical model is accurate, there is at least a 90.00% chance there is a difference in performance between baseline and comparison variants.
-
Its configuration does not mark it "erratic".
## Summary Send unit information for aggregate metrics calculated from timed metrics. Currently there is no way to distinguish between abstract histograms and timed metrics which are represented as histograms. To disambiguate, we send the unit information with the aggregate metrics calculated from the histogram values. ## Change Type - [ ] Bug fix - [x] New feature - [ ] Non-functional (chore, refactoring, docs) - [ ] Performance ## How did you test this PR? * added autotests to validate the new code. * did an end-to-end test with a personal account to confirm that timed metrics have units: <img width="1286" height="569" alt="Screenshot 2026-05-04 at 11 34 49" src="https://github.com/user-attachments/assets/8b185d4c-a334-4690-82ef-c364baa565d0" /> ## References - Closes: AGTMETRICS-433 Co-authored-by: toby.lawrence <toby.lawrence@datadoghq.com> d979cf8
## Summary Remove unit field from histogram `.count`s because those are unitless by nature. ## Change Type - [x] Bug fix - [ ] New feature - [ ] Non-functional (chore, refactoring, docs) - [ ] Performance ## How did you test this PR? Extended the unit test to validate this change. ## References - Fixes: AGTMETRICS-433 - Refers: #1565 Co-authored-by: toby.lawrence <toby.lawrence@datadoghq.com>
## Summary Remove unit field from histogram `.count`s because those are unitless by nature. ## Change Type - [x] Bug fix - [ ] New feature - [ ] Non-functional (chore, refactoring, docs) - [ ] Performance ## How did you test this PR? Extended the unit test to validate this change. ## References - Fixes: AGTMETRICS-433 - Refers: #1565 Co-authored-by: toby.lawrence <toby.lawrence@datadoghq.com> e127a93
Summary
Send unit information for aggregate metrics calculated from timed metrics.
Currently there is no way to distinguish between abstract histograms and timed metrics which are represented as histograms. To disambiguate, we send the unit information with the aggregate metrics calculated from the histogram values.
Change Type
How did you test this PR?
References