extend and refactor prometheus metrics #1850
Closed
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.
For our internal Traefik setup I was working on improving the Prometheus metrics and wanted to upstream my work, as I guess this is potentially useful for a lot of Traefik users. It is planned to integrate more metrics in the future, but this PR already restructures the metrics implementation and provides significant benefits when monitoring Traefik with Prometheus. For more metrics follow-up PRs will be smaller and more focused. It is important to note that in this rework, the metric naming was adapted in order to fix #1759 and to be more consistent. As the metrics implementation is in a rather young state, I had the feeling this is the right time to go for removing inconsistencies.
In general the following metrics are now available. Please check the code for details including the metric labels.
In the course of extending the metrics I did some design reworks:
Metrics
interface to one big interface. Even though this might not be the most idiomatic way in go, it makes it sufficiently easier for other potential future implementations to provide a "full" metrics implementation. Also theVoidMetrics
and the general handling in theserver.go
is much easier through this.VoidMetrics
implementation to remove the necessity to check for nil on the consumer side.