Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ForwardToPrometheus, create default gauge only if needed #444

Merged

Conversation

Christian-Schulz
Copy link
Contributor

The old help text was still published after changing the PublisherOptions in ForwardToPrometheus().

sample:

 services.AddHealthChecks()
   .AddCheck<OwnOracleDBHealthCheck>(OwnOracleDBHealthCheck.HealthCheckName)
   .ForwardToPrometheus(new PrometheusHealthCheckPublisherOptions()
   {
      //override default identifier 'aspnetcore_healthcheck_status'              
      Gauge = Metrics.CreateGauge("own_exporter_healthcheck_status", "Forwarded health check status (0 == Unhealthy, 0.5 == Degraded, 1 == Healthy)", "name")
   });

old output:

# HELP aspnetcore_healthcheck_status ASP.NET Core health check status (0 == Unhealthy, 0.5 == Degraded, 1 == Healthy)
# TYPE aspnetcore_healthcheck_status gauge
# HELP own_exporter_healthcheck_status Forwarded health check status (0 == Unhealthy, 0.5 == Degraded, 1 == Healthy)
# TYPE own_exporter_healthcheck_status gauge
own_exporter_healthcheck_status{name="OracleDBCheck"} 1

new output:

# HELP own_exporter_healthcheck_status Forwarded health check status (0 == Unhealthy, 0.5 == Degraded, 1 == Healthy)
# TYPE own_exporter_healthcheck_status gauge
own_exporter_healthcheck_status{name="OracleDBCheck"} 1

@sandersaares sandersaares merged commit 36b4750 into prometheus-net:master Dec 5, 2023
1 check was pending
@sandersaares
Copy link
Member

Good catch. Thanks for the contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants