-
Notifications
You must be signed in to change notification settings - Fork 41.2k
More flexible contract for PublicMetrics #1094
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
Comments
This commit permits the use of several PublicMetrics instances by default. Previously, only one PublicMetrics service could be specified and a user configuration would remove all the defaulting. VanillaPublicMetrics now takes a collection of PublicMetrics and invokes them in sequence to build the final collection of metrics. The system-related metrics have been moved to SystemPublicMetrics and are registered by default. Also updated the documentation to mention this feature and how it could be fully overridden. Fixes spring-projectsgh-1094
👍 Another example would be to contribute metrics from a MetricsRegistry, in cases where one uses Codahale Metrics or even Ryan Tenney's metrics-spring. We currently extend the MetricsEndpoint to merge PublicMetrics with a MetricRegistry which doesn't feel like the best way. |
I didn't thought of that one. Nice! So you confirm this works fine for you? (in theory I mean, unless you pulled my branch to try) |
I didn't have a chance to test your implementation, but I will and leave a note here. |
Awesome, thanks! |
Rework flexible PublicMetrics registration introduced in 2be6b3e to restore compatibility with v1.1 VanillaPublicMetrics. The new MetricReaderPublicMetrics class now exposes metrics from a MetricReader and VanillaPublicMetrics is deprecated. The MetricsEndpoint can now exposes a collection of PublicMetric interface directly. See gh-1094
The current approach for
PublicMetrics
is to locate a bean of that type and request its metrics every time the health endpoint is invoked.This does not allow for others to contribute metrics. A typical example is #1013 where I would have to add these to the only
PublicMetrics
implementation we have.Instead we should create a composite and locale all instances by default. Of course, a user may redefine that special bean by name to override this behaviour.
The text was updated successfully, but these errors were encountered: