Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ECS Fargate processes not being associated with containers #24186

Merged
merged 5 commits into from Mar 28, 2024

Conversation

sblumenthal
Copy link
Contributor

What does this PR do?

Fixes a bug where sometimes the process data generated for an ECS Fargate container is missing the container tags

Motivation

https://datadoghq.atlassian.net/browse/CONS-6242

Additional Notes

It appears that the problem was due to regex parsing, while debugging I found instances where the fargate container ID was {32}-{9}, but we were explicitly only looking at {32}-{10}. I cannot find any information on the definition of the fargate container ID format, so while this addresses the situation we came across in the support ticket, I do not know if there are other cases we have not run into yet.

Possible Drawbacks / Trade-offs

Describe how to test/QA your changes

I was able to reliably replicate this issue using the python container using the following task container definition:

        {
            "name": "api",
            "image": "public.ecr.aws/docker/library/python",
            "essential": false,
            "command": [
                "python",
                "-m",
                "http.server",
                "8080"
            ]
        }

Add this container definition as another container here, after the redis container definition, and deploy to an ECS fargate cluster

Verify that the container shows up on the live containers page, and that the process data shows up attached to this container, like so:
image

Also, to make sure the original bug that we ran into was being hit, log into the AWS console and navigate to the tasks page for you cluster, find the task that contains the python container, and validate that the container runtime ID matches the format that caused the issue in the first place:
image

The above container reliably triggered the issue, across multiple clusters. However, if it does not result in a container ID that is one character short, then it is worth noting that the QA for this has already been done in a cluster where we were able to reproduce the issue, and has been validated

@agent-platform-auto-pr
Copy link
Contributor

agent-platform-auto-pr bot commented Mar 28, 2024

[Fast Unit Tests Report]

On pipeline 31024874 (CI Visibility). The following jobs did not run any unit tests:

Jobs:
  • tests_windows-x64

If you modified Go files and expected unit tests to run in these jobs, please double check the job logs. If you think tests should have been executed reach out to #agent-developer-experience

@@ -216,6 +228,11 @@ func TestIdentiferFromCgroupReferences(t *testing.T) {
fileContent: ecsFargateCgroup,
expectedID: "8474ac4cec7a4f488834b00591271ec3-3054012820",
},
{
name: "ecs fargate shorter",
fileContent: ecsFargateCgroup,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fileContent: ecsFargateCgroup,
fileContent: ecsFargateCgroupShort,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, just noticed failing jobs, my bad

@sblumenthal sblumenthal modified the milestones: 7.54.0, 7.53.0 Mar 28, 2024
Copy link
Contributor

@rtrieu rtrieu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@sblumenthal
Copy link
Contributor Author

/merge

@dd-devflow
Copy link

dd-devflow bot commented Mar 28, 2024

🚂 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!

@pr-commenter
Copy link

pr-commenter bot commented Mar 28, 2024

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

@dd-devflow
Copy link

dd-devflow bot commented Mar 28, 2024

🚂 MergeQueue

Added to the queue.

This build is next! (estimated merge in less than 28m)

Use /merge -c to cancel this operation!

@pr-commenter
Copy link

pr-commenter bot commented Mar 28, 2024

Regression Detector

Regression Detector Results

Run ID: 33621e2d-713c-433c-b195-a22da630ebbb
Baseline: b238404
Comparison: a6a7dec

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 +3.12 [-3.23, +9.47]

Fine details of change detection per experiment

perf experiment goal Δ mean % Δ mean % CI
file_to_blackhole % cpu utilization +3.12 [-3.23, +9.47]
pycheck_1000_100byte_tags % cpu utilization +2.09 [-2.84, +7.01]
tcp_syslog_to_blackhole ingress throughput +2.07 [+1.98, +2.16]
uds_dogstatsd_to_api_cpu % cpu utilization +1.82 [-1.06, +4.70]
basic_py_check % cpu utilization +0.65 [-1.78, +3.08]
process_agent_real_time_mode memory utilization +0.51 [+0.47, +0.55]
idle memory utilization +0.42 [+0.38, +0.45]
process_agent_standard_check_with_stats memory utilization +0.25 [+0.21, +0.29]
otel_to_otel_logs ingress throughput +0.04 [-0.38, +0.45]
trace_agent_json ingress throughput +0.02 [-0.02, +0.05]
uds_dogstatsd_to_api ingress throughput +0.00 [-0.20, +0.20]
trace_agent_msgpack ingress throughput -0.00 [-0.02, +0.02]
tcp_dd_logs_filter_exclude ingress throughput -0.01 [-0.05, +0.03]
process_agent_standard_check memory utilization -0.13 [-0.18, -0.09]
file_tree memory utilization -0.16 [-0.25, -0.08]

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".

@dd-mergequeue dd-mergequeue bot merged commit ee95e2f into main Mar 28, 2024
189 of 191 checks passed
@dd-mergequeue dd-mergequeue bot deleted the sblumenthal/CONS-6242-fix-ecs-pid-parsing branch March 28, 2024 16:50
chouetz pushed a commit that referenced this pull request Mar 29, 2024
* Fix PID parsing in ECS Fargate

* Add changelog

* Fix broken unit test

* Update ECS CID regex to be less restrictive
chouetz pushed a commit that referenced this pull request Mar 29, 2024
* Fix PID parsing in ECS Fargate

* Add changelog

* Fix broken unit test

* Update ECS CID regex to be less restrictive
misteriaud pushed a commit that referenced this pull request Apr 2, 2024
* Fix PID parsing in ECS Fargate

* Add changelog

* Fix broken unit test

* Update ECS CID regex to be less restrictive
alexgallotta pushed a commit that referenced this pull request May 9, 2024
* Fix PID parsing in ECS Fargate

* Add changelog

* Fix broken unit test

* Update ECS CID regex to be less restrictive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants