Update Workloadmeta ECS collector to use metadata v4 endpoint#21836
Update Workloadmeta ECS collector to use metadata v4 endpoint#21836dd-mergequeue[bot] merged 5 commits intomainfrom
Conversation
Bloop Bleep... Dogbot HereRegression Detector ResultsRun ID: f3698333-5b33-4754-bdac-88bce0a5e340 Performance changes are noted in the perf column of each table:
No significant changes in experiment optimization goalsConfidence level: 90.00% There were no significant changes in experiment optimization goals at this confidence level and effect size tolerance.
|
| 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:
-
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".
|
@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 |
|
Can you update QA information? |
|
LGTM |
| // IsTaskCollectionEnabled returns true if the task metadata collection is enabled for core agent | ||
| // If agent launch type is EC2, collector will query the latest ECS metadata endpoint for each task returned by v1/tasks | ||
| // If agent launch type is Fargate, collector will query the latest ECS metadata endpoint | ||
| func IsTaskCollectionEnabled() bool { |
There was a problem hiding this comment.
Following the other comment regarding using the config component I would suggest passing the config component to this function. That way we do not use pkg/config here either 😄
| } | ||
|
|
||
| // ParseV4Task parses a metadata v4 task into a workloadmeta.ECSTask | ||
| func ParseV4Task(task v3or4.Task, seen map[workloadmeta.EntityID]struct{}) []workloadmeta.CollectorEvent { |
There was a problem hiding this comment.
Why are these functions (ParseV4Task, and ParseV4TaskContainers) extracted from the comp/core/workloadmeta/collectors/internal/ecs/v4parser.go package? The util package usually is dedicated for functions that are shared by multiple packages? These functions are only used in comp/core/workloadmeta/collectors/internal/ecs/v4parser.go. I would suggest moving them to that package
|
|
||
| //go:build docker | ||
|
|
||
| package util |
There was a problem hiding this comment.
base on this PR I'm not sure we need an util package. Both TaskParser and IsTaskCollectionEnabled is only used on comp/core/workloadmeta/collectors/internal/ecs/ecs.go.
Base on that and the comments below we can probably add the function we have here to the packages they are using it
There was a problem hiding this comment.
Actually I have another PR to update ECS fargate collector, both collectors use TaskParser and IsTaskCollectionEnabled, so I created ecs_util.go
https://github.com/DataDog/datadog-agent/pull/23253/files#diff-b755149238dd28f3c616d3974000977c004ebfb915be4340ce601f868a43420bR37
GustavoCaso
left a comment
There was a problem hiding this comment.
Thank you so much for addressing all the feedback 🎉
|
/merge |
|
🚂 MergeQueue Pull request added to the queue. There are 4 builds ahead! (estimated merge in less than 2h) Use |
* update ECS collector to use v4 endpoint * address feedback * address feedback
Motivation
A new core check has been introduced to collect ECS tasks by using Workloadmeta. Now Workloadmeta only relies on the v1/tasks endpoint, which offers limited information compared to the more recent v4 endpoint. But the v4 endpoint lacks support for retrieving a list of tasks. This PR enhances Workloadmeta by using the v4 endpoint, iterating through the responses from the v1/tasks endpoint.
What does this PR do?
This PR is based on
Related PR
This PR is used by
ECS Collector
If
ecs_task_collection_enabledis set to true, the ECS agent V4 metadata endpoint gets queried for each task returned by v1/tasks endpoint.The file structure has been slightly reorganised by adding v1/v4 parser files. This PR also enables the detection of endpoint versions and the use of a corresponding parser based on the version detected.
Given the ECS agent metadata endpoint's default rate limit of 40 requests per minute (source), a rate limiter within the worker has been implemented to prevent throttling.
datadog-agent/comp/core/workloadmeta/collectors/internal/ecs/worker.go
Lines 23 to 28 in 66b205d
datadog-agent/comp/core/workloadmeta/collectors/internal/ecs/v4parser.go
Lines 32 to 33 in 66b205d
Additional Notes
Possible Drawbacks / Trade-offs
Describe how to test/QA your changes
Add FF
DD_ECS_TASK_COLLECTION_ENABLED=trueand verify we don't have any big impact on agent performance.This FF allows Workloadmeta to query an additional endpoint to get more data and the data will be used by ECS check
Reviewer's Checklist
Triagemilestone is set.major_changelabel 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.changelog/no-changeloglabel has been applied.qa/skip-qalabel, with required eitherqa/doneorqa/no-code-changelabels, are applied.team/..label has been applied, indicating the team(s) that should QA this change.need-change/operatorandneed-change/helmlabels have been applied.k8s/<min-version>label, indicating the lowest Kubernetes version compatible with this feature.