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

Hikaricp: Avoid registering duplicate metrics #6325

Merged
merged 4 commits into from
Jul 15, 2022

Conversation

laurit
Copy link
Contributor

@laurit laurit commented Jul 14, 2022

setMetricsTrackerFactory may be called multiple times which will cause us to report the same metrics multiple times which causes warnings

[otel.javaagent 2022-07-14 21:03:38:958 +0300] [Thread-0] WARN io.opentelemetry.sdk.metrics.internal.state.AsynchronousMetricStorage - Instrument db.client.connections.usage has recorded multiple values for the same attributes.

Such warnings can be seen for example when running spring petclinic.
Calling close as done in this pr is not completely safe as besides calling close on our wrapper it will call close on the underlying object for which it would not be called when running without the agent.

@laurit laurit requested a review from a team July 14, 2022 20:03
laurit and others added 2 commits July 15, 2022 00:49
…lemetry/javaagent/instrumentation/hikaricp/HikariPoolInstrumentation.java

Co-authored-by: Trask Stalnaker <[email protected]>
@laurit laurit merged commit b3e543d into open-telemetry:main Jul 15, 2022
@laurit laurit deleted the hikari-duplicate branch July 15, 2022 06:59
LironKS pushed a commit to helios/opentelemetry-java-instrumentation that referenced this pull request Oct 23, 2022
* Hikaricp: Avoid registering duplicate metrics

* Update instrumentation/hikaricp-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hikaricp/HikariPoolInstrumentation.java

Co-authored-by: Trask Stalnaker <[email protected]>

* spotless

* Trigger build

Co-authored-by: Trask Stalnaker <[email protected]>
LironKS pushed a commit to helios/opentelemetry-java-instrumentation that referenced this pull request Oct 31, 2022
* Hikaricp: Avoid registering duplicate metrics

* Update instrumentation/hikaricp-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hikaricp/HikariPoolInstrumentation.java

Co-authored-by: Trask Stalnaker <[email protected]>

* spotless

* Trigger build

Co-authored-by: Trask Stalnaker <[email protected]>
LironKS pushed a commit to helios/opentelemetry-java-instrumentation that referenced this pull request Dec 4, 2022
* Hikaricp: Avoid registering duplicate metrics

* Update instrumentation/hikaricp-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hikaricp/HikariPoolInstrumentation.java

Co-authored-by: Trask Stalnaker <[email protected]>

* spotless

* Trigger build

Co-authored-by: Trask Stalnaker <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants