[anomalydetection] Simplify reporters (5)#52493
[anomalydetection] Simplify reporters (5)#52493gh-worker-dd-mergequeue-cf854d[bot] merged 2 commits into
Conversation
|
🎯 Code Coverage (details) 🔗 Commit SHA: 6b83932 | Docs | Datadog PR Page | Give us feedback! |
Files inventory check summaryFile checks results against ancestor f91bb03e: Results for datadog-agent_7.82.0~devel.git.389.6b83932.pipeline.121254224-1_amd64.deb:No change detected |
Regression DetectorRegression Detector ResultsMetrics dashboard Baseline: eeaa480 Optimization Goals: ✅ No significant changes detected
|
| perf | experiment | goal | Δ mean % | Δ mean % CI | trials | links |
|---|---|---|---|---|---|---|
| ➖ | quality_gate_metrics_logs | memory utilization | +1.26 | [+1.00, +1.51] | 1 | Logs bounds checks dashboard |
| ➖ | quality_gate_idle_all_features | memory utilization | +0.55 | [+0.51, +0.59] | 1 | Logs bounds checks dashboard |
| ➖ | quality_gate_security_idle | memory utilization | +0.40 | [+0.34, +0.46] | 1 | Logs bounds checks dashboard |
| ➖ | quality_gate_idle | memory utilization | +0.26 | [+0.21, +0.32] | 1 | Logs bounds checks dashboard |
| ➖ | quality_gate_security_mean_fs_load | memory utilization | +0.09 | [+0.05, +0.13] | 1 | Logs bounds checks dashboard |
| ➖ | quality_gate_security_no_fs_load | memory utilization | -0.13 | [-0.22, -0.04] | 1 | Logs bounds checks dashboard |
| ➖ | quality_gate_logs | % cpu utilization | -0.42 | [-1.52, +0.67] | 1 | Logs bounds checks dashboard |
Bounds Checks: ✅ Passed
| perf | experiment | bounds_check_name | replicates_passed | observed_value | links |
|---|---|---|---|---|---|
| ✅ | quality_gate_idle | intake_connections | 10/10 | 3 ≤ 4 | bounds checks dashboard |
| ✅ | quality_gate_idle | memory_usage | 10/10 | 146.66MiB ≤ 154MiB | bounds checks dashboard |
| ✅ | quality_gate_idle | total_bytes_received | 10/10 | 577.05KiB ≤ 819.20KiB | bounds checks dashboard |
| ✅ | quality_gate_idle_all_features | intake_connections | 10/10 | 3 ≤ 4 | bounds checks dashboard |
| ✅ | quality_gate_idle_all_features | memory_usage | 10/10 | 488.28MiB ≤ 495MiB | bounds checks dashboard |
| ✅ | quality_gate_idle_all_features | total_bytes_received | 10/10 | 0.89MiB ≤ 1.25MiB | bounds checks dashboard |
| ✅ | quality_gate_logs | intake_connections | 10/10 | 3 ≤ 6 | bounds checks dashboard |
| ✅ | quality_gate_logs | memory_usage | 10/10 | 182.31MiB ≤ 195MiB | bounds checks dashboard |
| ✅ | quality_gate_logs | missed_bytes | 10/10 | 0B = 0B | bounds checks dashboard |
| ✅ | quality_gate_logs | total_bytes_received | 10/10 | 264.20MiB ≤ 292MiB | bounds checks dashboard |
| ✅ | quality_gate_metrics_logs | cpu_usage | 10/10 | 342.65 ≤ 2000 | bounds checks dashboard |
| ✅ | quality_gate_metrics_logs | intake_connections | 10/10 | 3 ≤ 6 | bounds checks dashboard |
| ✅ | quality_gate_metrics_logs | memory_usage | 10/10 | 390.59MiB ≤ 430MiB | bounds checks dashboard |
| ✅ | quality_gate_metrics_logs | missed_bytes | 10/10 | 0B = 0B | bounds checks dashboard |
| ✅ | quality_gate_metrics_logs | total_bytes_received | 10/10 | 0.86GiB ≤ 1.04GiB | bounds checks dashboard |
| ✅ | quality_gate_security_idle | cpu_usage | 10/10 | 28.57 ≤ 40 | bounds checks dashboard |
| ✅ | quality_gate_security_idle | memory_usage | 10/10 | 297.98MiB ≤ 330MiB | bounds checks dashboard |
| ✅ | quality_gate_security_mean_fs_load | cpu_usage | 10/10 | 61.04 ≤ 80 | bounds checks dashboard |
| ✅ | quality_gate_security_mean_fs_load | memory_usage | 10/10 | 276.29MiB ≤ 310MiB | bounds checks dashboard |
| ✅ | quality_gate_security_no_fs_load | cpu_usage | 10/10 | 22.18 ≤ 40 | bounds checks dashboard |
| ✅ | quality_gate_security_no_fs_load | memory_usage | 10/10 | 285.74MiB ≤ 320MiB | bounds checks dashboard |
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".
Replicate Execution Details
We run multiple replicates for each experiment/variant. However, we allow replicates to be automatically retried if there are any failures, up to 8 times, at which point the replicate is marked dead and we are unable to run analysis for the entire experiment. We call each of these attempts at running replicates a replicate execution. This section lists all replicate executions that failed due to the target crashing or being oom killed.
Note: In the below tables we bucket failures by experiment, variant, and failure type. For each of these buckets we list out the replicate indexes that failed with an annotation signifying how many times said replicate failed with the given failure mode. In the below example the baseline variant of the experiment named experiment_with_failures had two replicates that failed by oom kills. Replicate 0, which failed 8 executions, and replicate 1 which failed 6 executions, all with the same failure mode.
| Experiment | Variant | Replicates | Failure | Logs | Debug Dashboard |
|---|---|---|---|---|---|
| experiment_with_failures | baseline | 0 (x8) 1 (x6) | Oom killed | Debug Dashboard |
The debug dashboard links will take you to a debugging dashboard specifically designed to investigate replicate execution failures.
❌ Retried Profiling Replicate Execution Failures (ddprof)
Note: Profiling replicas may still be executing. See the debug dashboard for up to date status.
| Experiment | Variant | Replicates | Failure | Debug Dashboard |
|---|---|---|---|---|
| quality_gate_idle_all_features | baseline | 10 | Oom killed | Debug Dashboard |
| quality_gate_idle_all_features | comparison | 10 | Oom killed | Debug Dashboard |
| quality_gate_logs | comparison | 10 | Oom killed | Debug Dashboard |
| quality_gate_metrics_logs | baseline | 10 | Oom killed | Debug Dashboard |
| quality_gate_metrics_logs | comparison | 10 | Oom killed | Debug Dashboard |
| quality_gate_security_no_fs_load | baseline | 10 | Oom killed | Debug Dashboard |
| quality_gate_security_no_fs_load | comparison | 10 | Oom killed | Debug Dashboard |
CI Pass/Fail Decision
✅ Passed. All Quality Gates passed.
- quality_gate_logs, bounds check missed_bytes: 10/10 replicas passed. Gate passed.
- quality_gate_logs, bounds check intake_connections: 10/10 replicas passed. Gate passed.
- quality_gate_logs, bounds check memory_usage: 10/10 replicas passed. Gate passed.
- quality_gate_logs, bounds check total_bytes_received: 10/10 replicas passed. Gate passed.
- quality_gate_metrics_logs, bounds check memory_usage: 10/10 replicas passed. Gate passed.
- quality_gate_metrics_logs, bounds check missed_bytes: 10/10 replicas passed. Gate passed.
- quality_gate_metrics_logs, bounds check total_bytes_received: 10/10 replicas passed. Gate passed.
- quality_gate_metrics_logs, bounds check intake_connections: 10/10 replicas passed. Gate passed.
- quality_gate_metrics_logs, bounds check cpu_usage: 10/10 replicas passed. Gate passed.
- quality_gate_security_no_fs_load, bounds check memory_usage: 10/10 replicas passed. Gate passed.
- quality_gate_security_no_fs_load, bounds check cpu_usage: 10/10 replicas passed. Gate passed.
- quality_gate_idle_all_features, bounds check intake_connections: 10/10 replicas passed. Gate passed.
- quality_gate_idle_all_features, bounds check total_bytes_received: 10/10 replicas passed. Gate passed.
- quality_gate_idle_all_features, bounds check memory_usage: 10/10 replicas passed. Gate passed.
- quality_gate_idle, bounds check total_bytes_received: 10/10 replicas passed. Gate passed.
- quality_gate_idle, bounds check memory_usage: 10/10 replicas passed. Gate passed.
- quality_gate_idle, bounds check intake_connections: 10/10 replicas passed. Gate passed.
- quality_gate_security_mean_fs_load, bounds check cpu_usage: 10/10 replicas passed. Gate passed.
- quality_gate_security_mean_fs_load, bounds check memory_usage: 10/10 replicas passed. Gate passed.
- quality_gate_security_idle, bounds check memory_usage: 10/10 replicas passed. Gate passed.
- quality_gate_security_idle, bounds check cpu_usage: 10/10 replicas passed. Gate passed.
Static quality checks✅ Please find below the results from static quality gates Successful checksInfo
16 successful checks with minimal change (< 2 KiB)
|
583c73d to
a483af0
Compare
df92d4b to
1213d9c
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1213d9cce0
ℹ️ 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".
Eokye
left a comment
There was a problem hiding this comment.
looks good! some comments probably have to be updated along with the one i pointed out. i like the new dedup logic! it avoids needing a TTL and other complexities
ccff034 to
05960f3
Compare
05960f3 to
448d6d3
Compare
a6b3350 to
8fe503f
Compare
### What does this PR do? Unifies the anomaly scorer into a single `anomalyScorer` struct implementing the `Correlator` interface in a single file. We can now benchmark the scorer. This removes the helper reporting logs, it's merged into this struct. This contains the main score logic and also the subscribe logic which is used to create events (high severity = event). > [!NOTE] > We use "the severity becomes high" and "the severity isn't high anymore" as start / end of correlation. This will be reworked in #52493 to directly emit event at the start. The config can now enable/disable logs and reporter events (telemetry always enabled if component enabled). New config keys for output: ```yaml anomaly_detection: anomaly_scorer: enabled: true output: logs: true correlation_events: false ``` #### Diagram ```mermaid flowchart LR IN["ProcessAnomaly(a)"] --> PEND["pending map"] PEND --> ADV subgraph ADV["Advance(t) — mu held"] EWMA["merge → evict → bucket → EWMA"] end ADV -->|"[]secEWMA\nmu released"| SUBS subgraph SUBS["Per-subscription state machines — subsMu"] FSM["Low / Medium / High FSM\n+ cooldown per sub"] FSM -->|"transition"| CB["Listener.OnSeverityTransition(evt)"] end CB -->|"self-sub\n(internal watcher)"| IW["gauges · logs · episode tracking"] IW --> AC["ActiveCorrelations()"] ADV --> SC["ScoreState() / LastScore()"] SUBS --> SB["Subscribe(cfg) → func()\nexposes via SubscribeScorer on Component"] ``` ### Motivation Nice score for kafka scenario, no false positives (using bocpd+tukey_biweight+holt_residual): <img width="531" height="304" alt="Screenshot 2026-06-19 at 11 20 44" src="https://github.com/user-attachments/assets/ace05855-359a-4064-b42c-994b6baf5a1e" /> ### Describe how you validated your changes ### Additional Notes Co-authored-by: celian.raimbault <celian.raimbault@datadoghq.com>
…rs, clean up reporters Move per-pattern deduplication and CorrelationDetected emission out of the reporter layer and into a per-correlator correlationEmitter helper. Reporters become stateless forwarders of typed CorrelatorEvents. Key changes: - Add correlationEmitter helper (Observe/Drain/Reset) tracking first-seen and recurrence per pattern; embed in TimeClusterCorrelator and CrossSignalCorrelator - Add CorrelatorEvent / CorrelatorEventKind to observer/def types: CorrelationDetected, EpisodeStarted, EpisodeEnded - anomalyScorer: remove closedEpisodes buffer; accumulate episode lifecycle events via PendingEvents() drained each engine advance cycle - engine: drain PendingEvents() from all correlators and include in ReportOutput as CorrelatorEvents; guard accumulation behind TrackCorrelationHistory flag - reporter/def: ReportOutput.CorrelatorEvents replaces CorrelationHistory - EventReporter: stateless forwarder; CorrelationDetected send failures buffered in retryPending (max 5 attempts) for next-cycle retry; episode events at-most-once - stdoutReporter: emittedCounter counts only CorrelationDetected events; ongoingCounter fires only for active patterns not newly detected this cycle - observer/impl/BUILD.bazel: add correlation_emitter.go and _test.go - AGENTS.md files and reporter.allium spec updated to reflect new model Co-authored-by: Cursor <cursoragent@cursor.com>
…AGENTS.md Co-authored-by: Cursor <cursoragent@cursor.com>
b23788e to
6b83932
Compare
d5827b8
into
main
What does this PR do?
This moves deduplication and recurrence logic out of reporters into correlators.
Correlators now directly output events to send which is more convenient for the scorer (events like "high severity", "no more high severity")
We now have 3 types of alerts: entering high severity, leaving high severity and correlation events (new correlation / reoccurrence which is the previous type).
It basically adds a PendingEvents function to correlator to replace ActiveCorrelations (these are processed by the emitter new component).
Motivation
Describe how you validated your changes
Additional Notes