-
Notifications
You must be signed in to change notification settings - Fork 130
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
Sample Groovy yields "Found duplicate metric definition" #222
Comments
This appears to be introduced by open-telemetry/opentelemetry-java#4020 where there used to be a silent getOrCreate-like behavior. The underlying callback is updated w/ the most recent value via the proxied observer so no data loss should occur but the warning is distracting. The api is relatively in flux (open-telemetry/opentelemetry-java#4143) but we'll likely need to introduce another registry system for the |
We're hoping to not need any registries of async callbacks anymore. @jack-berg would be good to check on this and make sure it works smoothly with all the identity changes. |
@anuraaga given https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/api.md#instrument-type-conflict-detection I think this is a symptom of the jmx-metric gatherer's groovy script running pattern that builds the declared instruments with every interval being at odds with the metric api for both sync and async. This has been the case for a while so having a |
@rmfitzpatrick They have the same identity though right? Also we can close instruments between runs now perhaps so I think there is a way to work without the cache. If there isn't, I want us to get there instead of bothering users with unrelated error messages. |
They're the same instruments in all cases and would be cached by their descriptor. The spec suggests to me that our current approach isn't supported without caching on the gatherer's end since there are conflicting registrations and a warning should be emitted. As a user I'd prefer this not be the case but can see it either way. |
If I understand correctly this should be resolved with #4222. At this point:
|
@rkogelhe is this still an issue? |
This has been automatically marked as stale because it has been marked as needing author feedback and has not had any activity for 7 days. It will be closed if no further activity occurs within 7 days of this comment. |
Description
jmxmetrics using the sample groovy works correctly on the first collection.
On the second collection, we get:
`WARNING: Found duplicate metric definition: my.admin.response.count
at unknown source
To enable better debugging, run your JVM with -Dotel.experimental.sdk.metrics.debug=true
Causes
Original instrument registered with same name but is incompatible.
at unknown source
To enable better debugging, run your JVM with -Dotel.experimental.sdk.metrics.debug=true
io.opentelemetry.sdk.metrics.internal.state.DuplicateMetricStorageException: Async metric with same name has already been created. Found previous metric: MetricDescriptor{name=my.admin.response.count, description=Count of the number of responses from the admin console, unit=By, sourceView=Optional[View{name=null, description=null, aggregation=DefaultAggregation, attributesProcessor=io.opentelemetry.sdk.metrics.internal.view.AttributesProcessor$1@249c65fd, sourceInfo=INSTANCE}], sourceInstrument=InstrumentDescriptor{name=my.admin.response.count, description=Count of the number of responses from the admin console, unit=By, type=OBSERVABLE_GAUGE, valueType=LONG, sourceInfo=INSTANCE}}, cannot register metric: MetricDescriptor{name=my.admin.response.count, description=Count of the number of responses from the admin console, unit=By, sourceView=Optional[View{name=null, description=null, aggregation=DefaultAggregation, attributesProcessor=io.opentelemetry.sdk.metrics.internal.view.AttributesProcessor$1@249c65fd, sourceInfo=INSTANCE}], sourceInstrument=InstrumentDescriptor{name=my.admin.response.count, description=Count of the number of responses from the admin console, unit=By, type=OBSERVABLE_GAUGE, valueType=LONG, sourceInfo=INSTANCE}}
at io.opentelemetry.sdk.metrics.internal.state.MetricStorageRegistry.register(MetricStorageRegistry.java:75)
at io.opentelemetry.sdk.metrics.internal.state.MeterSharedState.register(MeterSharedState.java:139)
...`
Steps to reproduce
Clone opentelemetry-java-contrib and only build jmx-metrics (full build isn't working)
Run with
jmx_jar="./opentelemetry-java-contrib/jmx-metrics/build/libs/opentelemetry-jmx-metrics-1.11.0-SNAPSHOT.jar" java -Dotel.jmx.groovy.script=./my.groovy -jar $jmx_jar -config ./session.properties
where my.groovy is
def adminResponseTime = otel.mbean("my:name=adminResponseTime") otel.instrument( adminResponseTime, "my.admin.response.count", "Count of the number of responses from the admin console", "By", "Count", otel.&longValueCallback )
and session.properties is
otel.jmx.service.url = service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi otel.jmx.interval.milliseconds = 5000 otel.jmx.username = jmxuser otel.jmx.password = password
Expectation
I would expect an example groovy that works however many collections occur.
What applicable config did you use?
(see reproduction above)
Relevant Environment Information
Version: 1.11.0
OS: MacOS 10.15.7
Compiler: AdoptOpenJDK (build 11.0.10+9)
Additional context
Verified that my JMX mbean was working via jmx term and JConsole.
The text was updated successfully, but these errors were encountered: