datadog-agent
datadog-agent copied to clipboard
Update ExternalMetrics provider to return error if datadogmetric is stale
What does this PR do?
This PR will cause the external metrics server to return an error if a DatadogMetric object is valid but has not been updated within MaxAge.
Motivation
See investigation here
Additional Notes
Possible Drawbacks / Trade-offs
While this fixes the issue of the WPA scaling based off of metrics that have not been updated recently and have become stale, it does not actually mark the DatadogMetric CR object as invalid, so some confusion could present itself while looking at the cluster.
It also doesn't fix the underlying problem with the current implementation, where slow responses from the API lead to batch failures and batches are broken up and queries are evaluated sequentially, essentially halting all metric evaluation until the API recovers.
Describe how to test/QA your changes
QA has already been done on my end via a minikube cluster where I spun up ~30 nginx deployments, each one configured to use a WPA for scaling. I modified the DCA using this change to simulate slow responses and timeouts, and recorded the results of the scaling behavior before and after the change in this notebook
Test changes on VM
Use this command from test-infra-definitions to manually test this PR changes on a VM:
inv create-vm --pipeline-id=38455818 --os-family=ubuntu
Note: This applies to commit 1adf9416
Regression Detector
Regression Detector Results
Run ID: ecf14964-a81c-40b4-80a1-97720428632a Metrics dashboard Target profiles
Baseline: 42b58b8fde5f38a7836c9e3b318c84f50e99561f Comparison: 1adf9416650c2060ee51a000ea67295f21e4efa1
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
No significant changes in experiment optimization goals
Confidence level: 90.00% Effect size tolerance: |Δ mean %| ≥ 5.00%
There were no significant changes in experiment optimization goals at this confidence level and effect size tolerance.
Fine details of change detection per experiment
| perf | experiment | goal | Δ mean % | Δ mean % CI | links |
|---|---|---|---|---|---|
| ➖ | tcp_syslog_to_blackhole | ingress throughput | +7.66 | [-5.80, +21.13] | Logs |
| ➖ | pycheck_1000_100byte_tags | % cpu utilization | +1.03 | [-3.73, +5.79] | Logs |
| ➖ | file_tree | memory utilization | +0.16 | [+0.10, +0.21] | Logs |
| ➖ | uds_dogstatsd_to_api | ingress throughput | -0.00 | [-0.00, +0.00] | Logs |
| ➖ | tcp_dd_logs_filter_exclude | ingress throughput | -0.00 | [-0.01, +0.01] | Logs |
| ➖ | otel_to_otel_logs | ingress throughput | -0.06 | [-0.87, +0.75] | Logs |
| ➖ | basic_py_check | % cpu utilization | -0.23 | [-2.82, +2.36] | Logs |
| ➖ | idle | memory utilization | -0.64 | [-0.67, -0.61] | Logs |
| ➖ | uds_dogstatsd_to_api_cpu | % cpu utilization | -1.34 | [-2.21, -0.47] | Logs |
Explanation
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".
We should perhaps increase the default maxAge as we add the time from Controller (HPA,WPA) to ExternalMetrics, which can take several seconds. Moving to 150s instead of 120s for instance.
Synced about this offline, the reasoning behind this makes sense to me, so I updated the default value and added a comment about this change to the changelog
/merge
:steam_locomotive: MergeQueue: waiting for PR to be ready
This merge request is not mergeable yet, because of pending checks/missing approvals. It will be added to the queue as soon as checks pass and/or get approvals.
Note: if you pushed new commits since the last approval, you may need additional approval.
You can remove it from the waiting list with /remove command.
Use /merge -c to cancel this operation!
:steam_locomotive: MergeQueue: pull request added to the queue
The median merge time in main is 24m.
Use /merge -c to cancel this operation!
:rotating_light: MergeQueue: This merge request is in error
Gitlab pipeline didn't start on its own and we were unable to create it... Please retry.
If you need support, contact us on Slack #devflow with those details!
/merge
:steam_locomotive: MergeQueue: pull request added to the queue
The median merge time in main is 25m.
Use /merge -c to cancel this operation!
:x: MergeQueue
PR already in the queue with status in_progress
If you need support, contact us on Slack #devflow with those details!
:rotating_light: MergeQueue: This merge request is in error
Gitlab pipeline didn't start on its own and we were unable to create it... Please retry.
If you need support, contact us on Slack #devflow with those details!
/merge
/merge
:steam_locomotive: MergeQueue: pull request added to the queue
The median merge time in main is 25m.
Use /merge -c to cancel this operation!