Skip to content

Automatically instrument methods decorated with [Trace] (Datadog.Trace.Annotations.TraceAttribute)#2606

Merged
zacharycmontoya merged 25 commits into
masterfrom
zach/trace-methods-attribute
Apr 20, 2022
Merged

Automatically instrument methods decorated with [Trace] (Datadog.Trace.Annotations.TraceAttribute)#2606
zacharycmontoya merged 25 commits into
masterfrom
zach/trace-methods-attribute

Conversation

@zacharycmontoya

@zacharycmontoya zacharycmontoya commented Mar 25, 2022

Copy link
Copy Markdown
Contributor

Summary of changes

Adds a new public type named Datadog.Trace.Annotations.TraceAttribute. Application code can add the attribute to any method with [Trace] and automatic instrumentation will automatically instrument it at runtime, with the following span metadata.

To avoid having applications depend on Datadog.Trace.dll for this attribute, define it in a new assembly Datadog.Trace.Annotations.dll.

Span metadata

Operation Name: TraceAttribute.OperationName ?? "trace.annotation"
Resource Name: TraceAttribute.ResourceName ?? "<METHOD_NAME>"
Tags:

  • component: trace

Configuration

This feature is enabled by default. If the overhead is too much and users are not using the feature, it can be disabled by setting DD_TRACE_ANNOTATIONS_ENABLED=false.

Implementation details

  • Add a new PInvoke called AddTraceAttributeInstrumentation which is invoked early (like the ByRef instrumentation) before the static Tracer.Instance is initialized. This initializes the TraceAnnotationsIntegration used by both [Trace] instrumentation and DD_TRACE_METHODS instrumentation.
  • Modify the ModuleLoadFinished event in two major ways
    • After checking that a module should not be skipped, find any methods within the module decorated with the CustomAttribute named Datadog.Trace.Annotations.TraceAttribute. If the TraceAnnotationsIntegration has been initialized, immediately request a ReJIT for each method with integration_type=TraceAnnotationsIntegration. If the integration is not yet initialized, put all the found methods on a queue to be processed in a later ModuleLoadFinished callback.
    • Regardless if a module requested ReJIT, at the end of each ModuleLoadFinished callback check whether the TraceAnnotationsIntegration has been initialized, and if it is then empty the queue and request a ReJIT for each method.

Test coverage

Update Samples.TraceAnnotations test application and its integration test in the following ways:

  • Remove Samples.TraceAnnotations.Program[RunTestsAsync] from the DD_TRACE_METHODS configuration and place the [Trace] attribute on the method and assert that the span is still generated
  • Add [Trace] attributes onto existing methods specified by DD_TRACE_METHODS and assert that the spans have the same OperationName/ResourceName as the attribute
  • Add a new methods that only have the [Trace] attribute and are not specified in DD_TRACE_METHODS. Assert that new spans are created for the new methods
  • Use both the official Datadog.Trace.Annotatations.TraceAttribute type and a user-defined Datadog.Trace.Annotations.TraceAttribute to ensure that both result in instrumentation

@zacharycmontoya zacharycmontoya added the area:native-library Automatic instrumentation native C++ code (Datadog.Trace.ClrProfiler.Native) label Mar 25, 2022
@zacharycmontoya zacharycmontoya self-assigned this Mar 25, 2022
@zacharycmontoya
zacharycmontoya requested a review from a team as a code owner March 25, 2022 22:16
@andrewlock

This comment has been minimized.

@andrewlock

This comment has been minimized.

@pierotibou

Copy link
Copy Markdown
Contributor

Haven't done a review yet, but I'm wondering what can be the impact on startup time? Could it be significant enough so that we should add a flag to allow the feature to be enabled (or disabled if we want to make it easier to use) by a customer?

Comment thread tracer/src/Datadog.Trace.ClrProfiler.Native/cor_profiler.cpp Outdated
@lucaspimentel lucaspimentel changed the title Automatically instrument methods decorated with [Trace] (Datadog.Trace.TraceAttribute) Automatically instrument methods decorated with [Trace] (Datadog.Trace.TraceAttribute) Apr 13, 2022
@zacharycmontoya zacharycmontoya changed the title Automatically instrument methods decorated with [Trace] (Datadog.Trace.TraceAttribute) Automatically instrument methods decorated with [Trace] (Datadog.Trace.Annotations.TraceAttribute) Apr 13, 2022
@zacharycmontoya
zacharycmontoya force-pushed the zach/trace-methods-attribute branch from 9a93e1d to 941cb6c Compare April 14, 2022 02:47

@andrewlock andrewlock left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! I have a couple of questions and comments, but we should also double check the nupkg is included in the build release artifacts. It should be, but worth checking if you haven't already 🙂

Comment thread docs/Datadog.Trace.Annotations/README.md Outdated
Comment thread tracer/src/Datadog.Trace.Annotations/TraceAttribute.cs Outdated
/// Attribute that marks the decorated method to be instrumented
/// by Datadog automatic instrumentation.
/// </summary>
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use this on properties too, or only methods right now?

@zacharycmontoya zacharycmontoya Apr 14, 2022

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now it's only methods, though I'm not sure how well the attribute would map to properties because a property can map to both a getter method and a setter method, and I'm not sure we'd want to set the same ResourceName for both. I just realized that I can decorate a property accessor method like the following (and added this to my integration tests in 46ae5f8dd067fd13db2b590f9a283f7ed6c1edea), so I think this will handle the case where users want to decorate property usages. Does that sound good?

class TestType
{
    public string Name
    {
        [Trace]
        get;
        [Trace]
        set;
    }
}

@lucaspimentel lucaspimentel Apr 15, 2022

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we allow this:

class TestType
{
    [Trace]
    public string Name { get; set; }
}

Wouldn't the resource names be get_Name and set_Name, since those are the actual method names behind-the-scenes? Hmm, but I guess that gets weird is the user overrides the resource name in the attribute.

@zacharycmontoya zacharycmontoya Apr 15, 2022

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that's what I was trying to avoid, if the user decided to set a custom resource name but places the attribute on the property. That's why I'm proposing we limit the attribute usage to just methods instead of trying to make it work for properties. Plus property support on the native side would be more complicated 😅

Comment thread tracer/src/Datadog.Trace.ClrProfiler.Native/cor_profiler.cpp Outdated
Comment thread tracer/src/Datadog.Trace.ClrProfiler.Native/cor_profiler.cpp Outdated
Comment on lines +774 to +775
const void* attribute_data = nullptr; // We'll likely need to use this Hopefully we don't need to
// use this because I don't know how

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

conflicted! 😄

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😆 I'll clean this up now that it's implemented 😛

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤣🤣🤣

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Existential crisis fixed in 46ae5f8

Comment thread tracer/test/Datadog.Trace.TestHelpers/PublicApiTestsBase.cs
Comment thread tracer/test/Datadog.Trace.Tests/PublicApiTests.cs Outdated

<ItemGroup>
<ProjectReference Include="..\..\..\..\src\Datadog.Trace.Annotations\Datadog.Trace.Annotations.csproj">
<Aliases>OfficialDatadogAlias</Aliases>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Me too, I discovered it when I wanted to only use one test application to test using the official type and a custom-made one 😆

@@ -0,0 +1,13 @@
# Datadog.Trace.Annotations NuGet package

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also add a note to the Datadog.Trace readme, mentioning the existence of this package?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, I'll draft up some changes that you can review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in 5154c99. WDYT?

@andrewlock

This comment has been minimized.


> Note: Automatic instrumentation is required for the attributes in this package to take effect. Please [read our documentation](https://docs.datadoghq.com/tracing/setup/dotnet) for details on how to install the tracer for automatic instrumentation.

> Note: If you are unable to add new package references to your application, you may still enable this functionality by defining types inside your application whose full name and type members match the definitions in this package.

@lucaspimentel lucaspimentel Apr 15, 2022

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we provide the minimal code for the attribute so users can copy/paste? Maybe right here in the readme, or link to tracer/src/Datadog.Trace.Annotations/TraceAttribute.cs in the repo.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the list of attributes below I provided a link to the repo, but I think we could also add the code snippet since this package is pretty small. I'll go ahead and add that

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added in fe2336d

@zacharycmontoya

Copy link
Copy Markdown
Contributor Author

Haven't done a review yet, but I'm wondering what can be the impact on startup time? Could it be significant enough so that we should add a flag to allow the feature to be enabled (or disabled if we want to make it easier to use) by a customer?

@pierotibou I added an optimization in 35e2222 to skip the new code path for all assemblies whose name starts with System., Microsoft., and Datadog., because these assemblies shouldn't have the attribute in their source. I haven't done any other startup measurements though. Do you think this is sufficient?

@andrewlock

This comment has been minimized.

@andrewlock

This comment has been minimized.

@andrewlock

This comment has been minimized.

…aceAnnotationsIntegration spans by decorating a method specified by DD_TRACE_METHODS with a Datadog.Trace.TraceAttribute

Next: Have the profiler automatically find methods with the Datadog.Trace.TraceAttribute and instrument them with the TraceAnnotationsIntegration
…DD_TRACE_METHODS, decorate it with the Datadog.Trace.TraceAttribute, and assert that we have a new span. Also apply the attribute to methods already specified by DD_TRACE_METHODS and assert that we have the same number of spans and that the attribute's ResourceName and OperationName properties get applied to the generated span.

Product:
- Modify the ModuleLoadFinished callback to look through a module (so long as we don't intentionally skip it) to look for methods decorated with  Datadog.Trace.TraceAttribute and request ReJIT on them. If the integrations have not been loaded yet, they're put on a queue to be requested for ReJIT at a later ModuleLoadFinished callback.
- Add a new PInvoke in the profiler to add the TraceAnnotationsIntegration type earlier in the startup code path than the InitializeTraceMethods PInvoke, which occurs after Tracer initialization
…METHODS and mark it with [Trace] to demonstrate that we can instrument early methods (except for the entrypoint Main) at this point
…pt a TypeReference argument so we can re-use the one trace_annotation_integration_type TypeReference
…lection, do not depend on having a type reference to it
…aceAttribute and move it to a new Datadog.Trace.Annotations assembly/package

- In Samples.TraceAnnotations, test the official Datadog.Trace.Annotations.TraceAttribute type from the Datadog.Trace.Annotations assembly under alias OfficialTraceAttribute and test a custom-built Datadog.Trace.Annotations.TraceAttribute type from the Samples.TraceAnnotations assembly under alias CustomTraceAttribute
zacharycmontoya and others added 13 commits April 19, 2022 10:54
- Apply nullable at project level for Datadog.Trace.Annotations
- Add attribute to property setter to demonstrate how to use the trace attribute on property accessors methods
- Create a constant field for WStr("Datadog.Trace.Annotations.TraceAttribute") and a static field for its c_string
- Fix comments
- Fix public API snapshots for net6.0
…Annotations NuGet package from the Datadog.Trace README.

Also add further documentation in the Datadog.Trace.Annotations README.
…ave the following prefixes

- "System."
- "Microsoft."
- "Datadog."
…raceAnnotations.VersionMismatch.NewerNuGet test application that contains the logic to scan for [Trace]
@zacharycmontoya
zacharycmontoya force-pushed the zach/trace-methods-attribute branch from 913b0dd to d5ceab4 Compare April 19, 2022 17:55
@andrewlock

This comment has been minimized.

…trace annotations feature is enabled, since it incurs an added runtime cost. The default is true so users can immediately take advantage of the feature
@zacharycmontoya

Copy link
Copy Markdown
Contributor Author

Haven't done a review yet, but I'm wondering what can be the impact on startup time? Could it be significant enough so that we should add a flag to allow the feature to be enabled (or disabled if we want to make it easier to use) by a customer?

@pierotibou I added an optimization in 35e2222 to skip the new code path for all assemblies whose name starts with System., Microsoft., and Datadog., because these assemblies shouldn't have the attribute in their source. I haven't done any other startup measurements though. Do you think this is sufficient?

Just to be on the safe side, I've added a feature flag in a5ffc98 titled DD_TRACE_ANNOTATIONS_ENABLED to control whether the feature is enabled, since there is a small runtime cost associated with the feature. It defaults to being enabled so users can easily adopt the feature and instead choose to opt-out if the performance overhead is too much for an application

@andrewlock

Copy link
Copy Markdown
Member

Code Coverage Report 📊

✔️ Merging #2606 into master will not change line coverage
✔️ Merging #2606 into master will not change branch coverage
⛔ Merging #2606 into master will will increase complexity by 20

master #2606 Change
Lines 13550 / 18651 13585 / 18684
Lines % 73% 73% 0% ✔️
Branches 7822 / 11131 7847 / 11149
Branches % 70% 70% 0% ✔️
Complexity 12416 12436 20

View the full report for further details:

Datadog.Trace Breakdown ✔️

master #2606 Change
Lines % 73% 73% 0% ✔️
Branches % 70% 70% 0% ✔️
Complexity 12416 12436 20

The following classes have significant coverage changes.

File Line coverage change Branch coverage change Complexity change
Datadog.Trace.Telemetry.JsonHttpClientTelemetryTransport -26% -38% 0 ✔️
Datadog.Trace.Ci.GitInfo -17% -11% 0 ✔️
Datadog.Trace.ClrProfiler.NativeMethods 2% ✔️ 9% ✔️ 6
Datadog.Trace.ClrProfiler.AutoInstrumentation.TraceAnnotations.TraceAnnotationInfoFactory 5% ✔️ 31% ✔️ 15
Datadog.Trace.ClrProfiler.InstrumentationDefinitions 6% ✔️ 0% ✔️ 1
Datadog.Trace.Ci.CIVisibility 7% ✔️ 7% ✔️ 0 ✔️

View the full reports for further details:

@andrewlock

Copy link
Copy Markdown
Member

Benchmarks Report 🐌

Benchmarks for #2606 compared to master:

  • 1 benchmarks are faster, with geometric mean 1.153
  • 3 benchmarks are slower, with geometric mean 1.235
  • All benchmarks have the same allocations

The following thresholds were used for comparing the benchmark speeds:

  • Mann–Whitney U test with statistical test for significance of 5%
  • Only results indicating a difference greater than 10% and 0.3 ns are considered.

Allocation changes below 0.5% are ignored.

Benchmark details

Benchmarks.Trace.AgentWriterBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master WriteAndFlushEnrichedTraces net472 972μs 5.51μs 39.7μs 0 0 0 3.16 KB
master WriteAndFlushEnrichedTraces netcoreapp3.1 757μs 1.86μs 6.7μs 0 0 0 2.57 KB
#2606 WriteAndFlushEnrichedTraces net472 1.04ms 3.84μs 14.9μs 0 0 0 3.17 KB
#2606 WriteAndFlushEnrichedTraces netcoreapp3.1 730μs 1.74μs 6.53μs 0 0 0 2.57 KB
Benchmarks.Trace.AppSecBodyBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master AllCycleSimpleBody net472 324ns 1.67ns 7.47ns 0.066 0 0 417 B
master AllCycleSimpleBody netcoreapp3.1 415ns 1.63ns 6.11ns 0.00582 0 0 416 B
master AllCycleMoreComplexBody net472 317ns 1.24ns 5.24ns 0.0621 0 0 393 B
master AllCycleMoreComplexBody netcoreapp3.1 400ns 1.62ns 6.28ns 0.00552 0 0 392 B
master BodyExtractorSimpleBody net472 427ns 1.86ns 6.96ns 0.0569 0 0 361 B
master BodyExtractorSimpleBody netcoreapp3.1 449ns 1.64ns 6.35ns 0.00375 0 0 272 B
master BodyExtractorMoreComplexBody net472 24.9μs 141ns 990ns 1.19 0.0121 0 7.62 KB
master BodyExtractorMoreComplexBody netcoreapp3.1 20.9μs 67.8ns 280ns 0.0921 0 0 6.75 KB
#2606 AllCycleSimpleBody net472 317ns 1.4ns 5.23ns 0.0659 0 0 417 B
#2606 AllCycleSimpleBody netcoreapp3.1 453ns 1.81ns 6.52ns 0.00566 0 0 416 B
#2606 AllCycleMoreComplexBody net472 316ns 1.51ns 5.83ns 0.0622 0 0 393 B
#2606 AllCycleMoreComplexBody netcoreapp3.1 433ns 2.53ns 22.9ns 0.00532 0 0 392 B
#2606 BodyExtractorSimpleBody net472 448ns 1.73ns 6.23ns 0.0568 0 0 361 B
#2606 BodyExtractorSimpleBody netcoreapp3.1 442ns 1.3ns 5.02ns 0.00379 0 0 272 B
#2606 BodyExtractorMoreComplexBody net472 24.5μs 119ns 492ns 1.18 0.0125 0 7.62 KB
#2606 BodyExtractorMoreComplexBody netcoreapp3.1 21.2μs 92.2ns 357ns 0.0943 0 0 6.75 KB
Benchmarks.Trace.AspNetCoreBenchmark - Same speed ✔️ Same allocations ✔️

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 302μs 1.5μs 6.18μs 0.146 0 0 19.74 KB
#2606 SendRequest net472 0ns 0ns 0ns 0 0 0 0 b
#2606 SendRequest netcoreapp3.1 319μs 1.2μs 4.66μs 0.158 0 0 19.74 KB
Benchmarks.Trace.DbCommandBenchmark - Slower ⚠️ Same allocations ✔️

Slower ⚠️ in #2606

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.DbCommandBenchmark.ExecuteNonQuery‑net472 1.327 1,760.72 2,335.94 bimodal

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master ExecuteNonQuery net472 1.76μs 8.4ns 32.5ns 0.0937 0 0 594 B
master ExecuteNonQuery netcoreapp3.1 1.51μs 7.25ns 28.1ns 0.00903 0 0 632 B
#2606 ExecuteNonQuery net472 2.34μs 13.7ns 124ns 0.094 0.00116 0 594 B
#2606 ExecuteNonQuery netcoreapp3.1 1.47μs 4.71ns 18.2ns 0.00873 0 0 632 B
Benchmarks.Trace.ElasticsearchBenchmark - Slower ⚠️ Same allocations ✔️

Slower ⚠️ in #2606

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch‑netcoreapp3.1 1.136 1,770.64 2,011.31

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master CallElasticsearch net472 2.66μs 13.4ns 59.9ns 0.126 0 0 803 B
master CallElasticsearch netcoreapp3.1 1.78μs 8.42ns 34.7ns 0.0115 0 0 792 B
master CallElasticsearchAsync net472 3.21μs 14.4ns 55.6ns 0.148 0.00156 0 939 B
master CallElasticsearchAsync netcoreapp3.1 1.92μs 10.3ns 51.3ns 0.0122 0 0 912 B
#2606 CallElasticsearch net472 2.57μs 13.7ns 73.7ns 0.127 0 0 803 B
#2606 CallElasticsearch netcoreapp3.1 2.02μs 11.5ns 79.9ns 0.0106 0 0 792 B
#2606 CallElasticsearchAsync net472 3.06μs 14.6ns 61.8ns 0.148 0.00151 0 939 B
#2606 CallElasticsearchAsync netcoreapp3.1 1.91μs 10.6ns 67.1ns 0.0128 0 0 912 B
Benchmarks.Trace.GraphQLBenchmark - Slower ⚠️ Same allocations ✔️

Slower ⚠️ in #2606

Benchmark diff/base Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync‑netcoreapp3.1 1.249 2,001.94 2,500.80

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master ExecuteAsync net472 2.92μs 13.8ns 55.2ns 0.168 0 0 1.06 KB
master ExecuteAsync netcoreapp3.1 2.01μs 9.3ns 36ns 0.0141 0 0 1.03 KB
#2606 ExecuteAsync net472 2.99μs 15.3ns 70ns 0.168 0.00147 0 1.06 KB
#2606 ExecuteAsync netcoreapp3.1 2.51μs 9.16ns 33ns 0.0146 0 0 1.03 KB
Benchmarks.Trace.HttpClientBenchmark - Faster 🎉 Same allocations ✔️

Faster 🎉 in #2606

Benchmark base/diff Base Median (ns) Diff Median (ns) Modality
Benchmarks.Trace.HttpClientBenchmark.SendAsync‑netcoreapp3.1 1.153 5,494.95 4,767.50

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master SendAsync net472 7.05μs 37.8ns 207ns 0.361 0 0 2.28 KB
master SendAsync netcoreapp3.1 5.47μs 23.4ns 90.6ns 0.0328 0 0 2.21 KB
#2606 SendAsync net472 6.67μs 34.2ns 153ns 0.362 0 0 2.28 KB
#2606 SendAsync netcoreapp3.1 4.78μs 18.9ns 73.3ns 0.0311 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.58μs 18.1ns 95.9ns 0.227 0 0 1.45 KB
master EnrichedLog netcoreapp3.1 3.25μs 16.7ns 80.1ns 0.0207 0 0 1.53 KB
#2606 EnrichedLog net472 3.29μs 14.6ns 54.5ns 0.228 0 0 1.45 KB
#2606 EnrichedLog netcoreapp3.1 3.09μs 15.1ns 62.2ns 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 289μs 1.04μs 4.42μs 0.434 0.145 0 4.33 KB
master EnrichedLog netcoreapp3.1 226μs 988ns 3.7μs 0 0 0 4.21 KB
#2606 EnrichedLog net472 287μs 1.41μs 5.98μs 0.416 0.139 0 4.33 KB
#2606 EnrichedLog netcoreapp3.1 230μs 1.14μs 4.72μ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 7.45μs 30.7ns 119ns 0.504 0 0 3.23 KB
master EnrichedLog netcoreapp3.1 6.62μs 31.4ns 122ns 0.0513 0 0 3.6 KB
#2606 EnrichedLog net472 7.55μs 36.2ns 140ns 0.504 0 0 3.23 KB
#2606 EnrichedLog netcoreapp3.1 6.84μs 38.6ns 273ns 0.0517 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.54μs 13.8ns 79.5ns 0.16 0.00124 0 1.01 KB
master SendReceive netcoreapp3.1 2.23μs 11.6ns 59ns 0.0135 0 0 1.01 KB
#2606 SendReceive net472 2.49μs 13.9ns 90ns 0.158 0 0 1.01 KB
#2606 SendReceive netcoreapp3.1 2.03μs 6.06ns 21.9ns 0.0147 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 5.93μs 28.7ns 118ns 0.291 0 0 1.87 KB
master EnrichedLog netcoreapp3.1 5.17μs 24.1ns 93.4ns 0.0204 0 0 1.49 KB
#2606 EnrichedLog net472 6.06μs 28ns 140ns 0.292 0 0 1.87 KB
#2606 EnrichedLog netcoreapp3.1 5.26μs 19.5ns 75.7ns 0.0208 0 0 1.49 KB
Benchmarks.Trace.SpanBenchmark - Same speed ✔️ Same allocations ✔️

Raw results

Branch Method Toolchain Mean StdError StdDev Gen 0 Gen 1 Gen 2 Allocated
master StartFinishSpan net472 905ns 3.48ns 13ns 0.0719 0 0 457 B
master StartFinishSpan netcoreapp3.1 899ns 3.69ns 14.3ns 0.00635 0 0 456 B
master StartFinishScope net472 1.1μs 5.51ns 23.4ns 0.0842 0 0 538 B
master StartFinishScope netcoreapp3.1 1.13μs 6.46ns 45.2ns 0.00778 0 0 576 B
#2606 StartFinishSpan net472 906ns 4.34ns 17.4ns 0.0716 0 0 457 B
#2606 StartFinishSpan netcoreapp3.1 891ns 4.28ns 16.6ns 0.00623 0 0 456 B
#2606 StartFinishScope net472 1.2μs 6.65ns 40.4ns 0.0845 0 0 538 B
#2606 StartFinishScope netcoreapp3.1 1.04μs 4.14ns 16ns 0.00761 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.31μs 6.4ns 27.1ns 0.0839 0 0 538 B
master RunOnMethodBegin netcoreapp3.1 1.24μs 6.61ns 35.6ns 0.00784 0 0 576 B
#2606 RunOnMethodBegin net472 1.25μs 6.47ns 29.6ns 0.084 0 0 538 B
#2606 RunOnMethodBegin netcoreapp3.1 1.19μs 5.16ns 20ns 0.00826 0 0 576 B

@zacharycmontoya
zacharycmontoya merged commit 5df80e1 into master Apr 20, 2022
@zacharycmontoya
zacharycmontoya deleted the zach/trace-methods-attribute branch April 20, 2022 16:03
@github-actions github-actions Bot added this to the vNext milestone Apr 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:native-library Automatic instrumentation native C++ code (Datadog.Trace.ClrProfiler.Native)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants