Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it:
Upgrades the Prometheus integration to use v3 of the
prometheus-net
library.This is the smallest amount of code needed to change in order to upgrade prometheus-net and keep everything in its current state.
To test it, I enabled the Prometheus metric endpoint in the
HealthChecks.Sample
project.There's a bit of weirdness in this project's integration into Prometheus - Instead of having its own separate endpoint that updates the metrics and returns them in Prometheus format, it should instead rely on the standard
/metrics
Prometheus endpoint exposed byendpoints.MapMetrics()
fromprometheus-net.AspNetCore
, and integrate into Prometheus by usingRegistry.AddBeforeCollectCallback
(so that Prometheus calls this library to update the metrics, rather than going the other way around). However, that can be done in a separate PR.Please reference the issue this PR will close:
Fixes #419
Special notes for your reviewer:
N/A
Does this PR introduce a user-facing change?:
This is a breaking change as v3 of prometheus-net is not API-compatible with v2. People just using
AspNetCore.Diagnostics.HealthChecks
without any customisations to Prometheus (eg. adding their own metrics) will be fine, but people that have deeper integrations into Prometheus will need to upgrade their own code to use the v3 API.Please make sure you've completed the relevant tasks for this PR, out of the following list: