-
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
Changes from 6 commits
2a012ae
34d68ec
3b68915
ce0eafc
b187791
85ec089
5f6294b
e5ca107
e791fc8
97cbf9d
4f3d30d
a31210c
84e69ad
5419f03
f4e568a
82248c4
f1e7dde
7703b1d
95d1723
3fdd463
f72ae47
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
trask marked this conversation as resolved.
Show resolved
Hide resolved
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @copilot make a copy of this named and that class should be the same as this class used to be (testing the now deprecated interceptors) and create copies of the subclasses There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @copilot try again |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.instrumentation.kafkaclients.common.v0_11.internal; | ||
|
||
import java.io.Serializable; | ||
import java.util.Objects; | ||
import java.util.function.Supplier; | ||
|
||
/** | ||
* Wrapper for KafkaTelemetry that can be injected into kafka configuration without breaking | ||
* serialization. Used by kafka interceptors to get a configured KafkaTelemetry instance. | ||
* | ||
* <p>This class is internal and is hence not for public use. Its APIs are unstable and can change | ||
* at any time. | ||
*/ | ||
public final class KafkaTelemetrySupplier implements Supplier<Object>, Serializable { | ||
private static final long serialVersionUID = 1L; | ||
private final transient Object kafkaTelemetry; | ||
|
||
public KafkaTelemetrySupplier(Object kafkaTelemetry) { | ||
Objects.requireNonNull(kafkaTelemetry); | ||
this.kafkaTelemetry = kafkaTelemetry; | ||
} | ||
|
||
@Override | ||
public Object get() { | ||
return kafkaTelemetry; | ||
} | ||
|
||
private Object writeReplace() { | ||
// serialize this object to null | ||
return null; | ||
} | ||
} |
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)