Skip to main content
This guide shows you how to instrument an ASP.NET Core application and send traces from Checkly-triggered requests to Checkly. For other .NET application types and instrumentation libraries, refer to the OpenTelemetry .NET documentation.
  • A .NET application that receives requests from a Checkly check.
  • An OTel API key and endpoint from the OpenTelemetry Integration page in the Checkly app.

Install OpenTelemetry packages

Install the OpenTelemetry SDK, OTLP exporter, and ASP.NET Core instrumentation:
Terminal
To trace outgoing HttpClient requests as part of the same trace, also install the HTTP client instrumentation:
Terminal

Add the Checkly sampler

Create ChecklySampler.cs in your project:
ChecklySampler.cs
Checkly adds checkly=true to the W3C tracestate header on requests from its checks. This sampler records only traces that carry that value, so your application exports Checkly-triggered traces rather than all application traffic.

Configure tracing

Register the sampler, the ASP.NET Core instrumentation, and the OTLP exporter in Program.cs:
Program.cs
Remove .AddHttpClientInstrumentation() if you did not install OpenTelemetry.Instrumentation.Http.

Set Checkly connection details

Configure the OTLP exporter with standard OpenTelemetry environment variables. Use the endpoint for your Checkly region from the OpenTelemetry Integration page.
Terminal
The .NET OTLP exporter uses gRPC by default. Set OTEL_EXPORTER_OTLP_PROTOCOL to http/protobuf to send traces to the Checkly HTTP endpoint. Keep the API key outside source control. Configure it through your deployment environment or secret manager.

Verify the integration

Start your application, then run a Checkly check that calls it. The check-triggered request and its downstream spans should appear with the check result in Checkly. For more information about how Checkly correlates check results and traces, see How Traces work.