-
Notifications
You must be signed in to change notification settings - Fork 859
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
[enhance][pulsar] add apache-pulsar client support #5926
Conversation
Tests to be completed. |
Here is the server log. |
muzzle is our safety checker that prevents runtime failures caused by transformation using types, methods etc that are not present. Your main problem is private static final Tracer TRACER = PulsarTelemetry.tracer(); in |
Hey @tjiuming , Please take a look at our contributing docs about adding a new instrumentation, writing an |
@laurit @mateuszrzeszutek Many thanks for your reply. With your help, I’m already fixed these problems. |
...main/java/io/opentelemetry/javaagent/instrumentation/pulsar/ConsumerImplInstrumentation.java
Outdated
Show resolved
Hide resolved
...main/java/io/opentelemetry/javaagent/instrumentation/pulsar/ConsumerImplInstrumentation.java
Outdated
Show resolved
Hide resolved
...main/java/io/opentelemetry/javaagent/instrumentation/pulsar/ConsumerImplInstrumentation.java
Outdated
Show resolved
Hide resolved
...main/java/io/opentelemetry/javaagent/instrumentation/pulsar/ConsumerImplInstrumentation.java
Outdated
Show resolved
Hide resolved
...vaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/pulsar/PulsarTelemetry.java
Outdated
Show resolved
Hide resolved
.../src/main/java/io/opentelemetry/javaagent/instrumentation/pulsar/info/ClientEnhanceInfo.java
Outdated
Show resolved
Hide resolved
.../src/main/java/io/opentelemetry/javaagent/instrumentation/pulsar/info/ClientEnhanceInfo.java
Outdated
Show resolved
Hide resolved
...gent/src/test/java/io/opentelemetry/javaagent/instrumentation/pulsar/PulsarClientTest.groovy
Outdated
Show resolved
Hide resolved
@laurit Many thanks for your advice |
Tests to be completed. |
Hey @tjiuming , Can you refactor your instrumentation so that is uses the Instrumenter API instead of plain Also, please make sure that you implement appropriate OTel semantic convention -- in case of Pulsar I believe it's messaging semconv. If you use the Instrumenter API, there are several utilities that make implementing OTel semantic conventions way easier. If you need to add custom attributes that are not present in the OTel messaging conventions then the usual pattern is to add a configuration flag, disabled by default, that controls whether they will be added to the produced telemetry or not. For example: https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/instrumentation/hystrix-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/hystrix/HystrixSingletons.java#L24-L27 |
hi @tjiuming! any objection to closing this (just trying to clean up the backlog a little), and you can re-open when you start working on it again? I think if I close it you won't be able to re-open it, but if you close it, I think you will be able to re-open yourself. And of course you can always ping on the closed PR and one of us will re-open it if that fails. |
@trask @mateuszrzeszutek @laurit I‘ve improved and fixed the tests, and all the CI checks passed, cloud you please help review? |
@tjiuming @trask @mateuszrzeszutek Any update on this? We are currently using OTel interceptors but this auto-instrumentation approach would be really awesome. |
@KevinLiLu This PR is waiting for review |
hi @tjiuming sorry for the long delay, we will try to get to this in the next week |
Never mind, thanks! |
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.
thx @tjiuming!
.../java/io/opentelemetry/javaagent/instrumentation/pulsar/v28/ConsumerImplInstrumentation.java
Outdated
Show resolved
Hide resolved
...pentelemetry/javaagent/instrumentation/pulsar/v28/telemetry/ConsumerAttributesExtractor.java
Outdated
Show resolved
Hide resolved
...n/java/io/opentelemetry/javaagent/instrumentation/pulsar/v28/telemetry/PulsarSingletons.java
Outdated
Show resolved
Hide resolved
...elemetry/javaagent/instrumentation/pulsar/v28/telemetry/PulsarMessagingAttributesGetter.java
Outdated
Show resolved
Hide resolved
...elemetry/javaagent/instrumentation/pulsar/v28/telemetry/PulsarMessagingAttributesGetter.java
Outdated
Show resolved
Hide resolved
...pentelemetry/javaagent/instrumentation/pulsar/v28/telemetry/ProducerAttributesExtractor.java
Outdated
Show resolved
Hide resolved
...aagent/src/main/java/io/opentelemetry/javaagent/instrumentation/pulsar/v28/StringTuple2.java
Outdated
Show resolved
Hide resolved
...rc/test/groovy/io/opentelemetry/javaagent/instrumentation/pulsar/v28/PulsarClientTest.groovy
Show resolved
Hide resolved
@trask I've fixed them, PTAL |
@tjiuming can you check the test failures when you have a chance? thx! |
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.
👍
...elemetry/javaagent/instrumentation/pulsar/v28/telemetry/PulsarMessagingAttributesGetter.java
Outdated
Show resolved
Hide resolved
...elemetry/javaagent/instrumentation/pulsar/v28/telemetry/PulsarMessagingAttributesGetter.java
Outdated
Show resolved
Hide resolved
...elemetry/javaagent/instrumentation/pulsar/v28/telemetry/PulsarMessagingAttributesGetter.java
Outdated
Show resolved
Hide resolved
...va/io/opentelemetry/javaagent/instrumentation/pulsar/v28/MessageListenerInstrumentation.java
Outdated
Show resolved
Hide resolved
.../java/io/opentelemetry/javaagent/instrumentation/pulsar/v28/ProducerImplInstrumentation.java
Outdated
Show resolved
Hide resolved
// return hasSuperType(named("org.apache.pulsar.client.api.MessageListener")); | ||
// can't enhance MessageListener here like above due to jvm can't enhance lambda. | ||
return named("org.apache.pulsar.client.impl.conf.ConsumerConfigurationData"); |
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.
did you try MessageListener and it didn't work? there is some magic that should enhance lambdas: #4182
hasSuperType
is a more expensive matcher compared to named
however, so the current implementation could still be better
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 so, too. The current implementation works fine, so it needn't to change.
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.
Many thanks for your review!
@trask Could this PR be merged? |
Fix: #2107
Motivation:
Support apache pulsar client from version 2.8.0 to lastest.