Skip to content
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

kafka_consumer_commit_sync_time_ns: duplicate metric name #10289

Closed
lichenglin opened this issue Jan 19, 2024 · 7 comments · Fixed by #10394
Closed

kafka_consumer_commit_sync_time_ns: duplicate metric name #10289

lichenglin opened this issue Jan 19, 2024 · 7 comments · Fixed by #10394
Labels
bug Something isn't working needs repro needs triage New issue that requires triage

Comments

@lichenglin
Copy link

Describe the bug

I have a java spring boot project. it use spring-kafka library to send kafka message.

when I upgrade agent version from 1.x to 2.0 .

got error message in promethues exporter.

An Exception occurred while scraping metrics: java.lang.IllegalArgumentException: kafka_consumer_commit_sync_time_ns: duplicate metric name

but when I disable kafka moudule by set env

OTEL_INSTRUMENTATION_KAFKA_ENABLED=false, it works,

seems there is a confilict in spring-kafka and kafka-client moudules

Steps to reproduce

create a spring boot project , add env

JAVA_TOOL_OPTIONS="-javaagent:opentelemetry-javaagent.jar";OTEL_LOGS_EXPORTER=logging;OTEL_METRICS_EXPORTER=prometheus;OTEL_TRACES_EXPORTER=jaeger ;SPRING_PROFILES_ACTIVE=local

Expected behavior

http endpiont return 200

Actual behavior

http endpiont return 500

Javaagent or library instrumentation version

2.0

Environment

JDK: 17
OS: linux

Additional context

No response

@lichenglin lichenglin added bug Something isn't working needs triage New issue that requires triage labels Jan 19, 2024
@laurit
Copy link
Contributor

laurit commented Jan 19, 2024

Please provide a minimal application that reproduces the issue along with instructions needed to reproduce.

@laurit laurit added needs author feedback Waiting for additional feedback from the author needs repro labels Jan 19, 2024
@lichenglin
Copy link
Author

yunwei-spring-demo.zip

Please provide a minimal application that reproduces the issue along with instructions needed to reproduce.

@github-actions github-actions bot removed the needs author feedback Waiting for additional feedback from the author label Jan 19, 2024
@laurit
Copy link
Contributor

laurit commented Jan 19, 2024

yunwei-spring-demo.zip

Please provide a minimal application that reproduces the issue along with instructions needed to reproduce.

What do I have to do with the test app to reproduce the issue? Do I have to run kafka? Something else?

@laurit laurit added the needs author feedback Waiting for additional feedback from the author label Jan 19, 2024
@lichenglin
Copy link
Author

yunwei-spring-demo.zip

Please provide a minimal application that reproduces the issue along with instructions needed to reproduce.

What do I have to do with the test app to reproduce the issue? Do I have to run kafka? Something else?

  1. deploy a kafka at localhost.
  2. run mvn -DskipTests=true clean package
  3. run java -D"otel.metrics.exporter"=prometheus -D"spring.proifles.active"=dev -javaagent:opentelemetry-javaagent-2.0.0.jar -jar target/yunwei-spring-demo-0.0.1-SNAPSHOT.jar
  4. visite http://127.0.0.1:9464/
  5. get error
    An Exception occurred while scraping metrics: java.lang.IllegalArgumentException: kafka_consumer_commit_sync_time_ns: duplicate metric name

@github-actions github-actions bot removed the needs author feedback Waiting for additional feedback from the author label Jan 22, 2024
@laurit
Copy link
Contributor

laurit commented Jan 22, 2024

Kafka metrics are reported by both kafka clients instrumentation and spring boot actuator instrumentation. You'll have to disable one of them. Try adding -Dotel.instrumentation.kafka-clients-metrics.enabled=false or -Dotel.instrumentation.spring-boot-actuator-autoconfigure.enabled=false.
@zeitlinger should we also disable the actuator instrumentation by default?

@zeitlinger
Copy link
Member

Kafka metrics are reported by both kafka clients instrumentation and spring boot actuator instrumentation. You'll have to disable one of them. Try adding -Dotel.instrumentation.kafka-clients-metrics.enabled=false or -Dotel.instrumentation.spring-boot-actuator-autoconfigure.enabled=false. @zeitlinger should we also disable the actuator instrumentation by default?

Yes, that was actually the intention of disabling micrometer - I didn't realize that there are other ways to get spring boot related metrics.
Maybe we should even consider this a bug fix for 2.0.0?

@trask
Copy link
Member

trask commented Jan 23, 2024

Maybe we should even consider this a bug fix for 2.0.0?

I would support that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs repro needs triage New issue that requires triage
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants