datadog-agent icon indicating copy to clipboard operation
datadog-agent copied to clipboard

[corechecks/kubelet] Filter kubelet metrics with no kubernetes tags

Open jennchenn opened this issue 1 year ago • 1 comments

What does this PR do?

This PR adds logic to filter out metrics with no kubernetes tags.

Motivation

Previously, the count of metrics was getting inflated due to metrics being reported with kube_namespace:N/A on restarts. This change ensures that only metrics with the appropriate kubernetes tags are sent. previously: image

now: image

Additional Notes

Possible Drawbacks / Trade-offs

By filtering out these metrics, there is a slight gap in data, whereas before, the metric would still be reported but without all the tags.

Describe how to test/QA your changes

  1. Deploy the kubelet core check by using something like:
  2. Deploy the agent/cluster agent with a configuration like:
datadog:
  logLevel: DEBUG
  clusterName: jenn-kubelet-core-check
  apiKeyExistingSecret: datadog-secret
  appKeyExistingSecret: datadog-secret
  collectEvents: true
  logs:
    enabled: true
    containerCollectAll: true
    containerCollectUsingFiles: true
  kubelet:
    tlsVerify: false
  confd:
    kubelet_core.yaml: |
      init_config:
        loader: core
      instances:
        - min_collection_interval: 20
...
clusterAgent:
  enabled: true
clusterChecksRunner:
  enabled: true
  replicas: 5
  1. Restart the pods multiple times and verify that no metrics are tagged with kube_namespace:N/A

jennchenn avatar Feb 15 '24 21:02 jennchenn

Bloop Bleep... Dogbot Here

Regression Detector Results

Run ID: 094104dc-c439-4971-b190-1e220f8e6e72 Baseline: d3c07fce4a0dc7eea2a79b9dd168c73c718f4cba Comparison: 7b6b49da4c180e08967100da3707239da94bed88 Total CPUs: 7

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.

Experiments ignored for regressions

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

perf experiment goal Δ mean % Δ mean % CI
file_to_blackhole % cpu utilization -0.69 [-7.22, +5.84]

Fine details of change detection per experiment

perf experiment goal Δ mean % Δ mean % CI
process_agent_standard_check_with_stats memory utilization +0.69 [+0.64, +0.74]
process_agent_standard_check memory utilization +0.56 [+0.51, +0.62]
trace_agent_msgpack ingress throughput +0.03 [+0.02, +0.04]
process_agent_real_time_mode memory utilization +0.02 [-0.02, +0.07]
tcp_dd_logs_filter_exclude ingress throughput +0.00 [-0.00, +0.00]
uds_dogstatsd_to_api ingress throughput +0.00 [-0.00, +0.00]
trace_agent_json ingress throughput -0.02 [-0.06, +0.01]
idle memory utilization -0.18 [-0.21, -0.15]
file_tree memory utilization -0.19 [-0.31, -0.06]
uds_dogstatsd_to_api_cpu % cpu utilization -0.42 [-1.84, +1.00]
file_to_blackhole % cpu utilization -0.69 [-7.22, +5.84]
tcp_syslog_to_blackhole ingress throughput -0.74 [-0.81, -0.68]
otel_to_otel_logs ingress throughput -1.23 [-1.81, -0.66]

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:

  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[bot] avatar Feb 15 '24 23:02 pr-commenter[bot]

/merge

jennchenn avatar Feb 16 '24 15:02 jennchenn

:steam_locomotive: MergeQueue

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!

dd-devflow[bot] avatar Feb 16 '24 15:02 dd-devflow[bot]

:steam_locomotive: MergeQueue

Added to the queue.

There are 3 builds ahead of this PR! (estimated merge in less than 1h)

Use /merge -c to cancel this operation!

dd-devflow[bot] avatar Feb 16 '24 16:02 dd-devflow[bot]