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

Unable to produce db.client.operation.duration metrics #12972

Closed
cyrille-leclerc opened this issue Dec 27, 2024 · 2 comments
Closed

Unable to produce db.client.operation.duration metrics #12972

cyrille-leclerc opened this issue Dec 27, 2024 · 2 comments
Labels
bug Something isn't working needs triage New issue that requires triage

Comments

@cyrille-leclerc
Copy link
Member

cyrille-leclerc commented Dec 27, 2024

Describe the bug

Unable to produce db.client.operation.duration metrics that are supposed to be introduced in opentelemetry-jva-instrumentation v2.11 through #12806 .
None of export OTEL_SEMCONV_STABILITY_OPT_IN=database and -Dotel.semconv-stability.opt-in=database works to enable this metric.

Steps to reproduce

  • Use a demo java jdbc app like https://github.com/cyrille-leclerc/my-shopping-cart/tree/5a8839e7ca376d43097625f176277da294a1f996/frontend (startup command here)
  • Instrument the application with otel-java-instrumentation v2.11 and send metrics to a backend like Prometheus
  • Activate new OTel DB metrics with any of -Dotel.semconv-stability.opt-in=database and export OTEL_SEMCONV_STABILITY_OPT_IN=database
  • Start the application and generate traffic
  • Verify that
    • some DB client spans are produced
    • the otel instrumentation version is v2.11, for xample looking at the resource attribute telemetry.distro.version=2.11.0 on the spans

Expected behavior

The histogram metric db.client.operation.duration is produced.

Actual behavior

The metric db.client.operation.duration is missing.

Other db.client.* metrics are available: db.client.connections.create_time (histogram in ms), db.client.connections.idle.min (gauge), db.client.connections.pending_requests (gauge), db.client.connections.use_time (histogram in ms), db.client.connection.wait_time (histogram in ms)

Javaagent or library instrumentation version

v2.11.0

Environment

JDK:

OpenJDK Runtime Environment 17.0.13+0

OS:
MacOS 15.2

Additional context

cc @zeitlinger

@cyrille-leclerc cyrille-leclerc added bug Something isn't working needs triage New issue that requires triage labels Dec 27, 2024
@jaydeluca
Copy link
Member

i haven't had a chance to run your reproducer to validate that this fixes it, but I noticed that you are setting the -Dotel.semconv-stability.opt-in flag twice, once on line 150 and then again on line 156, and the one on line 156 doesn't include the database opt-in.

@cyrille-leclerc
Copy link
Member Author

Great catch @jaydeluca , thank you very much. My config was wrong with an invalid second declaration of -Dotel.semconv-stability.opt-in

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 triage New issue that requires triage
Projects
None yet
Development

No branches or pull requests

2 participants