This package contains the BenchmarkDotNet exporter and instrumentation for Datadog CI Visibility.
BenchmarkDotNet 0.13.2
and above
- Add the
Datadog.Trace.BenchmarkDotNet
NuGet package to your project, usingdotnet add package Datadog.Trace.BenchmarkDotNet
, for example. - Configure your project to use the Datadog.Trace.BenchmarkDotNet exporter, as described below
- Configure your CI provider to report via the Datadog Agent or agentless, as described in the documentation
- Run the benchmark project and check results on Datadog CI Test Visibility.
There's two way to configure a benchmark project to use the Datadog's exporter:
Add the DatadogDiagnoser
attribute to the benchmark class.
using BenchmarkDotNet.Attributes;
using Datadog.Trace.BenchmarkDotNet;
[DatadogDiagnoser]
[MemoryDiagnoser]
public class OperationBenchmark
{
[Benchmark]
public void Operation()
{
// ...
}
}
Use the WithDatadog()
extension method on the current project configuration:
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Running;
using Datadog.Trace.BenchmarkDotNet;
var config = DefaultConfig.Instance
.WithDatadog();
BenchmarkRunner.Run<OperationBenchmark>(config);
If you have questions, feedback, or feature requests, reach our support.