Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Setting the same gauge twice throws `java.lang.IllegalArgumentException` #2

Closed
ddossot opened this Issue · 4 comments

2 participants

@ddossot

Looking at http://metrics.codahale.com/manual/core/#gauges and the exception I'm getting when trying several calls to set, it seems the registration should only be done once and just the value should evolve over time.

Either this is expected and mod-metrics README should say it or a fix is needed. For example, by using a concurrent map to cache {gauge names => values} and register a unique gauge the reads from this map. set operations would update the map.

SEVERE: Exception in Java verticle
java.lang.IllegalArgumentException: A metric named Acme already exists
    at com.codahale.metrics.MetricRegistry.register(MetricRegistry.java:91)
    at com.bloidonia.vertx.metrics.MetricsModule.handle(MetricsModule.java:69)
    at com.bloidonia.vertx.metrics.MetricsModule.handle(MetricsModule.java:32)
    at org.vertx.java.core.eventbus.impl.DefaultEventBus$11.run(DefaultEventBus.java:935)
    at org.vertx.java.core.impl.DefaultContext$3.run(DefaultContext.java:176)
    at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:354)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:353)
    at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101)
    at java.lang.Thread.run(Thread.java:744)
@timyates
Owner

You're absolutely right, I'm working on a fix

@timyates timyates closed this issue from a commit
@timyates Allow gauges to be re-set (Fixes #2)
* Issue1:
  Added backing map for gauges
  Added failing test for re-setting a gauge
95e0fc5
@timyates timyates closed this in 95e0fc5
@timyates
Owner

v1.0.1 pushed to sonatype so should appear in maven central when the gods of maven determine it's time has come...

Thanks for pointing this out, hope the fix looks ok!

I need to add more testing...

@timyates
Owner

The planets have aligned, and it seems to be in maven central now, also submitted it to the module repository for addition.

Thanks again!

@ddossot

This works perfectly, thank you very much for the quick turnaround!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.