Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhancement: batch timestamped (passthrough) metrics for a short period of time before forwarding #426

Merged
merged 7 commits into from
Feb 5, 2025

Conversation

tobz
Copy link
Member

@tobz tobz commented Jan 15, 2025

Summary

This PR adds the ability for the aggregate transform to batch "passthrough" (pre-aggregated) metrics for short periods of time, in larger-than-normal event buffers, with the express goal of improving the efficiency of handling pre-aggregated metrics.

We've updated the logic of the transform to follow an equivalent behavior in the Datadog Agent's "no aggregation pipeline", which looks something like:

  • batch pre-aggregated metrics into their own buffer (defaults to 2048 points)
  • if the batch is filled to capacity, flush it to the "forwarder" (Datadog Metrics destination, in our case)
  • every two seconds, check if we have received any pre-aggregated metrics within the last second: if not, flush the batch to the "forwarder"

This aims to improve how many pre-aggregated metrics are packed into an individual series/sketch request, improving efficiency and reducing the number of requests that have to be sent. There's still a difference in number of series/sketch requests sent between Core Agent and ADP even with this batching behavior in place, which I'm still currently investigating in staging.

Change Type

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

How did you test this PR?

Tested in staging.

(more detail to be added here as I test further)

References

N/A

@github-actions github-actions bot added area/components Sources, transforms, and destinations. transform/aggregate Aggregate transform. labels Jan 15, 2025
@pr-commenter
Copy link

pr-commenter bot commented Jan 15, 2025

Regression Detector (Saluki)

Regression Detector Results

Run ID: a76a760d-897d-444d-a3c0-d7247cb38421

Baseline: 2b44efa
Comparison: 44da86b
Diff

Optimization Goals: ✅ No significant changes detected

Fine details of change detection per experiment

perf experiment goal Δ mean % Δ mean % CI trials links
dsd_uds_500mb_3k_contexts ingress throughput +0.81 [+0.69, +0.93] 1
dsd_uds_1mb_50k_contexts_memlimit ingress throughput +0.74 [+0.21, +1.28] 1
dsd_uds_100mb_3k_contexts_distributions_only memory utilization +0.43 [+0.31, +0.55] 1
dsd_uds_10mb_3k_contexts ingress throughput +0.01 [-0.02, +0.04] 1
dsd_uds_100mb_3k_contexts ingress throughput +0.01 [-0.04, +0.06] 1
dsd_uds_50mb_10k_contexts_no_inlining ingress throughput +0.01 [-0.06, +0.07] 1
dsd_uds_40mb_12k_contexts_40_senders ingress throughput +0.00 [-0.02, +0.03] 1
dsd_uds_50mb_10k_contexts_no_inlining_no_allocs ingress throughput +0.00 [-0.05, +0.05] 1
dsd_uds_1mb_3k_contexts ingress throughput +0.00 [-0.02, +0.02] 1
dsd_uds_1mb_50k_contexts ingress throughput -0.00 [-0.00, +0.00] 1
dsd_uds_1mb_3k_contexts_dualship ingress throughput -0.00 [-0.00, +0.00] 1
dsd_uds_512kb_3k_contexts ingress throughput -0.01 [-0.02, +0.01] 1
dsd_uds_100mb_250k_contexts ingress throughput -0.01 [-0.04, +0.03] 1
quality_gates_idle_rss memory utilization -0.59 [-0.62, -0.56] 1

Bounds Checks: ✅ Passed

perf experiment bounds_check_name replicates_passed links
quality_gates_idle_rss memory_usage 10/10

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

@pr-commenter
Copy link

pr-commenter bot commented Jan 15, 2025

Regression Detector (DogStatsD)

Regression Detector Results

Run ID: 6778acac-bd47-4ea7-aa8b-6e9ace904ed9

Baseline: 7.63.0-rc.2
Comparison: 7.63.0-rc.2

Optimization Goals: ✅ No significant changes detected

Fine details of change detection per experiment

perf experiment goal Δ mean % Δ mean % CI trials links
dsd_uds_40mb_12k_contexts_40_senders ingress throughput +0.00 [-0.00, +0.00] 1
dsd_uds_1mb_50k_contexts ingress throughput +0.00 [-0.00, +0.00] 1
dsd_uds_512kb_3k_contexts ingress throughput +0.00 [-0.01, +0.01] 1
dsd_uds_1mb_50k_contexts_memlimit ingress throughput +0.00 [-0.00, +0.00] 1
dsd_uds_1mb_3k_contexts ingress throughput -0.00 [-0.00, +0.00] 1
dsd_uds_1mb_3k_contexts_dualship ingress throughput -0.00 [-0.00, +0.00] 1
dsd_uds_100mb_250k_contexts ingress throughput -0.00 [-0.00, +0.00] 1
dsd_uds_10mb_3k_contexts ingress throughput -0.00 [-0.00, +0.00] 1
dsd_uds_100mb_3k_contexts ingress throughput -0.01 [-0.05, +0.04] 1
dsd_uds_100mb_3k_contexts_distributions_only memory utilization -0.32 [-0.46, -0.17] 1
dsd_uds_500mb_3k_contexts ingress throughput -2.08 [-2.22, -1.94] 1
quality_gates_idle_rss memory utilization -2.10 [-2.22, -1.99] 1

Bounds Checks: ❌ Failed

perf experiment bounds_check_name replicates_passed links
quality_gates_idle_rss memory_usage 0/10

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

@pr-commenter
Copy link

pr-commenter bot commented Jan 15, 2025

Regression Detector Links

Experiment Result Links

experiment link(s)
dsd_uds_100mb_250k_contexts [Profiling (ADP)] [Profiling (DSD)] [SMP Dashboard]
dsd_uds_100mb_3k_contexts [Profiling (ADP)] [Profiling (DSD)] [SMP Dashboard]
dsd_uds_100mb_3k_contexts_distributions_only [Profiling (ADP)] [Profiling (DSD)] [SMP Dashboard]
dsd_uds_10mb_3k_contexts [Profiling (ADP)] [Profiling (DSD)] [SMP Dashboard]
dsd_uds_1mb_3k_contexts [Profiling (ADP)] [Profiling (DSD)] [SMP Dashboard]
dsd_uds_1mb_3k_contexts_dualship [Profiling (ADP)] [Profiling (DSD)] [SMP Dashboard]
dsd_uds_1mb_50k_contexts [Profiling (ADP)] [Profiling (DSD)] [SMP Dashboard]
dsd_uds_1mb_50k_contexts_memlimit [Profiling (ADP)] [Profiling (DSD)] [SMP Dashboard]
dsd_uds_40mb_12k_contexts_40_senders [Profiling (ADP)] [Profiling (DSD)] [SMP Dashboard]
dsd_uds_500mb_3k_contexts [Profiling (ADP)] [Profiling (DSD)] [SMP Dashboard]
dsd_uds_512kb_3k_contexts [Profiling (ADP)] [Profiling (DSD)] [SMP Dashboard]
quality_gates_idle_rss [Profiling (ADP)] [Profiling (DSD)] [SMP Dashboard]
dsd_uds_50mb_10k_contexts_no_inlining (ADP only) [Profiling (ADP)] [SMP Dashboard]
dsd_uds_50mb_10k_contexts_no_inlining_no_allocs (ADP only) [Profiling (ADP)] [SMP Dashboard]

@tobz tobz force-pushed the tobz/add-batching-timestamped-metrics-agg branch 4 times, most recently from af4d048 to 3dc98ab Compare January 17, 2025 18:37
@tobz tobz force-pushed the tobz/add-batching-timestamped-metrics-agg branch from 49022d1 to f76068d Compare February 3, 2025 23:21
@tobz tobz marked this pull request as ready for review February 4, 2025 20:56
@tobz tobz requested a review from a team as a code owner February 4, 2025 20:56
self.forward_events(forwarder).await;

if self.active_buffer.try_push(event).is_some() {
error!("Event buffer is full even after forwarding events. Dropping event.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to add a return here to prevent line 490 from hitting?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, adding a return here makes sense. 👍🏻

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 75b6f96.

I also now increment the "events dropped" metric to reflect the reflect we're legitimately dropping a metric on the floor in that branch.

rayz
rayz previously approved these changes Feb 5, 2025
@tobz tobz merged commit bf76762 into main Feb 5, 2025
20 checks passed
@tobz tobz deleted the tobz/add-batching-timestamped-metrics-agg branch February 5, 2025 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/components Sources, transforms, and destinations. transform/aggregate Aggregate transform.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants