Skip to content

fix(common): ensure expiration/telemetry tasks shutdown when cache is dropped#1347

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 2 commits intomainfrom
tobz/common-cache-proper-cleanup-on-drop
Apr 13, 2026
Merged

fix(common): ensure expiration/telemetry tasks shutdown when cache is dropped#1347
gh-worker-dd-mergequeue-cf854d[bot] merged 2 commits intomainfrom
tobz/common-cache-proper-cleanup-on-drop

Conversation

@tobz
Copy link
Copy Markdown
Member

@tobz tobz commented Apr 12, 2026

Summary

This PR ensures that if either the telemetry or expiration features are used for saluki_common::cache::Cache, their associated asynchronous tasks are stopped when the Cache is dropped.

Change Type

  • Bug fix
  • New feature
  • Non-functional (chore, refactoring, docs)
  • Performance

How did you test this PR?

Added a new unit test.

References

AGTMETRICS-400

@tobz tobz requested a review from a team as a code owner April 12, 2026 21:03
@tobz tobz added the type/bug Bug fixes. label Apr 12, 2026
@dd-octo-sts dd-octo-sts bot added the area/core Core functionality, event model, etc. label Apr 12, 2026
@pr-commenter
Copy link
Copy Markdown

pr-commenter bot commented Apr 12, 2026

Binary Size Analysis (Agent Data Plane)

Target: 6796499 (baseline) vs 38f0e36 (comparison) diff
Analysis Type: Stripped binaries (debug symbols excluded)
Baseline Size: 26.56 MiB
Comparison Size: 26.60 MiB
Size Change: +34.52 KiB (+0.13%)
Pass/Fail Threshold: +5%
Result: PASSED ✅

Changes by Module

Module File Size Symbols
saluki_common::task::instrument +16.19 KiB 88
core +11.31 KiB 9129
tokio_util +10.41 KiB 29
[sections] +5.13 KiB 7
[Unmapped] -4.75 KiB 1
alloc +2.67 KiB 813
saluki_components::sources::otlp -2.59 KiB 164
tokio +1.70 KiB 2341
saluki_context::resolver::ContextResolverBuilder -1.53 KiB 6
saluki_context::resolver::TagsResolverBuilder -1.17 KiB 4
agent_data_plane::components::tag_filterlist -952 B 38
saluki_env::workload::on_demand_pid -946 B 22
saluki_env::workload::origin -762 B 12
saluki_config::ConfigurationError -384 B 1
hyper -368 B 314
saluki_config::ConfigurationLoader::from_environment +249 B 1
futures_util +208 B 64
saluki_components::common::datadog +200 B 320
agent_data_plane::internal::remote_agent -160 B 66
saluki_components::forwarders::otlp +120 B 60

Detailed Symbol Changes

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  [NEW] +1.79Mi  [NEW] +1.79Mi    std::thread::local::LocalKey<T>::with::hcaaa5bac7a60c195
  [NEW]  +119Ki  [NEW]  +119Ki    agent_data_plane::cli::run::create_topology::_{{closure}}::hb63e99f56b313a29
  [NEW] +64.2Ki  [NEW] +64.1Ki    saluki_components::common::datadog::io::run_endpoint_io_loop::_{{closure}}::h70a581198aa3c1b3
  [NEW] +62.2Ki  [NEW] +62.1Ki    agent_data_plane::cli::run::handle_run_command::_{{closure}}::h196c263b40fbd31c
  [NEW] +58.8Ki  [NEW] +58.6Ki    _<agent_data_plane::internal::control_plane::PrivilegedApiWorker as saluki_core::runtime::supervisor::Supervisable>::initialize::_{{closure}}::hab17ca3b18139262
  [NEW] +49.6Ki  [NEW] +49.4Ki    saluki_app::bootstrap::AppBootstrapper::bootstrap::_{{closure}}::h8cbaab9e954253e9
  [NEW] +46.4Ki  [NEW] +46.3Ki    h2::proto::connection::Connection<T,P,B>::poll::h2a735e6356201f20
  [NEW] +46.3Ki  [NEW] +46.1Ki    _<saluki_components::forwarders::otlp::OtlpForwarder as saluki_core::components::forwarders::Forwarder>::run::_{{closure}}::h93fe59419b1e027c
  [NEW] +46.2Ki  [NEW] +46.0Ki    _<saluki_components::destinations::prometheus::Prometheus as saluki_core::components::destinations::Destination>::run::_{{closure}}::hba4aa4d5ce5a3ce0
  [NEW] +44.1Ki  [NEW] +43.9Ki    saluki_env::workload::providers::remote_agent::RemoteAgentWorkloadProvider::from_configuration::_{{closure}}::h0416032db1d441f7
  +0.3% +34.2Ki  +0.3% +32.4Ki    [22771 Others]
  [DEL] -44.1Ki  [DEL] -43.9Ki    saluki_env::workload::providers::remote_agent::RemoteAgentWorkloadProvider::from_configuration::_{{closure}}::hc1631d06a048f8ec
  [DEL] -46.2Ki  [DEL] -46.0Ki    _<saluki_components::forwarders::otlp::OtlpForwarder as saluki_core::components::forwarders::Forwarder>::run::_{{closure}}::h7f3f238f01c7c07b
  [DEL] -46.2Ki  [DEL] -46.0Ki    _<saluki_components::destinations::prometheus::Prometheus as saluki_core::components::destinations::Destination>::run::_{{closure}}::h7cd756e43d896688
  [DEL] -46.4Ki  [DEL] -46.3Ki    h2::proto::connection::Connection<T,P,B>::poll::h0d6673d9b6808ab1
  [DEL] -49.5Ki  [DEL] -49.4Ki    saluki_app::bootstrap::AppBootstrapper::bootstrap::_{{closure}}::h8b566ae222308912
  [DEL] -58.8Ki  [DEL] -58.6Ki    _<agent_data_plane::internal::control_plane::PrivilegedApiWorker as saluki_core::runtime::supervisor::Supervisable>::initialize::_{{closure}}::h24038982eaa6b8db
  [DEL] -62.2Ki  [DEL] -62.0Ki    agent_data_plane::cli::run::handle_run_command::_{{closure}}::ha513eea250891efa
  [DEL] -64.2Ki  [DEL] -64.0Ki    saluki_components::common::datadog::io::run_endpoint_io_loop::_{{closure}}::h8d2631fc07284801
  [DEL]  -119Ki  [DEL]  -119Ki    agent_data_plane::cli::run::create_topology::_{{closure}}::h50eedad7d2b3f746
  [DEL] -1.79Mi  [DEL] -1.79Mi    std::thread::local::LocalKey<T>::with::hb991c762c5863691
  +0.1% +34.5Ki  +0.1% +32.8Ki    TOTAL

@pr-commenter
Copy link
Copy Markdown

pr-commenter bot commented Apr 12, 2026

Regression Detector (Agent Data Plane)

Regression Detector Results

Run ID: af7bcce0-985a-446e-945b-50fe69c3dd3c

Baseline: 9b4b516
Comparison: 1175d2a
Diff

Optimization Goals: ✅ No significant changes detected

Experiments ignored for regressions

Regressions in experiments with settings containing erratic: true are ignored.

perf experiment goal Δ mean % Δ mean % CI trials links
otlp_ingest_logs_5mb_throughput ingress throughput -0.02 [-0.14, +0.11] 1 (metrics) (profiles) (logs)
otlp_ingest_logs_5mb_cpu % cpu utilization -3.48 [-8.44, +1.47] 1 (metrics) (profiles) (logs)
otlp_ingest_logs_5mb_memory memory utilization -10.33 [-10.72, -9.94] 1 (metrics) (profiles) (logs)

Fine details of change detection per experiment

perf experiment goal Δ mean % Δ mean % CI trials links
dsd_uds_512kb_3k_contexts_cpu % cpu utilization +10.77 [-49.27, +70.81] 1 (metrics) (profiles) (logs)
dsd_uds_1mb_3k_contexts_cpu % cpu utilization +9.45 [-46.27, +65.17] 1 (metrics) (profiles) (logs)
otlp_ingest_metrics_5mb_cpu % cpu utilization +2.33 [-6.93, +11.60] 1 (metrics) (profiles) (logs)
otlp_ingest_traces_5mb_cpu % cpu utilization +2.20 [-0.01, +4.41] 1 (metrics) (profiles) (logs)
otlp_ingest_traces_ottl_transform_5mb_cpu % cpu utilization +0.81 [-1.32, +2.93] 1 (metrics) (profiles) (logs)
dsd_uds_512kb_3k_contexts_memory memory utilization +0.75 [+0.58, +0.93] 1 (metrics) (profiles) (logs)
quality_gates_rss_idle memory utilization +0.75 [+0.72, +0.79] 1 (metrics) (profiles) (logs)
dsd_uds_1mb_3k_contexts_memory memory utilization +0.66 [+0.48, +0.83] 1 (metrics) (profiles) (logs)
quality_gates_rss_dsd_medium memory utilization +0.48 [+0.29, +0.68] 1 (metrics) (profiles) (logs)
otlp_ingest_traces_ottl_filtering_5mb_memory memory utilization +0.31 [-0.02, +0.65] 1 (metrics) (profiles) (logs)
dsd_uds_10mb_3k_contexts_memory memory utilization +0.29 [+0.10, +0.48] 1 (metrics) (profiles) (logs)
quality_gates_rss_dsd_ultraheavy memory utilization +0.27 [+0.14, +0.40] 1 (metrics) (profiles) (logs)
otlp_ingest_traces_ottl_transform_5mb_memory memory utilization +0.13 [-0.11, +0.38] 1 (metrics) (profiles) (logs)
dsd_uds_100mb_3k_contexts_memory memory utilization +0.10 [-0.08, +0.28] 1 (metrics) (profiles) (logs)
dsd_uds_500mb_3k_contexts_cpu % cpu utilization +0.06 [-1.44, +1.55] 1 (metrics) (profiles) (logs)
dsd_uds_100mb_3k_contexts_throughput ingress throughput +0.02 [-0.03, +0.07] 1 (metrics) (profiles) (logs)
dsd_uds_512kb_3k_contexts_throughput ingress throughput +0.00 [-0.05, +0.06] 1 (metrics) (profiles) (logs)
otlp_ingest_traces_ottl_transform_5mb_throughput ingress throughput +0.00 [-0.02, +0.02] 1 (metrics) (profiles) (logs)
otlp_ingest_traces_ottl_filtering_5mb_throughput ingress throughput +0.00 [-0.02, +0.02] 1 (metrics) (profiles) (logs)
dsd_uds_1mb_3k_contexts_throughput ingress throughput +0.00 [-0.06, +0.06] 1 (metrics) (profiles) (logs)
otlp_ingest_traces_5mb_throughput ingress throughput +0.00 [-0.02, +0.02] 1 (metrics) (profiles) (logs)
dsd_uds_10mb_3k_contexts_throughput ingress throughput -0.01 [-0.13, +0.11] 1 (metrics) (profiles) (logs)
quality_gates_rss_dsd_heavy memory utilization -0.02 [-0.16, +0.13] 1 (metrics) (profiles) (logs)
otlp_ingest_logs_5mb_throughput ingress throughput -0.02 [-0.14, +0.11] 1 (metrics) (profiles) (logs)
otlp_ingest_metrics_5mb_throughput ingress throughput -0.02 [-0.14, +0.10] 1 (metrics) (profiles) (logs)
quality_gates_rss_dsd_low memory utilization -0.10 [-0.30, +0.09] 1 (metrics) (profiles) (logs)
otlp_ingest_traces_5mb_memory memory utilization -0.19 [-0.43, +0.05] 1 (metrics) (profiles) (logs)
dsd_uds_100mb_3k_contexts_cpu % cpu utilization -0.25 [-5.34, +4.83] 1 (metrics) (profiles) (logs)
dsd_uds_500mb_3k_contexts_memory memory utilization -0.27 [-0.44, -0.09] 1 (metrics) (profiles) (logs)
dsd_uds_10mb_3k_contexts_cpu % cpu utilization -0.74 [-29.97, +28.50] 1 (metrics) (profiles) (logs)
otlp_ingest_metrics_5mb_memory memory utilization -1.09 [-1.33, -0.84] 1 (metrics) (profiles) (logs)
dsd_uds_500mb_3k_contexts_throughput ingress throughput -2.40 [-2.53, -2.27] 1 (metrics) (profiles) (logs)
otlp_ingest_traces_ottl_filtering_5mb_cpu % cpu utilization -2.49 [-4.96, -0.02] 1 (metrics) (profiles) (logs)
otlp_ingest_logs_5mb_cpu % cpu utilization -3.48 [-8.44, +1.47] 1 (metrics) (profiles) (logs)
otlp_ingest_logs_5mb_memory memory utilization -10.33 [-10.72, -9.94] 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 116.02MiB ≤ 140MiB (metrics) (profiles) (logs)
quality_gates_rss_dsd_low memory_usage 10/10 34.36MiB ≤ 50MiB (metrics) (profiles) (logs)
quality_gates_rss_dsd_medium memory_usage 10/10 54.59MiB ≤ 75MiB (metrics) (profiles) (logs)
quality_gates_rss_dsd_ultraheavy memory_usage 10/10 167.15MiB ≤ 200MiB (metrics) (profiles) (logs)
quality_gates_rss_idle memory_usage 10/10 21.59MiB ≤ 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:

  1. Its estimated |Δ mean %| ≥ 5.00%, indicating the change is big enough to merit a closer look.

  2. 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.

  3. Its configuration does not mark it "erratic".

@tobz tobz force-pushed the tobz/common-cache-proper-cleanup-on-drop branch from 60d2ca4 to 38f0e36 Compare April 13, 2026 15:42
@gh-worker-dd-mergequeue-cf854d gh-worker-dd-mergequeue-cf854d bot merged commit 46a7b8d into main Apr 13, 2026
61 of 62 checks passed
dd-octo-sts bot pushed a commit that referenced this pull request Apr 13, 2026
… dropped (#1347)

## Summary

This PR ensures that if either the telemetry or expiration features are used for `saluki_common::cache::Cache`, their associated asynchronous tasks are stopped when the `Cache` is dropped.

## Change Type
- [x] Bug fix
- [ ] New feature
- [ ] Non-functional (chore, refactoring, docs)
- [ ] Performance

## How did you test this PR?

Added a new unit test.

## References

AGTMETRICS-400

Co-authored-by: toby.lawrence <toby.lawrence@datadoghq.com> 46a7b8d
@tobz tobz deleted the tobz/common-cache-proper-cleanup-on-drop branch April 13, 2026 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/core Core functionality, event model, etc. mergequeue-status: done type/bug Bug fixes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants