Use this chapter to choose outbound telemetry packages and Prometheus integration options.

Publisher packages

Install one or more publisher packages alongside the dependency checks you already registered.

Install-Package DotNetDiag.HealthChecks.Publisher.ApplicationInsights
Install-Package DotNetDiag.HealthChecks.Publisher.CloudWatch
Install-Package DotNetDiag.HealthChecks.Publisher.Datadog
Install-Package DotNetDiag.HealthChecks.Publisher.Prometheus
Install-Package DotNetDiag.HealthChecks.Publisher.Seq

Add publishers to the builder

services
    .AddHealthChecks()
    .AddSqlServer(connectionString: Configuration["ConnectionStrings:sample"])
    .AddCheck<RandomHealthCheck>("random")
    .AddApplicationInsightsPublisher()
    .AddCloudWatchPublisher()
    .AddDatadogPublisher("myservice.healthchecks")
    .AddPrometheusGatewayPublisher();

Use the push model when your monitoring destination expects the application to emit health state changes rather than scrape an endpoint.

Prometheus exporter

If you need Prometheus to scrape metrics directly, use DotNetDiag.HealthChecks.Prometheus.Metrics instead of the gateway package.

Install-Package DotNetDiag.HealthChecks.Prometheus.Metrics
app.UseHealthChecksPrometheusExporter();
app.UseHealthChecksPrometheusExporter("/my-health-metrics");
app.UseHealthChecksPrometheusExporter(
    "/my-health-metrics",
    options => options.ResultStatusCodes[HealthStatus.Unhealthy] = (int)HttpStatusCode.OK);

Operational notes