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

[PROCS-3838] Add handling for ECS Fargate misconfiguration during chunking #25100

Merged
merged 5 commits into from
Apr 26, 2024

Conversation

daniel-taf
Copy link
Contributor

@daniel-taf daniel-taf commented Apr 24, 2024

What does this PR do?

This PR handles the issue described in #22940. Previously, when on ECS Fargate with a misconfigured pidMode setting, the process agent can fails to maintain the relationship between chunks and props in the ChunkAllocator when calling appendContainerWithoutProcesses causing a panic when props is accessed during ChunkAllocator.Accept. Now, ChunkAllocator.Accept is used directly in the function to that props and chunks remain equal in length.

Motivation

PROCS-3838

Additional Notes

The added unit test confirmed the behavior as it results in a panic on main but passes with this PR's changes.

Possible Drawbacks / Trade-offs

Describe how to test/QA your changes

Run the agent as a sidecar container with container on ECS Fargate without pidMode set. Verify the panic no longer occurs and the log warning appears. Also check that process/container data is available on Datadog.

Sample task definition to create service from:

{
    "containerDefinitions": [
            {
                "name": "redis",
                "image": "redis:latest",
                "cpu": 0,
                "portMappings": [],
                "essential": true,
                "environment": [],
                "mountPoints": [],
                "volumesFrom": [],
                "dockerLabels": {
                    "com.datadoghq.ad.check_names": "[\"redisdb\"]",
                    "com.datadoghq.ad.init_configs": "[{}]",
                    "com.datadoghq.ad.instances": "[{\"host\": \"%%host%%\", \"port\": 6379}]"
                },
                "systemControls": []
            },
            {
                "name": "datadog-agent",
                "image": "public.ecr.aws/datadog/agent:latest",
                "cpu": 0,
                "portMappings": [],
                "essential": true,
                "environment": [
                    {
                        "name": "ECS_FARGATE",
                        "value": "true"
                    },
                    {
                        "name": "DD_PROCESS_AGENT_PROCESS_COLLECTION_ENABLED",
                        "value": "true"
                    }
                ],
                "mountPoints": [],
                "volumesFrom": [],
                "secrets": [
                    {
                        "name": "DD_API_KEY",
                        "valueFrom": "<secret>"
                    }
                ],
               ...
            }
        ],
}

Log:

2024-04-25 20:06:47 UTC | PROCESS | WARN | (pkg/process/checks/chunking.go:25 in chunkProcessesBySizeAndWeight) | No processes found for container , pidMode may not be configured correctly (set to task)	

@pr-commenter
Copy link

pr-commenter bot commented Apr 24, 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=32974728 --os-family=ubuntu

@pr-commenter
Copy link

pr-commenter bot commented Apr 24, 2024

Regression Detector

Regression Detector Results

Run ID: 30e15658-bf7d-4390-beda-f5d09e92e43d
Baseline: b1ac697
Comparison: 192ac7e

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 -14.31 [-18.59, -10.03]

Fine details of change detection per experiment

perf experiment goal Δ mean % Δ mean % CI
basic_py_check % cpu utilization +1.71 [-0.82, +4.23]
pycheck_1000_100byte_tags % cpu utilization +0.90 [-3.91, +5.72]
idle memory utilization +0.53 [+0.49, +0.57]
process_agent_standard_check memory utilization +0.36 [+0.30, +0.41]
uds_dogstatsd_to_api_cpu % cpu utilization +0.32 [-2.54, +3.18]
process_agent_standard_check_with_stats memory utilization +0.28 [+0.22, +0.34]
tcp_dd_logs_filter_exclude ingress throughput +0.02 [-0.03, +0.07]
trace_agent_json ingress throughput +0.00 [-0.01, +0.01]
trace_agent_msgpack ingress throughput -0.00 [-0.01, +0.00]
uds_dogstatsd_to_api ingress throughput -0.01 [-0.21, +0.20]
otel_to_otel_logs ingress throughput -0.06 [-0.42, +0.30]
process_agent_real_time_mode memory utilization -0.30 [-0.35, -0.25]
tcp_syslog_to_blackhole ingress throughput -6.39 [-27.21, +14.42]
file_to_blackhole % cpu utilization -14.31 [-18.59, -10.03]

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

@daniel-taf daniel-taf changed the title Add handling for ECS fargate misconfiguration when chunking Add handling for ECS fargate misconfiguration during chunking Apr 25, 2024
@daniel-taf daniel-taf changed the title Add handling for ECS fargate misconfiguration during chunking [PROCS-3838] Add handling for ECS fargate misconfiguration during chunking Apr 25, 2024
@daniel-taf daniel-taf marked this pull request as ready for review April 25, 2024 18:14
@daniel-taf daniel-taf requested a review from a team as a code owner April 25, 2024 18:14
@daniel-taf daniel-taf changed the title [PROCS-3838] Add handling for ECS fargate misconfiguration during chunking [PROCS-3838] Add handling for ECS Fargate misconfiguration during chunking Apr 25, 2024
@daniel-taf daniel-taf added this to the 7.54.0 milestone Apr 25, 2024
pkg/process/checks/chunking.go Outdated Show resolved Hide resolved
@daniel-taf daniel-taf requested a review from a team as a code owner April 25, 2024 20:21
Copy link
Contributor

@cswatt cswatt left a comment

Choose a reason for hiding this comment

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

just a grammar suggestion on the changelog

approving so I don't block merge

@daniel-taf
Copy link
Contributor Author

/merge

@dd-devflow
Copy link

dd-devflow bot commented Apr 26, 2024

🚂 MergeQueue

Pull request added to the queue.

This build is going to start soon! (estimated merge in less than 23m)

Use /merge -c to cancel this operation!

@daniel-taf
Copy link
Contributor Author

/merge --cancel

@dd-devflow
Copy link

dd-devflow bot commented Apr 26, 2024

⚠️ MergeQueue

This merge request build was cancelled

If you need support, contact us on Slack #devflow!

@daniel-taf
Copy link
Contributor Author

/merge

@dd-devflow
Copy link

dd-devflow bot commented Apr 26, 2024

🚂 MergeQueue

Pull request added to the queue.

This build is going to start soon! (estimated merge in less than 23m)

Use /merge -c to cancel this operation!

@dd-mergequeue dd-mergequeue bot merged commit fc2018e into main Apr 26, 2024
193 checks passed
@dd-mergequeue dd-mergequeue bot deleted the daniel.tafoya/fargate-chunking-panic branch April 26, 2024 04:02
alexgallotta pushed a commit that referenced this pull request May 9, 2024
…nking (#25100)

* Add handling for ECS fargate misconfiguration when chunking

* Add chunking unit test

* Add reno and update comment

* Update log

* Update releasenotes/notes/process-fargate-chunking-pidMode-0144d9e0833cb19b.yaml

Co-authored-by: cecilia saixue watt <[email protected]>

---------

Co-authored-by: cecilia saixue watt <[email protected]>
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

3 participants