[CIVisibility] - Fix InternalFlushEventsAsync task creation#3148
Merged
Conversation
kevingosse
approved these changes
Sep 1, 2022
Member
Benchmarks Report 🐌Benchmarks for #3148 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 - Unknown 🤷 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 - Slower
|
| Benchmark | diff/base | Base Median (ns) | Diff Median (ns) | Modality |
|---|---|---|---|---|
| Benchmarks.Trace.SpanBenchmark.StartFinishScope‑netcoreapp3.1 | 1.143 | 1,065.12 | 1,217.48 |
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | StartFinishSpan |
net472 | 1.1μs | 0.39ns | 1.46ns | 0.128 | 0 | 0 | 810 B |
| master | StartFinishSpan |
netcoreapp3.1 | 942ns | 0.385ns | 1.44ns | 0.0103 | 0 | 0 | 760 B |
| master | StartFinishScope |
net472 | 1.39μs | 0.328ns | 1.23ns | 0.141 | 0 | 0 | 891 B |
| master | StartFinishScope |
netcoreapp3.1 | 1.06μs | 0.372ns | 1.34ns | 0.0119 | 0 | 0 | 880 B |
| #3148 | StartFinishSpan |
net472 | 1.16μs | 0.426ns | 1.48ns | 0.129 | 0 | 0 | 810 B |
| #3148 | StartFinishSpan |
netcoreapp3.1 | 949ns | 0.625ns | 2.42ns | 0.0104 | 0 | 0 | 760 B |
| #3148 | StartFinishScope |
net472 | 1.45μs | 4.44ns | 17.2ns | 0.141 | 0 | 0 | 891 B |
| #3148 | StartFinishScope |
netcoreapp3.1 | 1.21μs | 3.42ns | 13.2ns | 0.0119 | 0 | 0 | 880 B |
Benchmarks.Trace.TraceAnnotationsBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | RunOnMethodBegin |
net472 | 1.46μs | 0.671ns | 2.6ns | 0.141 | 0 | 0 | 891 B |
| master | RunOnMethodBegin |
netcoreapp3.1 | 1.18μs | 1.28ns | 4.94ns | 0.0117 | 0 | 0 | 880 B |
| #3148 | RunOnMethodBegin |
net472 | 1.54μs | 0.377ns | 1.46ns | 0.141 | 0 | 0 | 891 B |
| #3148 | RunOnMethodBegin |
netcoreapp3.1 | 1.16μs | 0.503ns | 1.88ns | 0.0122 | 0 | 0 | 880 B |
Member
Code Coverage Report 📊✔️ Merging #3148 into master will not change line coverage
View the full report for further details: Datadog.Trace Breakdown ✔️
The following classes have significant coverage changes.
View the full reports for further details: |
andrewlock
approved these changes
Sep 1, 2022
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
This PR fixes a problematic behaviour in the task creation of the
InternalFlushEventsAsynctask.Reason for change
The current implementation uses the
Task.Factory.StartNewmethod without unwrapping the inner Task in a sync loop, that means that when theInternalFlushEventsAsynchits anawaitline, the task will complete.Implementation details
The PR replaces the use of
Task.Factory.StartNewwithTask.Runthat handles this automatically by unwrapping the inner task created byInternalFlushEventsAsync