[Tracer] Exit early during automatic instrumentation when the application is .NET Core 1.x#3114
Merged
Merged
Conversation
…en a .NET Core 1.x process is detected, instead of crashing during the tracer managed loader initialization
Member
Benchmarks Report 🐌Benchmarks for #3114 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 - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.TraceAnnotationsBenchmark - Same speed ✔️ Same allocations ✔️Raw results
|
lucaspimentel
approved these changes
Aug 22, 2022
Member
Code Coverage Report 📊✔️ Merging #3114 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: |
tonyredondo
approved these changes
Aug 23, 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
Adds logic to exit initialization of the native Tracer CLR Profiler when a .NET Core 1.x process is detected.
Reason for change
Without this fix, the tracer's managed loader fails to initialize when running on .NET Core 1.0 or .NET Core 1.1 because the managed loader is built against .NET Core 2.0 and it exhibits the following stack trace:
Even though our public documentation indicates support begins at .NET Core 2.1, it's possible for the environment variables to be set machine-wide and enable automatic instrumentation for .NET Core 1.x applications.
Implementation details
Fortunately for us, the
ICorProfilerInfo8interface was added in .NET Core 2.0 so we can check whether the interface is present to determine if the application is running on .NET Core 1.x. If the interface is not present and the runtime is CoreCLR, we exit the native tracer's initialization and log warning message.Test coverage
Confirmed the following test cases locally:
ICorProfilerInfo8interface involved in the new check was not introduced in .NET Framework until 4.7.2, so the test ensured that the CoreCLR runtime part of the check was correct.No regression tests have been added because I'm not sure if it's worth installing the .NET Core 1.0 SDK to run one test application.
Other details
N/A