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 and cleanup the Content-Length handling in transport #2954

Merged
merged 5 commits into from
Oct 30, 2024

Conversation

paulcacheux
Copy link
Contributor

@paulcacheux paulcacheux commented Oct 29, 2024

What does this PR do?

This PR cleans up the Content-Length header in the request made to the agent. In the case of civisibility the request is made with a *bytes.Buffer and as indicated in the documentation the content length is computed automatically here (cf doc).

In the case of the default/regular trace transport, the Content-Length was set manually through the header. My investigation from the agent side is that we receive a fair amount of traces from dd-trace-go without Content-Length, so this PR moves the content length back to the actual request field, as suggested in the documentation.

Here is a playground example showing how setting the header manually is not working as expected https://go.dev/play/p/AGdBGGZ7IgY

Motivation

Reviewer's Checklist

  • Changed code has unit tests for its functionality at or near 100% coverage.
  • System-Tests covering this feature have been added and enabled with the va.b.c-dev version tag.
  • There is a benchmark for any new code, or changes to existing code.
  • If this interacts with the agent in a new way, a system test has been added.
  • Add an appropriate team label so this PR gets put in the right place for the release notes.
  • Non-trivial go.mod changes, e.g. adding new modules, are reviewed by @DataDog/dd-trace-go-guild.

Unsure? Have a question? Request a review!

@paulcacheux paulcacheux changed the title Paulcacheux/content length cleanup fix and cleanup the Content-Length handling in transport Oct 29, 2024
@pr-commenter
Copy link

pr-commenter bot commented Oct 29, 2024

Benchmarks

Benchmark execution time: 2024-10-30 12:38:57

Comparing candidate commit be5f2ea in PR branch paulcacheux/content-length-cleanup with baseline commit fab2f13 in branch main.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 58 metrics, 1 unstable metrics.

@paulcacheux paulcacheux marked this pull request as ready for review October 30, 2024 07:27
@paulcacheux paulcacheux requested a review from a team as a code owner October 30, 2024 07:27
@paulcacheux
Copy link
Contributor Author

/merge

@dd-devflow
Copy link

dd-devflow bot commented Oct 30, 2024

❌ MergeQueue

You are not allowed to use the merge queue towards main. User is not part of the authorized users or teams.
The authorized teams are: apm-ecosystems, apm-go, asm-go, profiling-go.
The authorized users are: dbenamydd.

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

@paulcacheux
Copy link
Contributor Author

@darccio thanks for the review, please feel free to merge this (I don't have the rights)

@darccio
Copy link
Member

darccio commented Oct 30, 2024

@paulcacheux Sure, give me a moment.

@darccio darccio merged commit 6b5e01a into main Oct 30, 2024
149 of 150 checks passed
@darccio darccio deleted the paulcacheux/content-length-cleanup branch October 30, 2024 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants