[Profiler] Use shared runtime id in the profiler#2635
Merged
gleocadie merged 14 commits intoApr 7, 2022
Conversation
- dispatch sample per their runtime id - when exporting, send as many requests as applications we have (1 runtime id == 1 application)
gleocadie
force-pushed
the
gleocadie/use-shared-runtime-id-in-the-profiler
branch
from
April 6, 2022 07:28
9e95e6e to
fc56937
Compare
gleocadie
force-pushed
the
gleocadie/use-shared-runtime-id-in-the-profiler
branch
from
April 6, 2022 09:11
fc56937 to
22a17b0
Compare
gleocadie
force-pushed
the
gleocadie/use-shared-runtime-id-in-the-profiler
branch
from
April 6, 2022 09:36
22a17b0 to
3518bd6
Compare
gleocadie
force-pushed
the
gleocadie/use-shared-runtime-id-in-the-profiler
branch
2 times, most recently
from
April 6, 2022 14:28
4fb1aa5 to
80544c6
Compare
gleocadie
force-pushed
the
gleocadie/use-shared-runtime-id-in-the-profiler
branch
4 times, most recently
from
April 6, 2022 19:54
250cf08 to
7bbdf51
Compare
gleocadie
force-pushed
the
gleocadie/use-shared-runtime-id-in-the-profiler
branch
from
April 6, 2022 20:10
7bbdf51 to
2faa64f
Compare
gleocadie
marked this pull request as ready for review
April 6, 2022 20:56
gleocadie
force-pushed
the
gleocadie/use-shared-runtime-id-in-the-profiler
branch
from
April 6, 2022 20:57
2faa64f to
93d04a3
Compare
gleocadie
force-pushed
the
gleocadie/use-shared-runtime-id-in-the-profiler
branch
from
April 6, 2022 22:06
93d04a3 to
73c50c0
Compare
Member
Benchmarks Report 🐌Benchmarks for #2635 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 - Faster 🎉 Same allocations ✔️
|
| Benchmark | base/diff | Base Median (ns) | Diff Median (ns) | Modality |
|---|---|---|---|---|
| Benchmarks.Trace.AspNetCoreBenchmark.SendRequest‑netcoreapp3.1 | 1.195 | 349,203.56 | 292,238.27 |
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | SendRequest |
net472 | 0ns | 0ns | 0ns | 0 | 0 | 0 | 0 b |
| master | SendRequest |
netcoreapp3.1 | 350μs | 1.61μs | 6.42μs | 0.17 | 0 | 0 | 19.74 KB |
| #2635 | SendRequest |
net472 | 0ns | 0ns | 0ns | 0 | 0 | 0 | 0 b |
| #2635 | SendRequest |
netcoreapp3.1 | 292μs | 1.13μs | 4.24μs | 0.146 | 0 | 0 | 19.74 KB |
Benchmarks.Trace.DbCommandBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | ExecuteNonQuery |
net472 | 1.93μs | 11ns | 84.1ns | 0.0934 | 0.00103 | 0 | 594 B |
| master | ExecuteNonQuery |
netcoreapp3.1 | 1.56μs | 5.48ns | 20.5ns | 0.00868 | 0 | 0 | 632 B |
| #2635 | ExecuteNonQuery |
net472 | 1.74μs | 8.19ns | 31.7ns | 0.0943 | 0.000874 | 0 | 594 B |
| #2635 | ExecuteNonQuery |
netcoreapp3.1 | 1.49μs | 3.7ns | 13.3ns | 0.00845 | 0 | 0 | 632 B |
Benchmarks.Trace.ElasticsearchBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | CallElasticsearch |
net472 | 3.03μs | 14.5ns | 59.8ns | 0.127 | 0 | 0 | 803 B |
| master | CallElasticsearch |
netcoreapp3.1 | 1.79μs | 10ns | 75.1ns | 0.0105 | 0 | 0 | 792 B |
| master | CallElasticsearchAsync |
net472 | 3.05μs | 15.3ns | 68.2ns | 0.148 | 0.00151 | 0 | 939 B |
| master | CallElasticsearchAsync |
netcoreapp3.1 | 1.91μs | 9.16ns | 37.8ns | 0.0132 | 0 | 0 | 912 B |
| #2635 | CallElasticsearch |
net472 | 2.82μs | 13.4ns | 61.3ns | 0.127 | 0 | 0 | 803 B |
| #2635 | CallElasticsearch |
netcoreapp3.1 | 1.85μs | 6.64ns | 23ns | 0.0105 | 0 | 0 | 792 B |
| #2635 | CallElasticsearchAsync |
net472 | 3.08μs | 16.5ns | 92ns | 0.148 | 0.00151 | 0 | 939 B |
| #2635 | CallElasticsearchAsync |
netcoreapp3.1 | 1.81μs | 10.1ns | 63.2ns | 0.0123 | 0 | 0 | 912 B |
Benchmarks.Trace.GraphQLBenchmark - Faster 🎉 Same allocations ✔️
Faster 🎉 in #2635
Benchmark
base/diff
Base Median (ns)
Diff Median (ns)
Modality
Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync‑net472
1.131
3,397.40
3,003.50
| Benchmark | base/diff | Base Median (ns) | Diff Median (ns) | Modality |
|---|---|---|---|---|
| Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync‑net472 | 1.131 | 3,397.40 | 3,003.50 |
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | ExecuteAsync |
net472 | 3.41μs | 16.9ns | 71.8ns | 0.167 | 0.00167 | 0 | 1.06 KB |
| master | ExecuteAsync |
netcoreapp3.1 | 2.13μs | 9.34ns | 36.2ns | 0.0147 | 0 | 0 | 1.03 KB |
| #2635 | ExecuteAsync |
net472 | 3.02μs | 12ns | 51.1ns | 0.167 | 0.00154 | 0 | 1.06 KB |
| #2635 | ExecuteAsync |
netcoreapp3.1 | 2μs | 6.94ns | 29.4ns | 0.0139 | 0 | 0 | 1.03 KB |
Benchmarks.Trace.HttpClientBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | SendAsync |
net472 | 7.24μs | 37.2ns | 167ns | 0.361 | 0 | 0 | 2.28 KB |
| master | SendAsync |
netcoreapp3.1 | 5.15μs | 16.4ns | 63.7ns | 0.0303 | 0 | 0 | 2.21 KB |
| #2635 | SendAsync |
net472 | 6.84μs | 22.3ns | 86.3ns | 0.359 | 0 | 0 | 2.28 KB |
| #2635 | SendAsync |
netcoreapp3.1 | 5.04μs | 17.5ns | 65.4ns | 0.0301 | 0 | 0 | 2.21 KB |
Benchmarks.Trace.ILoggerBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | EnrichedLog |
net472 | 3.73μs | 21.8ns | 192ns | 0.227 | 0 | 0 | 1.45 KB |
| master | EnrichedLog |
netcoreapp3.1 | 3.15μs | 11.8ns | 44.1ns | 0.0207 | 0 | 0 | 1.53 KB |
| #2635 | EnrichedLog |
net472 | 3.38μs | 12.4ns | 46.2ns | 0.228 | 0 | 0 | 1.45 KB |
| #2635 | EnrichedLog |
netcoreapp3.1 | 3.09μs | 4.65ns | 16.1ns | 0.0213 | 0 | 0 | 1.53 KB |
Benchmarks.Trace.Log4netBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | EnrichedLog |
net472 | 302μs | 1.28μs | 4.97μs | 0.314 | 0.157 | 0 | 4.33 KB |
| master | EnrichedLog |
netcoreapp3.1 | 244μs | 1.13μs | 4.37μs | 0 | 0 | 0 | 4.21 KB |
| #2635 | EnrichedLog |
net472 | 292μs | 1.36μs | 5.27μs | 0.428 | 0.143 | 0 | 4.33 KB |
| #2635 | EnrichedLog |
netcoreapp3.1 | 233μs | 1.06μs | 4.09μs | 0 | 0 | 0 | 4.21 KB |
Benchmarks.Trace.NLogBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | EnrichedLog |
net472 | 8.21μs | 38ns | 142ns | 0.504 | 0 | 0 | 3.23 KB |
| master | EnrichedLog |
netcoreapp3.1 | 6.79μs | 30.9ns | 164ns | 0.0499 | 0 | 0 | 3.6 KB |
| #2635 | EnrichedLog |
net472 | 7.84μs | 39.7ns | 182ns | 0.504 | 0 | 0 | 3.23 KB |
| #2635 | EnrichedLog |
netcoreapp3.1 | 6.57μs | 33.6ns | 150ns | 0.0483 | 0 | 0 | 3.6 KB |
Benchmarks.Trace.RedisBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | SendReceive |
net472 | 2.39μs | 10.9ns | 40.8ns | 0.16 | 0.00121 | 0 | 1.01 KB |
| master | SendReceive |
netcoreapp3.1 | 2.09μs | 9.8ns | 38ns | 0.0139 | 0 | 0 | 1.01 KB |
| #2635 | SendReceive |
net472 | 2.41μs | 13.3ns | 83ns | 0.159 | 0 | 0 | 1.01 KB |
| #2635 | SendReceive |
netcoreapp3.1 | 2.24μs | 10.8ns | 61.3ns | 0.0137 | 0 | 0 | 1.01 KB |
Benchmarks.Trace.SerilogBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | EnrichedLog |
net472 | 6.44μs | 20.4ns | 79.1ns | 0.292 | 0 | 0 | 1.87 KB |
| master | EnrichedLog |
netcoreapp3.1 | 5.23μs | 12.8ns | 47.9ns | 0.021 | 0 | 0 | 1.49 KB |
| #2635 | EnrichedLog |
net472 | 5.92μs | 23.7ns | 82ns | 0.292 | 0 | 0 | 1.87 KB |
| #2635 | EnrichedLog |
netcoreapp3.1 | 5.11μs | 23.5ns | 91ns | 0.0205 | 0 | 0 | 1.49 KB |
Benchmarks.Trace.SpanBenchmark - Faster 🎉 Same allocations ✔️
Faster 🎉 in #2635
Benchmark
base/diff
Base Median (ns)
Diff Median (ns)
Modality
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑netcoreapp3.1
1.149
991.01
862.43
Benchmarks.Trace.SpanBenchmark.StartFinishScope‑net472
1.136
1,248.07
1,099.05
| Benchmark | base/diff | Base Median (ns) | Diff Median (ns) | Modality |
|---|---|---|---|---|
| Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑netcoreapp3.1 | 1.149 | 991.01 | 862.43 | |
| Benchmarks.Trace.SpanBenchmark.StartFinishScope‑net472 | 1.136 | 1,248.07 | 1,099.05 |
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | StartFinishSpan |
net472 | 964ns | 5.14ns | 27.2ns | 0.0716 | 0 | 0 | 457 B |
| master | StartFinishSpan |
netcoreapp3.1 | 991ns | 4.58ns | 17.7ns | 0.00611 | 0 | 0 | 456 B |
| master | StartFinishScope |
net472 | 1.24μs | 6.9ns | 42.5ns | 0.0841 | 0 | 0 | 538 B |
| master | StartFinishScope |
netcoreapp3.1 | 1.13μs | 6.58ns | 57.4ns | 0.0079 | 0 | 0 | 576 B |
| #2635 | StartFinishSpan |
net472 | 885ns | 2.75ns | 10.7ns | 0.0718 | 0 | 0 | 457 B |
| #2635 | StartFinishSpan |
netcoreapp3.1 | 871ns | 4.59ns | 22ns | 0.00635 | 0 | 0 | 456 B |
| #2635 | StartFinishScope |
net472 | 1.1μs | 4.92ns | 18.4ns | 0.0844 | 0 | 0 | 538 B |
| #2635 | StartFinishScope |
netcoreapp3.1 | 1.02μs | 4.2ns | 16.3ns | 0.00799 | 0 | 0 | 576 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.38μs | 6.84ns | 29ns | 0.0838 | 0 | 0 | 538 B |
| master | RunOnMethodBegin |
netcoreapp3.1 | 1.24μs | 6.47ns | 42.4ns | 0.00798 | 0 | 0 | 576 B |
| #2635 | RunOnMethodBegin |
net472 | 1.29μs | 3.84ns | 14.9ns | 0.0844 | 0 | 0 | 538 B |
| #2635 | RunOnMethodBegin |
netcoreapp3.1 | 1.18μs | 5.47ns | 21.2ns | 0.00761 | 0 | 0 | 576 B |
Member
Code Coverage Report 📊✔️ Merging #2635 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: |
gleocadie
force-pushed
the
gleocadie/use-shared-runtime-id-in-the-profiler
branch
from
April 7, 2022 06:59
4443124 to
ffadd54
Compare
chrisnas
requested changes
Apr 7, 2022
simplify the asserts
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
Reason for change
To finally have the Code Hotspot feature, the profiler needs to send
runtime-idalong with the profiles. Moreover, theruntime-idmust be the same as the one used by the Tracer.Implementation details
On windows, the profiler and tracer are started by the
native proxy. This component also acts as a central point to share data/information. In our case, thenative proxywill be source of truth for theruntime-id. In a previous PR, we made sure that the Tracer relies on thenative proxyto get theruntime-id.Now, the profiler will request the
runtime-idfor a specificAppDomainIDto thenative proxy.runtime-idwill be the same whateverAppDomainIDis passed.native proxywill provide oneruntime-idperAppDomainID.Note: In the linux case, we have a fallback, we let the profiler compute the
runtime-idIn IIS case, we may have 1 process (
w3wp) but multiple web applications. To handle this case, we will create and send as many requests as applications we have.One pain point, the current version of the
libddprofAPI we use, does not allow us to attach tags to a request. Tags are added to exporter instance. This forces us to create one exporter per application. Inlibddproffuture releases, this is fixed.Test coverage
Add new integration tests.
Other details