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

[EVPProxy] Do not manually cancel the request context #30183

Merged
merged 3 commits into from
Oct 17, 2024

Conversation

albertvaka
Copy link
Contributor

@albertvaka albertvaka commented Oct 16, 2024

Context

In #26336 I added a timeout to the request context so that requests don't wait forever.

However, I also added a defer ctxCancel() call that manually cancelled the context at the end of the RoundTrip. This is not necessary because the parent context will already be cancelled when done, and furthermore it was causing problems with chunked (Transfer-Encoding: chunked) responses.

What does this PR do?

Do not cancel the context manually.

Describe how to test/QA your changes

There's a reproducer in this ticket: https://datadoghq.atlassian.net/browse/SDTEST-1010?focusedCommentId=1947043

@albertvaka albertvaka added this to the 7.60.0 milestone Oct 16, 2024
@albertvaka albertvaka requested a review from a team as a code owner October 16, 2024 14:34
@github-actions github-actions bot added the team/agent-apm trace-agent label Oct 16, 2024
Copy link

Regression Detector

Regression Detector Results

Run ID: 1aa29056-0368-4b9f-8dc3-931c3777faa2 Metrics dashboard Target profiles

Baseline: 5f96339
Comparison: b0b8522

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.

Fine details of change detection per experiment

perf experiment goal Δ mean % Δ mean % CI trials links
pycheck_lots_of_tags % cpu utilization +1.01 [-1.50, +3.52] 1 Logs
otel_to_otel_logs ingress throughput +0.68 [-0.14, +1.49] 1 Logs
file_to_blackhole_1000ms_latency egress throughput +0.49 [-0.00, +0.97] 1 Logs
idle memory utilization +0.26 [+0.22, +0.31] 1 Logs bounds checks dashboard
file_tree memory utilization +0.16 [+0.03, +0.29] 1 Logs
idle_all_features memory utilization +0.09 [-0.02, +0.20] 1 Logs bounds checks dashboard
tcp_syslog_to_blackhole ingress throughput +0.09 [+0.04, +0.14] 1 Logs
file_to_blackhole_500ms_latency egress throughput +0.07 [-0.18, +0.32] 1 Logs
file_to_blackhole_0ms_latency egress throughput +0.03 [-0.31, +0.36] 1 Logs
file_to_blackhole_100ms_latency egress throughput +0.03 [-0.20, +0.25] 1 Logs
uds_dogstatsd_to_api ingress throughput +0.01 [-0.10, +0.12] 1 Logs
tcp_dd_logs_filter_exclude ingress throughput -0.00 [-0.01, +0.01] 1 Logs
file_to_blackhole_300ms_latency egress throughput -0.06 [-0.24, +0.12] 1 Logs
uds_dogstatsd_to_api_cpu % cpu utilization -1.01 [-1.73, -0.29] 1 Logs
basic_py_check % cpu utilization -1.06 [-3.86, +1.75] 1 Logs

Bounds Checks

perf experiment bounds_check_name replicates_passed
file_to_blackhole_0ms_latency memory_usage 10/10
file_to_blackhole_1000ms_latency memory_usage 10/10
file_to_blackhole_100ms_latency memory_usage 10/10
file_to_blackhole_300ms_latency memory_usage 10/10
file_to_blackhole_500ms_latency memory_usage 10/10
idle memory_usage 10/10
idle_all_features memory_usage 10/10

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

@albertvaka albertvaka force-pushed the albertvaka/evpproxy-dont-cancel-context-manually branch from b0b8522 to c1134fc Compare October 17, 2024 14:57
@albertvaka albertvaka force-pushed the albertvaka/evpproxy-dont-cancel-context-manually branch from c1134fc to 83e0eb0 Compare October 17, 2024 15:26
@agent-platform-auto-pr
Copy link
Contributor

agent-platform-auto-pr bot commented Oct 17, 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=46861673 --os-family=ubuntu

Note: This applies to commit 58e99d6

@ajgajg1134
Copy link
Contributor

👋 Overall this change looks fine, can you add (or modify an existing) test to confirm this change and ensure it doesn't regress in the future? Once that's done you can add a qa/done label as well! Thanks!

@albertvaka albertvaka force-pushed the albertvaka/evpproxy-dont-cancel-context-manually branch from bb53010 to 58e99d6 Compare October 17, 2024 19:44
@albertvaka albertvaka added the qa/done QA done before merge and regressions are covered by tests label Oct 17, 2024
@albertvaka
Copy link
Contributor Author

I though writing an automated test for this case would be super hard, but it was actually nice and simple 😮 I added a test that fails with the previous code and passes now 👌

Copy link
Contributor

@ajgajg1134 ajgajg1134 left a comment

Choose a reason for hiding this comment

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

Thanks for adding that test! :)

@albertvaka
Copy link
Contributor Author

/merge

@dd-devflow
Copy link

dd-devflow bot commented Oct 17, 2024

🚂 MergeQueue: pull request added to the queue

The median merge time in main is 25m.

Use /merge -c to cancel this operation!

@dd-mergequeue dd-mergequeue bot merged commit b77289c into main Oct 17, 2024
225 checks passed
@dd-mergequeue dd-mergequeue bot deleted the albertvaka/evpproxy-dont-cancel-context-manually branch October 17, 2024 23:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog/no-changelog qa/done QA done before merge and regressions are covered by tests team/agent-apm trace-agent
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants