Open finira opened 7 years ago
I'm afraid that can't be done. The getMetrics
method on a MetricSet
is only ever invoked once. What you need to do is get a reference to the MetricRegistry
and then replace the body of the increase
method with the code: MetricRegistry.counter(key).inc();
.
Thank you. that means I should init my map before getMetrics
it works MetricRegistry.counter(key).inc();
thanks a lot
I make the simple xml spring config like this:
register a set class TheSets implements the MetricSet,the class is like this:
and I invoke the increase method in another class , just like
TheSets.increase("cc");
. this works. but ,when I want to invoke the method with another arg , which likeTheSets.increase("dd");
. the result is I can't get the counter named with "dd",it seems like theput
method onmetricMap
only works in thegetMetrics
method. now I need to put some dynamic keys in the map, how can I make it? @ryantenney thank you .