-
Notifications
You must be signed in to change notification settings - Fork 65
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
make it easy to enable/disable specific metrics through config #686
Comments
IIUC the Spring implementation disables the transmission of the data for affected meters. Here is their description of the meaning of
(emphasis mine) I have not looked at the source, but I presume a "disabled" meter still resides in a We should be very clear what MP metrics means by a "disabled" MP metric. Is it merely "silent" with respect to output via |
@donbourne @tjquinno So for MP Metrics, we would similarly say that the metric will be denied registration (will not exist in the MP |
One concern about this approach: An app might be written to query the registry for a given metric (using One could argue that the code should be written to tolerate this change in behavior, but that would complicate the application code at every attempted retrieval of a metric from the registry. Ultimately, this all comes down to what we actually want to mean--and being very clear about it--by "disabled." |
For 5.1 if we mention that that "disabled" implies non-registration or rather denied registration and that it would not exist in the MP Metric registry, would that not be a complete explanation? |
Yes, it would be, but I want us to be sure of what behavior we want before we work on the phrasing to describe it. To me, the denied registration approach seems less developer-friendly as I tried to illustrate earlier. Consider this code: Counter c = metricRegistry.counter("myCounter");
Counter retrievedC = metricRegistry.getCounter("myCounter"); If we adopt the denied-registration behavior, then either: In choice 1, the developer needs to anticipate that the metric could be disabled and, therefore, with the denied registration approach, be able to deal with a In choice 2, to honor the contract of Another approach would be for the registry implementation to be fully functional (registrations, retrievals, removals all work) but the metrics returned would be no-ops when disabled. This allows the code to be written according to the existing API contracts. Put another way, only the disabled metrics themselves would be disabled; the registry(ies) themselves would be fully functional and conform to the contracts in the API. We might conclude that these types of scenarios--an app registration and then retrieving the same metric from the registry later--are rare enough to be less important than compatibility with SpringBoot's behavior. I just want us to be sure we're going through that thought process and choosing carefully the behavior we want. |
To add to the conversation... As @donbourne mentioned earlier, using a Micrometer filter to implement disabling has the effect of denying registration. And that's a simple (and fairly natural) implementation in a Micrometer environment, but the spec needs to prescribe consistent behavior regardless of the underlying implementation choices. With that in mind, if we adopt this approach we should be sure that the JavaDoc for each "get-or-create" method on
|
Spring has concept of enabling metrics through config: https://docs.spring.io/spring-boot/docs/2.0.x/reference/html/production-ready-metrics.html#_per_meter_properties . Seems worthwhile to have a way to do this (both Oracle and Liberty MicroProfile Metrics impls have concepts for this we've had to impl outside of the basic requirements of the spec.
we should be able to use MP config to enable/disable certain metrics
The text was updated successfully, but these errors were encountered: