ryantenney / metrics-spring

Spring integration for Metrics
http://www.ryantenney.com/metrics-spring/
Apache License 2.0
701 stars 226 forks source link

@Metric conflict with <metrics:register> configuration #161

Open bugcai opened 8 years ago

bugcai commented 8 years ago

I defined some metrics within <metrics:register> element in spring xml configuration. And I need these metrics to be injected into fields annotated with @Metric. But in fact, metrics-spring will create and register metrics using @Metric annotation before registering metrics defined within <metrics:register>. As a result, IllegalArgumentException("A metric named xxx already exists") was thrown when registering metrics defined within<metrics:register>.

Is there any way to give<metrics:register> higher precedence?

ryantenney commented 8 years ago

Interesting problem. Can you share what metrics you're registering with <metrics:register>, and what metrics you're injecting into fields with @Metric?