-
Notifications
You must be signed in to change notification settings - Fork 449
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
Is it a good practice to define constant strings to a listener? #666
Comments
I'll confess Micrometer isn't my first choice for a metrics library and am not as familiar with some of the details as I'd like to be. That said, in other similar systems, the approach would be to register all of these metrics within some other category. Using a completely made-up API: final MetricRegistry pushNotificationMetrics =
new MetricRegistry("push.notification.custom.prefix.you.get.the.idea");
pushNotificationMetrics.registerAll(metricsFromPushy); …then you'd wind up with metrics with names like |
You're right about constructing a new That may seem like a duplication of code for some reason, though I could not find such way to do that, alternatively. |
Could you get away with a |
I could not assert it is safer, but it is simpler indeed. In my case, a prefix would be more than okay. Should you we implement this in #667? This looks like a v14.0 feature. |
You meant this API? |
I was actually thinking |
Using the If possible I would go with the approach to pass a prefix to the Have a look at this for example:
There are more examples from Spring Boot, but my goal is to show that only the ones from Pushy are not that descriptive. If there was |
I've added a |
In file MicrometerApnsClientMetricsListener.java, the names for the metrics are defined with constant strings. Should we follow up with a cleaner approach, perhaps using messages from a
ResourceBundle
, or at least providing a way to override those fields with aMap<String, String>
, given in constructor (or anywhere)?I would like to organize metrics like Spring Boot does, such as
jvm.memory...
ortomcat.threads...
. It is not easy to infer the context fromnotifications.failed
.I can shoot a pull request, maybe try it on my way. Any thoughts?
The text was updated successfully, but these errors were encountered: