Repository navigation
Conversation
There was a problem hiding this comment.
AI review by Claude - workflow run
Patch is correct, with 0 blocking findings. The new short-circuits behave the same as the paths they skip: Blocklist::contains already returns false when the blocklist is empty, and host enrichment never changes metrics. The rewired metrics back end connects every producer that used to feed metrics_enrich. Not blocking: the PR description says inactive stages are left out of the topology, but the code keeps them and only skips their work on each buffer, so please update the description.
There was a problem hiding this comment.
More details
The completed static review found no reportable defect in timestamp-cache invalidation, shared metrics routing, or client telemetry selection. Runtime behavior remains untested.
🤖 Bits Code Review · Commit 0dd5791
Binary Size Analysis (Agent Data Plane)Baseline: 8c80abe · Comparison: 331e8c4 · diff ✅ Binary size difference within thresholdChanges by Module
Detailed Symbol Changes |
Regression Detector (Agent Data Plane)Run ID: Optimization Goals: ✅ No significant changes detectedFine details of change detection per experiment (5)Experiments configured
Bounds Checks: ✅ Passed (5)
ExplanationA change is flagged as a regression when |Δ mean %| > 5.00% in the regressing direction for its optimization goal AND SMP marks the experiment as a regression ( |
0dd5791 to
9f953e8
Compare
b50927f to
2a30187
Compare
…it admission (#3492) ## Summary Packed contexts need to share recurring strings, such as `env:prod`, without storing a copy in every context. The existing `GenericMapInterner` cannot serve that role, and no existing crate meets all four constraints below. `GenericMapInterner` admits every string on its first lookup. On the 1M RUM workload, each gauge carries one unique 51 B UUID tag. Roughly 143,000 of those one-off tags fill the 8 MiB interner budget, and later recurring tags fall back to the heap. `SymbolTable` admits a string only on its second sighting, through a lazily allocated 8,192-slot thread-local witness (64 KiB per interning thread). Each of the 16 `SymbolTable` shards also keeps a 512 B atomic bloom filter of resident strings, 8 KiB across all shards. A first sighting checks that filter and the witness without taking any shard lock. Filter false positives cost a read lock but cannot admit a first sighting. `GenericMapInterner` returns a self-contained 24 B `MetaString` handle around a 16 B `StringState`. A packed context stores many tags in one allocation and needs a 4 B handle per tag. `SymbolTable` returns `u32` IDs into an external table, and owners read them without locking. The same IDs double as dictionary hints for the V3 encoder. Changing `GenericMapInterner` to match would break its current callers. Workload metadata, the tagger, OTLP traces and strict-mode context resolution rely on self-contained handles and first-hit admission. `SymbolTable` therefore stays a separate type with its own contract. Existing crates do not fit either. `lasso`, `ustr` and `string-interner` never reclaim dropped strings, so a long-lived agent grows as tags churn. `internment` reclaims strings but lacks a byte cap, two-hit admission and 4 B IDs. `SymbolTable` reference-counts each record and returns its space to a per-shard free list on the last release. This change adds no caller, so it has no Tier 1 effect by itself. Packed contexts and the V3 packed-symbol mapping depend on it. ## Change Type - [ ] Bug fix - [ ] New feature - [x] Non-functional - [ ] Performance ## How did you test this PR? - `cargo check --locked --workspace --tests` - `cargo test --locked -p stringtheory --lib singletons_leave_space_for_late_shared_symbols` - `cargo test --locked -p stringtheory` ## References - Stacked on: #3491 (`blt/1m-02-tagstr-borrowed-views`) - Requires: none. - Required by: packed `Context` storage through `SymbolTable` IDs, and V3 packed-symbol mapping through `Symbol` IDs. - Release note: none, because this change has no externally visible effect. ### Series overview - **Context & Tag Density:** pack contexts into one allocation and drop unused cache overhead. - #3490: shard ContextCache with inline expiry and live-context reuse (merged) - #3491: expose borrowed metric names and tags as `&str` - **Current (#3492):** add a sharded symbol dictionary with two-hit admission - #3511: store Context and its tags in one packed allocation - Dense Aggregation (#3495–#3496): replace 177 B buckets with per-kind typed pages. - Resumable Flush (#3497–#3499): shrink metric buffers and interleave bounded flush chunks. - Idle Pipeline Bypass (#3500–#3501): skip inactive transforms and borrow client telemetry. - `300m` CPU (#3502–#3507): cut encoder, codec and worker-pool hot-path cost. - Memory Admission (#3508–#3509): enforce opt-in configured memory limits with idle reclaim and counted drops. Co-authored-by: brian.troutwine <brian.troutwine@datadoghq.com> 8299071
There was a problem hiding this comment.
More details
Runtime behavior and the reported CPU and memory improvements were not independently verified; validation was limited to static analysis.
🤖 Bits Code Review · Commit 2a30187
#3511) ## Summary Each DogStatsD context at base costs about 1 KB across separate heap objects. It holds a 192 B `ArcInner<ContextInner>`, a 48 B tag-set `Arc`, a 128 B to 320 B tag `Vec` and 64 B for spilled UUIDs. On 1M RUM, active `dsd_in` live heap reaches 886.9 MiB to 929.9 MiB. The `TagSetCache` adds 108 MiB to 145 MiB at the production 2,000,000-entry limit. It hits on 0.095% of lookups, 977 hits against 1,022,675 misses, and its backing slabs never shrink. Tuning the existing types cannot remove this cost, because the separate allocations and the shared tag-set `Arc` are the overhead. This change stores the name, host, tag descriptors and inline bytes in one immutable allocation behind an 8 B handle. Recurring strings become 4 B `SymbolTable` IDs, and contexts keep sharing origin tags. A closed `PrefixKind` selects the prefix layout. The `WithOrigin`, `WithLease`, and `WithOriginLease` structs define the layouts that have a prefix. The default heap-allowed path bypasses the `TagSetCache` entirely. The strict path keeps its interner quota and refuses data that it cannot represent. Stripped `optimized-release` Tier 1 runs show the gain from this change together with the borrowed views and `SymbolTable` it activates. Peak memory falls by 707.7 MiB on 1M RUM, 679.6 MiB on 500k default, 636.3 MiB on all-unique and 278.0 MiB on mixed churn. Cgroup CPU on 1M RUM falls 14.9%. Active `dsd_in` live heap on 1M RUM falls from 836.8 MiB to 210.2 MiB. ## Change Type - [ ] Bug fix - [ ] New feature - [ ] Non-functional - [x] Performance ## How did you test this PR? - `cargo check --locked --workspace --tests` - `cargo test --locked -p saluki-core --lib data_model::event::metric::context` - `cargo test --locked -p saluki-components --lib sources::dogstatsd::resolver::tests` - Tier 1 runs use stripped `optimized-release` builds against base `18f587f5f6` in cgroup v2, in default unbounded mode. - 1M RUM holds 1,000,000 gauges that each carry one unique 51 B UUID tag and 4 to 10 shared tags. - 500k default runs the same stream under Saluki's default 500,000-entry context and tag-set cache limits. - All-unique holds 1,000,000 gauges that each carry eight unique tags of 32 B to 50 B. - Mixed churn cycles gauges, counters, rates, sets and sketches between 200,000 and 1,000,000 active contexts. ## References - Stacked on: #3492 (`blt/1m-03-sharded-symbol-table`) - Supersedes: #3494 (auto-closed by GitHub when reordering #3493 above packed contexts) - Requires: borrowed `&str` / `ContextTags` views (#3491), and two-hit `SymbolTable` IDs (#3492). - Required by: V3 packed-symbol mapping through packed tag symbol IDs, and stack tag deduplication through the packed builder. - Release note: `releasenotes/notes/packed-contexts-0a5b1c9ad15dc05f.yaml` ### Series overview - **Context & Tag Density:** pack contexts into one allocation and drop unused cache overhead. - #3490: shard ContextCache with inline expiry and live-context reuse (merged) - #3491: expose borrowed metric names and tags as `&str` - #3492: add a sharded symbol dictionary with two-hit admission - **Current (#3511):** store Context and its tags in one packed allocation - Dense Aggregation (#3495–#3496): replace 177 B buckets with per-kind typed pages. - Resumable Flush (#3497–#3499): shrink metric buffers and interleave bounded flush chunks. - Idle Pipeline Bypass (#3500–#3501): skip inactive transforms and borrow client telemetry. - `300m` CPU (#3502–#3507): cut encoder, codec and worker-pool hot-path cost. - Memory Admission (#3508–#3509): enforce opt-in configured memory limits with idle reclaim and counted drops. Co-authored-by: brian.troutwine <brian.troutwine@datadoghq.com>
## Summary Every aggregated DogStatsD `Set` at base allocates a `HashSet`, even when it holds one member. A singleton set therefore pays for a heap table and its control bytes to store a single string. Dense aggregate pages need a set representation that fits a fixed-size `SetRow`. Without `SetMembers`, the dense storage build fails with `E0425` for the missing type. This change adds `SetMembers`, which stores empty and singleton sets inline. It allocates a hash table only when a second distinct member arrives. Merging timestamped buckets still preserves exact deduplication. This change has no separate Tier 1 measurement. It is a compile prerequisite for dense aggregate pages, which carry the measured gain. ## Change Type - [ ] Bug fix - [ ] New feature - [ ] Non-functional - [x] Performance ## How did you test this PR? - `cargo check --locked --workspace --tests` - `cargo test --locked -p saluki-core --lib promotes_only_for_distinct_members` ## References - Stacked on: #3511 (`blt/1m-05-packed-context`) - Requires: none. - Required by: dense aggregate pages through `SetMembers` in `SetRow`. - Release note: `releasenotes/notes/inline-sets-b5611095646c97f9.yaml` ### Series overview - Context & Tag Density (#3490–#3492, #3511): pack contexts into one allocation and drop unused cache overhead. - **Dense Aggregation:** replace 177 B buckets with per-kind typed pages. - **Current (#3495):** store singleton Set values inline - #3496: store live aggregate metrics in dense typed pages indexed by u32 slots - Resumable Flush (#3497–#3499): shrink metric buffers and interleave bounded flush chunks. - Idle Pipeline Bypass (#3500–#3501): skip inactive transforms and borrow client telemetry. - `300m` CPU (#3502–#3507): cut encoder, codec and worker-pool hot-path cost. - Memory Admission (#3508–#3509): enforce opt-in configured memory limits with idle reclaim and counted drops. Co-authored-by: brian.troutwine <brian.troutwine@datadoghq.com>
2a30187 to
e2c4de1
Compare
There was a problem hiding this comment.
Native APM intake prevents ADP from starting because its telemetry output connects to metrics_enrich before the deferred metrics builder creates that component.
🤖 Bits Code Review · Commit e2c4de1
| if dp.metrics_pipeline_required(otlp) { | ||
| let routing_targets = | ||
| routing_targets.ok_or_else(|| generic_error!("The metrics pipeline requires the Datadog forwarder."))?; | ||
| add_baseline_metrics_pipeline_to_blueprint( |
There was a problem hiding this comment.
Defer native APM telemetry wiring with the metrics pipeline
When APM and native trace intake are enabled, add_apm_pipeline_to_blueprint still connects dd_traces_normalize.metrics directly to metrics_enrich. This PR defers creation of metrics_enrich until after that call, so Graph::add_edge returns NonexistentComponentId and ADP fails startup. Standalone mode now omits that target entirely. Register the normalizer output in metrics_inputs and remove its direct connection so both modes use the deferred metrics wiring.
React: 👍 useful · 👎 wrong · 😕 unclear · 👀 right, but not acting on it
What each reaction means
- 👍 Useful: correct, and you're fixing it or will.
- 👎 Wrong: the finding is incorrect, for example the bug can't happen or the code was misread.
- 😕 Unclear: you can't tell what it means or why it matters.
- 👀 Right, not acting: correct, but intended, out of scope for this PR, a known risk, or too minor.
🤖 Bits Code Review · Open Bits AI session
e2c4de1 to
0ac05b1
Compare
There was a problem hiding this comment.
More details
The timestamp fast path retains a fallback scan after mutable metric access, while context-only edits preserve the cached result. The completed static review reported no actionable correctness issues.
🤖 Bits Code Review · Commit 0ac05b1
…ages indexed by u32 slots (#3496) ## Summary The aggregator stores every series in `HashMap<Context, AggregatedMetric>`. Each bucket costs 177 B, because `MetricValues` reserves 104 B for its largest variant, a DDSketch. A gauge pays that full size plus 48 B of inline metadata. On 1M RUM, the table holds 362.0 MiB to 379.6 MiB of live heap. The table also doubles at 917,505 contexts, just below the 1M target. That resize grows it from 192 MiB to 384 MiB and briefly holds 576 MiB of old and new tables at once. A different hash map type cannot fix this, because each bucket stays sized for the largest value. This change moves values into per-kind 32 KiB typed pages. A thin index stores a 4 B `u32` slot with 3 kind bits and 29 row bits, about 10 MiB at 1M contexts. A gauge row takes 40 B, about 48 MiB at 1M contexts. Rare multi-point rows and owned metadata spill to exact overflow stores. Stripped `optimized-release` Tier 1 runs show peak memory falling by 497.9 MiB on 1M RUM, 506.5 MiB on all-unique and 482.3 MiB on mixed churn. Cgroup CPU falls 20.8% on 1M RUM, 10.9% on all-unique and 28.6% on mixed churn. Active `dsd_agg` live heap on 1M RUM falls from 362.0 MiB to 56.3 MiB. ## Change Type - [ ] Bug fix - [ ] New feature - [ ] Non-functional - [x] Performance ## How did you test this PR? - `cargo check --locked --workspace --tests` - `cargo test --locked -p saluki-components --lib every_type_matches_metric_values_merge` - Tier 1 runs use stripped `optimized-release` builds against base `18f587f5f6` in cgroup v2, in default unbounded mode. - 1M RUM holds 1,000,000 gauges that each carry one unique 51 B UUID tag and 4 to 10 shared tags. - All-unique holds 1,000,000 gauges that each carry eight unique tags of 32 B to 50 B. - Mixed churn cycles gauges, counters, rates, sets and sketches between 200,000 and 1,000,000 active contexts. ## References - Stacked on: #3495 (`blt/1m-06-inline-singleton-set`) - Requires: inline `SetMembers`. - Required by: resumable flush through `u32` slot cursors, and storage growth estimates through dense rows. - Release note: `releasenotes/notes/use-dense-aggregate-storage-8f83ecb8c4eaac61.yaml` ### Series overview - Context & Tag Density (#3490–#3492, #3511): pack contexts into one allocation and drop unused cache overhead. - **Dense Aggregation:** replace 177 B buckets with per-kind typed pages. - #3495: store singleton Set values inline - **Current (#3496):** store live aggregate metrics in dense typed pages indexed by u32 slots - Resumable Flush (#3497–#3499): shrink metric buffers and interleave bounded flush chunks. - Idle Pipeline Bypass (#3500–#3501): skip inactive transforms and borrow client telemetry. - `300m` CPU (#3502–#3507): cut encoder, codec and worker-pool hot-path cost. - Memory Admission (#3508–#3509): enforce opt-in configured memory limits with idle reclaim and counted drops.
0ac05b1 to
dea1919
Compare
…ages indexed by u32 slots (#3496) ## Summary The aggregator stores every series in `HashMap<Context, AggregatedMetric>`. Each bucket costs 177 B, because `MetricValues` reserves 104 B for its largest variant, a DDSketch. A gauge pays that full size plus 48 B of inline metadata. On 1M RUM, the table holds 362.0 MiB to 379.6 MiB of live heap. The table also doubles at 917,505 contexts, just below the 1M target. That resize grows it from 192 MiB to 384 MiB and briefly holds 576 MiB of old and new tables at once. A different hash map type cannot fix this, because each bucket stays sized for the largest value. This change moves values into per-kind 32 KiB typed pages. A thin index stores a 4 B `u32` slot with 3 kind bits and 29 row bits, about 10 MiB at 1M contexts. A gauge row takes 40 B, about 48 MiB at 1M contexts. Rare multi-point rows and owned metadata spill to exact overflow stores. Stripped `optimized-release` Tier 1 runs show peak memory falling by 497.9 MiB on 1M RUM, 506.5 MiB on all-unique and 482.3 MiB on mixed churn. Cgroup CPU falls 20.8% on 1M RUM, 10.9% on all-unique and 28.6% on mixed churn. Active `dsd_agg` live heap on 1M RUM falls from 362.0 MiB to 56.3 MiB. ## Change Type - [ ] Bug fix - [ ] New feature - [ ] Non-functional - [x] Performance ## How did you test this PR? - `cargo check --locked --workspace --tests` - `cargo test --locked -p saluki-components --lib every_type_matches_metric_values_merge` - Tier 1 runs use stripped `optimized-release` builds against base `18f587f5f6` in cgroup v2, in default unbounded mode. - 1M RUM holds 1,000,000 gauges that each carry one unique 51 B UUID tag and 4 to 10 shared tags. - All-unique holds 1,000,000 gauges that each carry eight unique tags of 32 B to 50 B. - Mixed churn cycles gauges, counters, rates, sets and sketches between 200,000 and 1,000,000 active contexts. ## References - Stacked on: #3495 (`blt/1m-06-inline-singleton-set`) - Requires: inline `SetMembers`. - Required by: resumable flush through `u32` slot cursors, and storage growth estimates through dense rows. - Release note: `releasenotes/notes/use-dense-aggregate-storage-8f83ecb8c4eaac61.yaml` ### Series overview - Context & Tag Density (#3490–#3492, #3511): pack contexts into one allocation and drop unused cache overhead. - **Dense Aggregation:** replace 177 B buckets with per-kind typed pages. - #3495: store singleton Set values inline - **Current (#3496):** store live aggregate metrics in dense typed pages indexed by u32 slots - Resumable Flush (#3497–#3499): shrink metric buffers and interleave bounded flush chunks. - Idle Pipeline Bypass (#3500–#3501): skip inactive transforms and borrow client telemetry. - `300m` CPU (#3502–#3507): cut encoder, codec and worker-pool hot-path cost. - Memory Admission (#3508–#3509): enforce opt-in configured memory limits with idle reclaim and counted drops. 4f46054
There was a problem hiding this comment.
Enabling native APM trace intake prevents ADP startup because the normalizer connects to metrics_enrich before that component exists.
🤖 Bits Code Review · Commit dea1919
| if dp.metrics_pipeline_required(otlp) { | ||
| let routing_targets = | ||
| routing_targets.ok_or_else(|| generic_error!("The metrics pipeline requires the Datadog forwarder."))?; | ||
| add_baseline_metrics_pipeline_to_blueprint( |
There was a problem hiding this comment.
Defer the native APM telemetry connection with the other inputs
With native APM intake enabled, add_apm_pipeline_to_blueprint() still connects dd_traces_normalize.metrics directly to metrics_enrich before this deferred construction runs. Graph::add_edge() immediately rejects the nonexistent component, so ADP fails startup instead of serving its enabled pipelines. Add the normalizer output to metrics_inputs and remove its existing direct connection, following the sampler handling. This must also support standalone mode, where metrics_enrich is no longer created.
React: 👍 useful · 👎 wrong · 😕 unclear · 👀 right, but not acting on it
What each reaction means
- 👍 Useful: correct, and you're fixing it or will.
- 👎 Wrong: the finding is incorrect, for example the bug can't happen or the code was misread.
- 😕 Unclear: you can't tell what it means or why it matters.
- 👀 Right, not acting: correct, but intended, out of scope for this PR, a known risk, or too minor.
🤖 Bits Code Review · Open Bits AI session
## Summary `EventsBuffer` stores every element as an `Event` enum, which sizes each slot for the largest event type at 344 B. A `Metric` needs only 160 B. A full 1,024-event metric batch therefore reserves 344 KiB to carry 160 KiB of metrics. A 1M-context flush emits about a thousand such batches, and many wait in channels at once. This change stores metric-only batches as `Metric` values. The buffer promotes to mixed `Event` storage when a different event type arrives. It keeps event order when it promotes, filters or drains. This change halves the payload of a full metric buffer. Its Tier 1 effect appears together with buffer recycling and resumable flush, which lower peak memory by 155.6 MiB on 1M RUM. ## Change Type - [ ] Bug fix - [ ] New feature - [ ] Non-functional - [x] Performance ## How did you test this PR? - `cargo check --locked --workspace --tests` - `cargo test --locked -p saluki-core --lib metric_backing_promotes_in_order_and_restarts_after_clear` ## References - Stacked on: #3496 (`blt/1m-07-dense-aggregate-pages`) - Requires: none. - Required by: buffer recycling through typed `Metric` backing. - Release note: `releasenotes/notes/typed-event-buffers-d3339735dc45e3a0.yaml` ### Series overview - Context & Tag Density (#3490–#3492, #3511): pack contexts into one allocation and drop unused cache overhead. - Dense Aggregation (#3495–#3496): replace 177 B buckets with per-kind typed pages. - **Resumable Flush:** shrink metric buffers and interleave bounded flush chunks. - **Current (#3497):** add typed Metric storage to EventsBuffer - #3498: recycle drained EventsBuffer allocations - #3499: interleave bounded flush chunks with ingest - Idle Pipeline Bypass (#3500–#3501): skip inactive transforms and borrow client telemetry. - `300m` CPU (#3502–#3507): cut encoder, codec and worker-pool hot-path cost. - Memory Admission (#3508–#3509): enforce opt-in configured memory limits with idle reclaim and counted drops. Co-authored-by: brian.troutwine <brian.troutwine@datadoghq.com>
dea1919 to
2214234
Compare
There was a problem hiding this comment.
Enabling native APM trace intake now prevents ADP from starting: its telemetry output connects to metrics_enrich before that component is created.
🤖 Bits Code Review · Commit 2214234
| if dp.metrics_pipeline_required(otlp) { | ||
| let routing_targets = | ||
| routing_targets.ok_or_else(|| generic_error!("The metrics pipeline requires the Datadog forwarder."))?; | ||
| add_baseline_metrics_pipeline_to_blueprint( |
There was a problem hiding this comment.
Defer native APM telemetry wiring with the other metric producers
With APM and native trace intake enabled, add_apm_pipeline_to_blueprint still connects dd_traces_normalize.metrics to metrics_enrich before this relocated call creates that component. Graph::add_edge immediately rejects the missing destination, so topology construction fails and ADP cannot start. Remove the direct connection and register the normalizer output in metrics_inputs alongside the other producers; this also handles standalone mode, where metrics_enrich is now omitted entirely.
React: 👍 useful · 👎 wrong · 😕 unclear · 👀 right, but not acting on it
What each reaction means
- 👍 Useful: correct, and you're fixing it or will.
- 👎 Wrong: the finding is incorrect, for example the bug can't happen or the code was misread.
- 😕 Unclear: you can't tell what it means or why it matters.
- 👀 Right, not acting: correct, but intended, out of scope for this PR, a known risk, or too minor.
🤖 Bits Code Review · Open Bits AI session
webern
left a comment
There was a problem hiding this comment.
I think the PR description is stale after you made some changes to it.
| let config = config_system.config(); | ||
| let dp = DataPlaneConfiguration::from_configuration(&config); | ||
| if !dp.standalone_mode() { | ||
| let metrics_outputs_from = if dp.standalone_mode() { |
There was a problem hiding this comment.
run.rs is already pretty torturous and I couldn't follow what was happening, so I asked if there was anything could make it easier to follow and it came up with the below. The note about host_enrichment in standalone mode seems ignorable. I'm not sure what we use it for, actually.
/// Where metrics enter the shared back end: the enrichment stage, or every producer directly.
struct MetricsEntry(Vec<&'static str>);AI
The standalone rewiring took me a while to follow, mostly because
metrics_outputs_frommeans["metrics_enrich"]in connected mode and every producer in standalone, and each builder has to be read with that in mind. Could we name it once, say a smallMetricsEntrywith a doc comment on the two modes? The loops could also collapse toconnect_components(metrics_outputs_from, ...), which already takes a list of sources.Separately: on main, standalone still ran
host_enrichmentinsidemetrics_enrich. Are we sure every standalone producer (checks, liveness, OTLP) already sets a host, so nothing goes out without one?
## Summary Each aggregate flush allocates fresh `EventsBuffer` storage for every output batch and frees it once the downstream drains it. A 1M-context flush emits about a thousand batches, so the allocator sees a burst of large requests every interval. The freed storage then returns to jemalloc only for the next flush to request it again. This change returns drained storage to a recycler local to the producing component. The recycler keeps at most one empty allocation of each kind. `Dispatcher::event_buffer_manager` lets flush code request recycled buffers for its output. This change has no separate Tier 1 measurement. Resumable flush and the idle pipeline bypass depend on it, and resumable flush carries the measured gain. ## Change Type - [ ] Bug fix - [ ] New feature - [ ] Non-functional - [x] Performance ## How did you test this PR? - `cargo check --locked --workspace --tests` - `cargo test --locked -p saluki-core --lib downstream_drain_recycles_backing_across_buffered_outputs` ## References - Stacked on: #3497 (`blt/1m-08-typed-metric-buffer`) - Requires: typed `Metric` storage in `EventsBuffer`. - Required by: resumable flush and the idle pipeline bypass through `Dispatcher::event_buffer_manager`. - Release note: `releasenotes/notes/recycle-event-buffers-1029b421ff51c533.yaml` ### Series overview - Context & Tag Density (#3490–#3492, #3511): pack contexts into one allocation and drop unused cache overhead. - Dense Aggregation (#3495–#3496): replace 177 B buckets with per-kind typed pages. - **Resumable Flush:** shrink metric buffers and interleave bounded flush chunks. - #3497: add typed Metric storage to EventsBuffer - **Current (#3498):** recycle drained EventsBuffer allocations - #3499: interleave bounded flush chunks with ingest - Idle Pipeline Bypass (#3500–#3501): skip inactive transforms and borrow client telemetry. - `300m` CPU (#3502–#3507): cut encoder, codec and worker-pool hot-path cost. - Memory Admission (#3508–#3509): enforce opt-in configured memory limits with idle reclaim and counted drops. Co-authored-by: brian.troutwine <brian.troutwine@datadoghq.com>
9004d7d to
70196bb
Compare
There was a problem hiding this comment.
Native APM intake prevents ADP from starting because its normalizer telemetry still connects to metrics_enrich before that component exists. Standalone mode additionally omits the target entirely.
🤖 Bits Code Review · Commit 70196bb
| if dp.metrics_pipeline_required(otlp) { | ||
| let routing_targets = | ||
| routing_targets.ok_or_else(|| generic_error!("The metrics pipeline requires the Datadog forwarder."))?; | ||
| add_baseline_metrics_pipeline_to_blueprint( |
There was a problem hiding this comment.
Include native APM telemetry in the shared metrics wiring
With APM and native trace intake enabled, add_apm_pipeline_to_blueprint still connects dd_traces_normalize.metrics directly to metrics_enrich. Moving metrics pipeline creation below that call means Graph::add_edge returns NonexistentComponentId, preventing ADP startup in connected and standalone modes. Standalone mode also no longer creates metrics_enrich. Remove the helper's direct edge and register dd_traces_normalize.metrics in metrics_inputs when native intake is enabled; both locations must change.
React: 👍 useful · 👎 wrong · 😕 unclear · 👀 right, but not acting on it
What each reaction means
- 👍 Useful: correct, and you're fixing it or will.
- 👎 Wrong: the finding is incorrect, for example the bug can't happen or the code was misread.
- 😕 Unclear: you can't tell what it means or why it matters.
- 👀 Right, not acting: correct, but intended, out of scope for this PR, a known risk, or too minor.
🤖 Bits Code Review · Open Bits AI session
There was a problem hiding this comment.
More details
The PR bypasses idle DogStatsD transforms, caches metric timestamp presence, mirrors only eligible client-telemetry rates, and skips standalone metric enrichment. The new commit fixes the native APM startup regression in connected and standalone modes by routing normalizer telemetry through shared metrics inputs, leaving no open findings.
🤖 Bits Code Review · Commit 0a80565
There was a problem hiding this comment.
More details
The completed static review reported no actionable findings in the DogStatsD bypass, timestamp cache, or client-telemetry routing changes. Runtime behavior was not tested, and production telemetry was intentionally excluded.
🤖 Bits Code Review · Commit 3443b4c
There was a problem hiding this comment.
More details
Timestamp-cache invalidation covers mutable metric access and filtering, preserving timestamp-based routing when buffer contents change. The static reviewer reported no actionable defects.
🤖 Bits Code Review · Commit 331e8c4
…t rules do not match (#3500) ## Summary The `tag_filterlist` transform clones the context of every counter and sketch metric before it checks its cache or its rules. When no rule names the metric, that clone only adds an atomic reference-count increment and decrement per metric. The idle pipeline bypass also needs a filter entry point that does not own the transform's dispatch loop. This change adds `filter_cached`, which looks up the cache with the borrowed context and checks rule names first. It clones the context only when a rule matches the metric name. Callers that borrow contexts keep the cached filter result. This change has no separate Tier 1 measurement. The idle pipeline bypass requires `filter_cached` and carries the measured gain. ## Change Type - [ ] Bug fix - [ ] New feature - [ ] Non-functional - [x] Performance ## How did you test this PR? - `cargo check --locked --workspace --tests` - `cargo test --locked -p agent-data-plane --bin agent-data-plane telemetry_records_hits_misses_and_filtered_tags` ## References - Stacked on: #3499 (`blt/1m-10-resumable-flush`) - Requires: none. - Required by: the idle transform bypass through `filter_cached`. - Release note: `releasenotes/notes/tag-filterlist-borrow-a2be81a44f22884a.yaml` ### Series overview - Context & Tag Density (#3490–#3492, #3511): pack contexts into one allocation and drop unused cache overhead. - Dense Aggregation (#3495–#3496): replace 177 B buckets with per-kind typed pages. - Resumable Flush (#3497–#3499): shrink metric buffers and interleave bounded flush chunks. - **Idle Pipeline Bypass:** skip inactive transforms and borrow client telemetry. - **Current (#3500):** skip context clones when tag_filterlist rules do not match - #3501: bypass idle DogStatsD transforms, cache buffer timestamps and borrow client telemetry - `300m` CPU (#3502–#3507): cut encoder, codec and worker-pool hot-path cost. - Memory Admission (#3508–#3509): enforce opt-in configured memory limits with idle reclaim and counted drops. Co-authored-by: brian.troutwine <brian.troutwine@datadoghq.com>
…e buffer timestamps and borrow client telemetry Every DogStatsD batch at base passes through the mapping and filtering transforms even when they have no rules. Each stage receives, scans and forwards the batch without changing it. Routing also scans every event to check for timestamps. After aggregation, client telemetry clones each batch to extract the rate metrics it reports. This change omits inactive mapping and filtering stages from the topology. `EventsBuffer` caches whether any metric carries a timestamp, so routing skips the per-event scan. Client telemetry borrows the eligible rate metrics after filtering and no longer clones the whole batch. Stripped `optimized-release` Tier 1 runs show peak memory falling by 22.4 MiB on 1M RUM and 15.0 MiB on mixed churn. Cgroup CPU falls 2.62% on 1M RUM and 5.42% on mixed churn. - [ ] Bug fix - [ ] New feature - [ ] Non-functional - [x] Performance - `cargo check --locked --workspace --tests` - `cargo test --locked -p agent-data-plane --bin agent-data-plane timestamp_fast_path_preserves_default_events_and_detects_mutated_points` - Tier 1 runs use stripped `optimized-release` builds against base `18f587f5f6` in cgroup v2, in default unbounded mode. - 1M RUM holds 1,000,000 gauges that each carry one unique 51 B UUID tag and 4 to 10 shared tags. - Mixed churn cycles gauges, counters, rates, sets and sketches between 200,000 and 1,000,000 active contexts. - Requires: `filter_cached`, and recycled `EventsBuffer` allocations. - Required by: none. - Release note: `releasenotes/notes/dogstatsd-transform-bypass-c08f2acf90bd5709.yaml` - Context & Tag Density: pack contexts into one allocation and drop unused cache overhead. - Dense Aggregation: replace 177 B buckets with per-kind typed pages. - Resumable Flush: shrink metric buffers and interleave bounded flush chunks. - **Idle Pipeline Bypass:** skip inactive transforms and borrow client telemetry. - PR TBD: skip context clones when `tag_filterlist` rules miss - **Current:** bypass idle transforms, cache timestamps and borrow client telemetry - `300m` CPU: cut encoder, codec and worker-pool hot-path cost. - Memory Admission: enforce opt-in configured memory limits with idle reclaim and counted drops.
…ed metrics_inputs
There was a problem hiding this comment.
More details
The completed static review produced no reportable finding. One unavailable base-version blob limits comparison coverage, and tests were not executed.
🤖 Bits Code Review · Commit 2cdbc0d
Summary
Every DogStatsD batch at base passes through the mapping and filtering transforms even when they have no active rules. Each stage receives, scans, and caches per metric without changing the batch. Routing also scans every event to check for timestamps, and standalone topologies still route metrics through
metrics_enricheven though standalone pipelines do not add Agent host tags andhost_enrichmentonly touchesEventDandServiceCheck. After aggregation, client telemetry clones each batch to extract the rate metrics it reports.This change:
dsd_mapper,dsd_prefix_filter,dsd_tag_filterlist) per buffer when they have no active rules, and omitsmetrics_enrichfrom standalone metric topologies.EventsBuffercarries a timestamp (has_timestamped_metrics()), soDogStatsDNoAggSplitskips the per-event scan on the common non-timestamped path.dsd_post_agg_filteron a dedicatedclient_telemetryoutput so client telemetry borrows only eligible rate metrics instead of cloning the whole batch.Stripped
optimized-releaseTier 1 runs show peak memory falling by 22.4 MiB on 1M RUM and 15.0 MiB on mixed churn. Cgroup CPU falls 2.62% on 1M RUM and 5.42% on mixed churn.Change Type
How did you test this PR?
cargo check --locked --workspace --testscargo test --locked -p agent-data-plane --bin agent-data-plane timestamp_fast_path_preserves_default_events_and_detects_mutated_pointscargo test --locked -p agent-data-plane --bin agent-data-plane cli::run::testsoptimized-releasebuilds against base18f587f5f6in cgroup v2, in default unbounded mode.References
blt/1m-11-borrowed-tag-filterlist)filter_cached, and recycledEventsBufferallocations.releasenotes/notes/dogstatsd-transform-bypass-c08f2acf90bd5709.yamlSeries overview
metrics_enrich, and borrow client telemetry.300mCPU (enhancement(metrics-v3): reuse arena dictionaries and frame payloads in one pass #3502–enhancement(core): size the dedicated topology worker pool to available CPUs #3507): cut encoder, codec and worker-pool hot-path cost.