-
Notifications
You must be signed in to change notification settings - Fork 1k
Add configurable OpenTelemetry kafka-clients interceptors #14870
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: trask <[email protected]>
Co-authored-by: trask <[email protected]>
Co-authored-by: trask <[email protected]>
...main/java/io/opentelemetry/instrumentation/kafkaclients/v2_6/TracingConsumerInterceptor.java
Show resolved
Hide resolved
Co-authored-by: trask <[email protected]>
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Co-authored-by: trask <[email protected]>
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
instrumentation/kafka/kafka-clients/kafka-clients-2.6/library/README.md
Outdated
Show resolved
Hide resolved
Co-authored-by: trask <[email protected]>
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
...io/opentelemetry/instrumentation/kafkaclients/v2_6/InterceptorsSuppressReceiveSpansTest.java
Outdated
Show resolved
Hide resolved
...c/test/java/io/opentelemetry/instrumentation/kafkaclients/v2_6/AbstractInterceptorsTest.java
Outdated
Show resolved
Hide resolved
...c/test/java/io/opentelemetry/instrumentation/kafkaclients/v2_6/AbstractInterceptorsTest.java
Outdated
Show resolved
Hide resolved
...c/test/java/io/opentelemetry/instrumentation/kafkaclients/v2_6/AbstractInterceptorsTest.java
Outdated
Show resolved
Hide resolved
Co-authored-by: trask <[email protected]>
...main/java/io/opentelemetry/instrumentation/kafkaclients/v2_6/TracingProducerInterceptor.java
Outdated
Show resolved
Hide resolved
...main/java/io/opentelemetry/instrumentation/kafkaclients/v2_6/TracingConsumerInterceptor.java
Outdated
Show resolved
Hide resolved
🔧 The result from spotlessApply was committed to the PR branch. |
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.
@copilot looks like this class is only used in kafka-client-2.6:library module? if so can we move it there?
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.
Moved KafkaTelemetrySupplier
from kafka-clients-common-0.11/library/...internal/
to kafka-clients-2.6/library/.../v2_6/internal/
since it's only used in the kafka-clients-2.6 module.
...main/java/io/opentelemetry/instrumentation/kafkaclients/v2_6/TracingConsumerInterceptor.java
Show resolved
Hide resolved
…wards compatibility, move KafkaTelemetrySupplier Co-authored-by: trask <[email protected]>
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
* | ||
* @see KafkaTelemetry#consumerInterceptorConfigProperties() | ||
*/ | ||
public class OpenTelemetryConsumerInterceptor<K, V> implements ConsumerInterceptor<K, V> { |
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.
@copilot mark TracingConsumerIntercepter and TracingProducerInterceptor as deprecated and recommend to use these new classes instead
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.
Marked both TracingConsumerInterceptor
and TracingProducerInterceptor
as @Deprecated
with javadoc comments recommending the new OpenTelemetry*
classes. See commit [pending].
…recated Co-authored-by: trask <[email protected]>
...main/java/io/opentelemetry/instrumentation/kafkaclients/v2_6/TracingConsumerInterceptor.java
Outdated
Show resolved
Hide resolved
…src/main/java/io/opentelemetry/instrumentation/kafkaclients/v2_6/TracingConsumerInterceptor.java
...main/java/io/opentelemetry/instrumentation/kafkaclients/v2_6/TracingProducerInterceptor.java
Outdated
Show resolved
Hide resolved
…src/main/java/io/opentelemetry/instrumentation/kafkaclients/v2_6/TracingProducerInterceptor.java
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.
@copilot make a copy of this named AbstractDeprecatedInterceptorsTest
and that class should be the same as this class used to be (testing the now deprecated interceptors)
and create copies of the subclasses OldInterceptorsTest
and OldInterceptorsSuppressReceiveSpansTest
and have those extend AbstractOldInterceptorsTest
The interceptor class has to be set in the properties bag used to create the Kafka client. | ||
|
||
Use the `TracingProducerInterceptor` for the producer in order to create a "send" span automatically, each time a message is sent. | ||
##### Recommended approach: Configuring interceptors with KafkaTelemetry |
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.
@copilot update the doc, only need to mention the new approach, no need to mention the now deprecated approach (Alternative: Using interceptors with global OpenTelemetry)
Add Configurable OpenTelemetry Kafka Client Interceptors
Added new configurable kafka-clients interceptors that use
KafkaTelemetry
instances instead ofGlobalOpenTelemetry
, following a similar pattern to OpenTelemetryMetricsReporter.Problem Statement
GlobalOpenTelemetry.get()
as static fieldsSolution Implemented
Created new interceptor classes with programmatic configuration:
OpenTelemetryProducerInterceptor
andOpenTelemetryConsumerInterceptor
with full programmatic configurationKafkaTelemetrySupplier
to pass exactKafkaTelemetry
instances configured by usersTracingProducerInterceptor
andTracingConsumerInterceptor
marked as deprecated but kept unchanged for backwards compatibilityChanges Made
OpenTelemetryProducerInterceptor
andOpenTelemetryConsumerInterceptor
(recommended)KafkaTelemetrySupplier
for passingKafkaTelemetry
instances through Kafka configproducerInterceptorConfigProperties()
andconsumerInterceptorConfigProperties()
toKafkaTelemetry
Tracing*
interceptors with simple deprecation messagesKafkaTelemetryInterceptorTest
)Benefits
KafkaTelemetry
builder options preservedFixes #6291
Original prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.