-
Notifications
You must be signed in to change notification settings - Fork 867
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
Implement HikariCP connection pool metrics #6003
Conversation
|
||
package io.opentelemetry.javaagent.instrumentation.hikaricp; | ||
|
||
import com.zaxxer.hikari.metrics.IMetricsTracker; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice - let's go ahead and add library instrumentation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mind if I do that in a separate PR? This one is not that small already, and it establishes some common code parts that might be used in other connection pill instrumentations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if the library instrumentation was contributed to Hikari iteself and lived alongside the dropwizard, micrometer, and prometheus implementations?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That could also work, probably.
The semantic conventions are not stable though, they could change in the future -- I wonder what kind of strategy we have for updating 3rd party libs when the telemetry changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Splitting library out in separate PR is fine too - that being said "establishes some common code parts that might be used in other connection pill instrumentations" makes it sound like other instrumentation might come before a split, which I wouldn't recommend ;)
The semantic conventions are not stable though, they could change in the future -- I wonder what kind of strategy we have for updating 3rd party libs when the telemetry changes.
Most stable libraries will be reluctant if not forbid having a dependency on an alpha module, our -semconv
module. I would probably keep upstream instrumentation off the table until the semconv is stable and part of our non-alpha artifact.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. I did make a couple observational comments tho.
...v/src/main/java/io/opentelemetry/instrumentation/api/metrics/db/DbConnectionPoolMetrics.java
Outdated
Show resolved
Hide resolved
...v/src/main/java/io/opentelemetry/instrumentation/api/metrics/db/DbConnectionPoolMetrics.java
Show resolved
Hide resolved
...v/src/main/java/io/opentelemetry/instrumentation/api/metrics/db/DbConnectionPoolMetrics.java
Show resolved
Hide resolved
...v/src/main/java/io/opentelemetry/instrumentation/api/metrics/db/DbConnectionPoolMetrics.java
Show resolved
Hide resolved
|
||
package io.opentelemetry.javaagent.instrumentation.hikaricp; | ||
|
||
import com.zaxxer.hikari.metrics.IMetricsTracker; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if the library instrumentation was contributed to Hikari iteself and lived alongside the dropwizard, micrometer, and prometheus implementations?
...in/java/io/opentelemetry/javaagent/instrumentation/hikaricp/OpenTelemetryMetricsTracker.java
Show resolved
Hide resolved
...in/java/io/opentelemetry/javaagent/instrumentation/hikaricp/OpenTelemetryMetricsTracker.java
Show resolved
Hide resolved
...in/java/io/opentelemetry/javaagent/instrumentation/hikaricp/OpenTelemetryMetricsTracker.java
Outdated
Show resolved
Hide resolved
} | ||
|
||
@Test | ||
void shouldNotBreakCustomUserMetrics() throws Exception { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏻 good to cover this!
point.hasAttributes( | ||
Attributes.of(stringKey("pool.name"), poolName)))))); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Favorite file formatting all week, LOL! 🙈
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the price we have to pay for not using Groovy 😂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And what a price it is!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😂
point.hasAttributes( | ||
Attributes.of(stringKey("pool.name"), poolName)))))); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😂
@AutoService(IgnoredTypesConfigurer.class) | ||
public class IgnoredTestTypesConfigurer implements IgnoredTypesConfigurer { | ||
|
||
@Override | ||
public void configure(Config config, IgnoredTypesBuilder builder) { | ||
// we don't want to instrument auto-generated mocks | ||
builder | ||
.ignoreClass("org.mockito") | ||
.ignoreClass("com.zaxxer.hikari.metrics.IMetricsTracker$MockitoMock$"); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's reasonable for this to be in the hikaricp module (non-testing artifact), especially since it should affect perf due to the underlying trie (as opposed to the old loop), and users may want to run their own tests using the javaagent.
(I'm also ok with it here)
// this method is always called in the HikariPool constructor, even if the user does not | ||
// configure anything |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
* Implement HikariCP connection pool metrics * rebase after SDK update * fix muzzle * code review comments
Resolves #5860