This sample runs a local OpenTelemetry Collector, Prometheus, and Grafana stack so you can see the value of the SLI library while running one of the sample applications.
From this directory:
docker compose up -dGrafana starts at http://localhost:3000 with anonymous admin access enabled for local development. The SLI dashboard is provisioned automatically under Dashboards > Trellis > Service Level Indicators.
In another terminal, run the Web API sample and point its OTLP exporter at the local collector:
$env:OTEL_EXPORTER_OTLP_ENDPOINT = "http://localhost:4317"
dotnet run --project ..\..\WebApi\SampleWebApplicationSLI.csprojGenerate traffic:
Invoke-RestMethod https://localhost:63936/WeatherForecast -SkipCertificateCheck
Invoke-RestMethod https://localhost:63936/WeatherForecast/MyAction1 -SkipCertificateCheck
Invoke-RestMethod https://localhost:63936/WeatherForecast/MyAction2 -SkipCertificateCheck
Invoke-RestMethod https://localhost:63936/WeatherForecast/my-customer-resource-id -SkipCertificateCheckYou can also run the Minimal API or API-versioned samples with the same OTEL_EXPORTER_OTLP_ENDPOINT environment variable.
The dashboard uses the SLI metric contract:
operation.durationhistogram exported to Prometheus asoperation_duration_milliseconds_*CustomerResourceIdLocationIdOperationOutcomehttp.request.methodhttp.response.status.code- optional
http.api.version
Panels include:
- request volume by operation and outcome
- p50/p95/p99 latency
- success rate using
Success / (Success + Failure) - failure and client-error rates
- HTTP status-code breakdown
- unknown customer diagnostics
<unrouted>operation detection
docker compose down