Add support for specifying a Content-Encoding in IApiRequest#3238
Merged
Conversation
Content-Encoding needs to be set on the request _content_ in HttpClient, not on the client itself, so the normal AddHeader() approach doesn't work. This provides an overload to PostAsync for providing the content encoding
Member
Author
Benchmarks Report 🐌Benchmarks for #3238 compared to master:
The following thresholds were used for comparing the benchmark speeds:
Allocation changes below 0.5% are ignored. Benchmark detailsBenchmarks.Trace.AgentWriterBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.AppSecBodyBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.AspNetCoreBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.DbCommandBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.ElasticsearchBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.GraphQLBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.HttpClientBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.ILoggerBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.Log4netBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.NLogBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.RedisBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.SerilogBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.SpanBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.TraceAnnotationsBenchmark - Same speed ✔️ Same allocations ✔️Raw results
|
Member
Author
Code Coverage Report 📊⛔ Merging #3238 into master will will decrease line coverage by
View the full report for further details: Datadog.Trace Breakdown ⛔
The following classes have significant coverage changes.
View the full reports for further details: |
pierotibou
approved these changes
Sep 21, 2022
bouwkast
approved these changes
Sep 21, 2022
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of changes
Adds the ability to set
Content-Encodingon aPOSTrequest.Reason for change
For data streams monitoring we need to set the
Content-Encodingheader. This isn't currently possible with ourIApiRequestimplementation (HttpClientis finicky about where you set the header).Implementation details
Adds a new overload to
IApiRequest.PostAsync()for setting the content encoding (similar to the way we set the content type).Content-Encodingneeds to be set on the request content inHttpClient, not on the client itself, so the normal AddHeader() approach doesn't work here.Test coverage
The no-encoding pathways are tested by existing tests. I haven't added explicit paths testing the setting of encoding in this PR; it's tested indirectly in a follow-up PR for DSM.
Other details
ApiWebRequest. The existing code feels a bit icky, but this doesn't change anything fundamental.