-
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
support of dynamic tags where the value can change during runtime #2223
Comments
I'd love to have such a feature as well. Because unfortunately the |
@jackhammer2k Where this gets really complicated is Micrometer maintains an internal map of which meters have already been registered, so if you repeatedly call With dynamic tagging, there is this problem that what was previously two meters suddenly becomes one (e.g. a dynamically determined tag key So the implementation isn't so straightforward. Open to ideas. |
@jkschneider Well the key itself will be static in @jackhammer2k 's proposal. It's just the value that changes. |
I'm curious to understand more of these use cases. What kind of dynamic value common tags are you using? |
Thanks for having a look, Tommy. We have some meta data for each and every request as request headers, which we want to add as tags to each and every metric. We also already utilize the We even want it for third party libraries, which create timers and counters themselves, like resilience4j does. But resilience4j does not offer any extension to add dynamic/additional tags either. See https://github.com/resilience4j/resilience4j Another point is that the mentioned meta data is quite new, which means that we would need to touch each and every existing counter and timer in our code, which would be a huge amount of effort compared to having dynamic common tags, which we could simply apply for each and every metric. Does this answer your question Tommy? Not sure whether also @jackhammer2k also want's to share his reason why he wants to have dynamic tag values. |
Sounds like @SimonScholz usecase would need those dynamic tags calculated based on the current thread, since values would be different between requests. Would a MeterFilter that does that dynamic lookup suffice? |
Let me check whether I can utilize a |
So MeterFilter also offers the ability to change common tags dynamically, interesting. If I understand it right the difference between the approaches is:
|
As I explained in my initial post we have several instances but just one of them is the leader. The leader is dynamically elected during runtime and can change during runtime. In our Grafana dashboard we're only interested in the metrics of the leader at each specific point in time. I see several solutions there:
Every approach has some drawbacks. I also like 6. which is quite simple as long as there is not a mix of leader-specific-metrics and common ones. However in my opinion 4. fits better into the general concept. |
I am happy to see this going on the backlog, as we would like to tag metrics with enabled feature flags, so we can observe the progressive delivery of features in a multi-tenant system. |
Hi guys,
Here, I will be calling meterRegistry.counter for every increment of the counter. |
Is this feature commited? I‘ve met the same scenario processing dynamic tag values; |
I have a feature request for dynamic tag value evaluation. Currently the values of tags must be specified at creation time. However there are cases where they change during runtime. Specifically in my case I want to identify the leader of several instances with a tag. I want to add that tag as a common tag, because it applies to all meters. Because the tag value can change during runtime I cannot specify it as common tag at creation time.
I'm thinking about something like this:
I would also try to implement that feature, but before I want to be sure it has good chances to be integrated.
The text was updated successfully, but these errors were encountered: