-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Add Prefix Support for Metric Names in CacheMeterBinder #4047
Comments
Hey @fartzy, |
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed. |
I think this is similar to the issue we had with That would still leave the strict naming convention concern. I'm not familiar with this in Artemis so I can't speak to it specifically. I understand the desire for say Artemis metrics to come under an On the suggestion for So I think that leaves us with: Artemis (or other libraries in their position) should copy CacheMeterBinder code to change the meter names used, or we should allow a prefix to be specified as suggested. If we resolved #877, that would take away significant reason to go with the prefix option. In the absence of resolution on #877, it feels more necessary we allow prefixing. |
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed. |
I am going to try to checkout MeterFilter and see if it can be used. I'm not sure just by reading the code if it will be work properly for what is being done with Artemis though. Is there any more thought given to what @shakuzen said though? |
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed. |
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open. |
Please describe the feature request.
I would like to modify the CacheMeterBinder abstract class to support prefixing metric names. As of now, the metric names are hard coded when the metrics are created in the
public final void bindTo(MeterRegistry registry)
method and then registered. Specifically, I propose adding a methodgetMetricNamePrefix()
which returns a prefix string that can be added to the front of all metric names in - which will be in modifying thebindTo()
method. This allows for better customization and adaptability in various system settings.Rationale
Without the proposed feature, it is impossible to rename metrics without deleting the existing cache metrics in the
bindImplementationSpecificMetrics()
method and re-registering them with new, prefixed names. This capability is particularly useful for specialized systems like ActiveMQ-Artemis, which adhere to unique metric naming conventions. For instance, these cache metrics could be applied to the authorization and authentication caches utilized for access control within the message broker. Deleting, recreating, and re-registering metrics is an inefficient way to align metric names. As such, the ability to add prefixes to metrics is essential for the seamless integration of Micrometer's cache metrics with ActiveMQ-Artemis or any other systems that prefer strict naming conventions for metrics. This feature would eliminate the need to delete and re-register cache metrics, thereby simplifying cache metric management.Additional context
Backwards Compatibility: This change is backward compatible because the default prefix is an empty string. This ensures that, by default, the existing metric names will not change, effectively appending an empty string to the current metric name.
Test Coverage: I have also added a
CacheMetricsBehaviorTest
class to verify this new functionality.Customization: This feature enhances Micrometer's flexibility by allowing users to define custom metric name prefixes for cache metrics which can be particularly useful in enterprise or specialized settings.
The text was updated successfully, but these errors were encountered: