-
Notifications
You must be signed in to change notification settings - Fork 205
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add profiler auto instrumentation (#1534)
This commit adds profiler auto instrumentation to the Elastic APM .NET agent solution. Profiler auto instrumentation uses the CLR profiling APIs to instrument methods of interest at runtime, by signaling to the runtime to load an unmanaged profiler into the process using profiling environment variables. The approach comprises: 1. A CLR profiler written in Rust 2. Supporting managed assemblies containing methods that will be inserted into rewritten IL and called, to start and end transactions and spans. Initial integrations are available for common ADO.NET providers and Kafka, with more to follow in the future. The profiler auto instrumentation approach is currently an alpha release, as indicated by the version number in src/elastic_apm_profiler/Cargo.toml. Closes #1522
- Loading branch information
Showing
328 changed files
with
45,909 additions
and
605 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# This script runs the tests and stored the test ouptut in a JUnit xml file | ||
# defined in the test_results folder | ||
# | ||
set -euxo pipefail | ||
|
||
cargo make test | ||
|
||
dotnet test -c Release test/Elastic.Apm.Profiler.Managed.Tests/Elastic.Apm.Profiler.Managed.Tests.csproj \ | ||
--verbosity normal \ | ||
--results-directory target \ | ||
--diag target/diag-profiler.log \ | ||
--logger:"junit;LogFilePath=junit-{framework}-{assembly}.xml;MethodFormat=Class;FailureBodyFormat=Verbose" \ | ||
--collect:"XPlat Code Coverage" \ | ||
--settings coverlet.runsettings \ | ||
--blame-hang \ | ||
--blame-hang-timeout 10m \ | ||
/p:CollectCoverage=true \ | ||
/p:CoverletOutputFormat=cobertura \ | ||
/p:CoverletOutput=test_results/Coverage/ \ | ||
/p:Threshold=0 \ | ||
/p:ThresholdType=branch \ | ||
/p:ThresholdStat=total |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# This script runs the tests and stored the test ouptut in a JUnit xml file | ||
# defined in the test_results folder | ||
# | ||
set -euxo pipefail | ||
|
||
dotnet test -c Release test/Elastic.Apm.StartupHook.Tests/Elastic.Apm.StartupHook.Tests.csproj --no-build \ | ||
--verbosity normal \ | ||
--results-directory target \ | ||
--diag target/diag-startuphook.log \ | ||
--logger:"junit;LogFilePath=junit-{framework}-{assembly}.xml;MethodFormat=Class;FailureBodyFormat=Verbose" |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
cargo make test | ||
|
||
dotnet test -c Release test\Elastic.Apm.Profiler.Managed.Tests\Elastic.Apm.Profiler.Managed.Tests.csproj ^ | ||
--verbosity normal ^ | ||
--results-directory target ^ | ||
--diag target\diag-profiler.log ^ | ||
--logger:"junit;LogFilePath=junit-{framework}-{assembly}.xml;MethodFormat=Class;FailureBodyFormat=Verbose" ^ | ||
--collect:"XPlat Code Coverage" ^ | ||
--settings coverlet.runsettings ^ | ||
--blame-hang ^ | ||
--blame-hang-timeout 10m ^ | ||
/p:CollectCoverage=true ^ | ||
/p:CoverletOutputFormat=cobertura ^ | ||
/p:CoverletOutput=test_results/Coverage/ ^ | ||
/p:Threshold=0 ^ | ||
/p:ThresholdType=branch ^ | ||
/p:ThresholdStat=total |
This file contains 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
This file contains 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
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
reorder_imports = true | ||
|
||
# requires nightly rustfmt | ||
imports_granularity = "Crate" |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[workspace] | ||
|
||
members = [ | ||
"src/elastic_apm_profiler", | ||
] | ||
|
||
# default release profile: https://doc.rust-lang.org/cargo/reference/profiles.html#release | ||
[profile.release] | ||
lto = true | ||
codegen-units = 1 | ||
# reduce binary size by not unwinding on panic to get a backtrace | ||
#panic = "abort" |
This file contains 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
Oops, something went wrong.