Prerequisites
Prerequisites
- 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
HttpClient requests as part of the same trace, also install the HTTP client instrumentation:
Terminal
Add the Checkly sampler
CreateChecklySampler.cs in your project:
ChecklySampler.cs
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 inProgram.cs:
Program.cs
.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
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.