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

Update Workloadmeta ECS collector to use metadata v4 endpoint

Open kangyili opened this issue 1 year ago • 3 comments

What does this PR do?

This PR is based on

  • https://github.com/DataDog/datadog-agent/pull/23248
  • https://github.com/DataDog/datadog-agent/pull/23250

Related PR

  • https://github.com/DataDog/datadog-agent/pull/23253

This PR is used by

  • https://github.com/DataDog/datadog-agent/pull/22060

ECS Collector

  • If ecs_metadata_use_v4 is true, the ECS agent V4 metadata endpoint will be queried for each task from the v1/tasks endpoint.
  • Due to the ECS agent metadata endpoint's default rate limit of 40,60 (source), a rate limiter is implemented to prevent throttling. https://github.com/DataDog/datadog-agent/blob/f67c3d667e00dcf6350a9d80a7075998e57ad9e3/comp/core/workloadmeta/collectors/internal/ecs/ecs.go#L86
  • A task queue is introduced to manage the volume per pull, with a default maximum of 1000 tasks for querying the V4 metadata endpoint.
  • Retry logic is in place for querying the V4 metadata endpoint, with three attempts and wait times of 250ms, 500ms, and 1000ms. https://github.com/DataDog/datadog-agent/blob/f67c3d667e00dcf6350a9d80a7075998e57ad9e3/comp/core/workloadmeta/collectors/internal/ecs/ecs.go#L330-L340

Motivation

Additional Notes

Possible Drawbacks / Trade-offs

Describe how to test/QA your changes

Reviewer's Checklist

  • [x] If known, an appropriate milestone has been selected; otherwise the Triage milestone is set.
  • [ ] Use the major_change label if your change either has a major impact on the code base, is impacting multiple teams or is changing important well-established internals of the Agent. This label will be use during QA to make sure each team pay extra attention to the changed behavior. For any customer facing change use a releasenote.
  • [x] A release note has been added or the changelog/no-changelog label has been applied.
  • [x] Changed code has automated tests for its functionality.
  • [ ] Adequate QA/testing plan information is provided. Except if the qa/skip-qa label, with required either qa/done or qa/no-code-change labels, are applied.
  • [x] At least one team/.. label has been applied, indicating the team(s) that should QA this change.
  • [ ] If applicable, docs team has been notified or an issue has been opened on the documentation repo.
  • [ ] If applicable, the need-change/operator and need-change/helm labels have been applied.
  • [ ] If applicable, the k8s/<min-version> label, indicating the lowest Kubernetes version compatible with this feature.
  • [ ] If applicable, the config template has been updated.

kangyili avatar Jan 03 '24 10:01 kangyili

Bloop Bleep... Dogbot Here

Regression Detector Results

Run ID: f3698333-5b33-4754-bdac-88bce0a5e340 Baseline: b4f0a172d309dc5b7689bc9674e0487e4fd0cf1b Comparison: 3caa3f280dab682ad77246406c45570e0e29284c

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 +4.01 [-2.51, +10.53]

Fine details of change detection per experiment

perf experiment goal Δ mean % Δ mean % CI
file_to_blackhole % cpu utilization +4.01 [-2.51, +10.53]
basic_py_check % cpu utilization +2.34 [-0.07, +4.74]
uds_dogstatsd_to_api ingress throughput +0.00 [-0.06, +0.06]
trace_agent_msgpack ingress throughput +0.00 [-0.00, +0.00]
trace_agent_json ingress throughput -0.00 [-0.01, +0.01]
tcp_dd_logs_filter_exclude ingress throughput -0.00 [-0.06, +0.06]
file_tree memory utilization -0.31 [-0.42, -0.21]
process_agent_standard_check_with_stats memory utilization -0.36 [-0.39, -0.33]
process_agent_standard_check memory utilization -0.62 [-0.66, -0.59]
process_agent_real_time_mode memory utilization -0.64 [-0.68, -0.61]
idle memory utilization -0.79 [-0.82, -0.76]
tcp_syslog_to_blackhole ingress throughput -1.27 [-1.35, -1.20]
pycheck_1000_100byte_tags % cpu utilization -1.30 [-6.20, +3.60]
otel_to_otel_logs ingress throughput -1.72 [-2.37, -1.08]
uds_dogstatsd_to_api_cpu % cpu utilization -2.24 [-4.95, +0.47]

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 Jan 03 '24 12:01 pr-commenter[bot]

@kangyili, fantastic work 🎉

One thing I found reviewing all of the changes is that is quite difficult to be able to hold all of the changes in my head during the review. Not saying you have to, but if possible splitting the work into smaller PRs to make the process of reviewing them easier would be fantastic

GustavoCaso avatar Jan 12 '24 11:01 GustavoCaso

@kangyili, fantastic work 🎉

One thing I found reviewing all of the changes is that is quite difficult to be able to hold all of the changes in my head during the review. Not saying you have to, but if possible splitting the work into smaller PRs to make the process of reviewing them easier would be fantastic

@GustavoCaso Thanks for the review! I've split this PR into two parts now. This current one includes only the changes made in Workloadmeta. The other PR is on the new check https://github.com/DataDog/datadog-agent/pull/22060

kangyili avatar Jan 15 '24 15:01 kangyili

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=32185219 --os-family=ubuntu

pr-commenter[bot] avatar Mar 19 '24 15:03 pr-commenter[bot]

Regression Detector

Regression Detector Results

Run ID: 172bb7cd-7395-4543-b28b-93b8f362f53e Baseline: 98de5502bfd1ba107861f3f3b46d858498561ece Comparison: 1421173b92cb1792dbe9b2bbee52317ee36fba19

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 -2.02 [-7.42, +3.37]

Fine details of change detection per experiment

perf experiment goal Δ mean % Δ mean % CI
basic_py_check % cpu utilization +3.61 [+0.97, +6.25]
file_tree memory utilization +1.61 [+1.49, +1.72]
uds_dogstatsd_to_api_cpu % cpu utilization +0.76 [-2.23, +3.74]
process_agent_standard_check_with_stats memory utilization +0.09 [+0.04, +0.14]
idle memory utilization +0.03 [-0.01, +0.08]
uds_dogstatsd_to_api ingress throughput +0.02 [-0.18, +0.22]
trace_agent_msgpack ingress throughput -0.00 [-0.00, +0.00]
tcp_dd_logs_filter_exclude ingress throughput -0.01 [-0.05, +0.04]
process_agent_standard_check memory utilization -0.01 [-0.06, +0.05]
otel_to_otel_logs ingress throughput -0.02 [-0.43, +0.39]
trace_agent_json ingress throughput -0.03 [-0.05, -0.01]
pycheck_1000_100byte_tags % cpu utilization -0.37 [-5.28, +4.53]
tcp_syslog_to_blackhole ingress throughput -0.48 [-0.56, -0.40]
process_agent_real_time_mode memory utilization -0.73 [-0.78, -0.68]
file_to_blackhole % cpu utilization -2.02 [-7.42, +3.37]

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 Mar 19 '24 16:03 pr-commenter[bot]

Can you update QA information?

zhuminyi avatar Apr 08 '24 12:04 zhuminyi

LGTM

zhuminyi avatar Apr 08 '24 14:04 zhuminyi

/merge

kangyili avatar Apr 16 '24 13:04 kangyili

:steam_locomotive: MergeQueue

Pull request added to the queue.

There are 4 builds ahead! (estimated merge in less than 2h)

Use /merge -c to cancel this operation!

dd-devflow[bot] avatar Apr 16 '24 13:04 dd-devflow[bot]