-
Notifications
You must be signed in to change notification settings - Fork 870
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure kafka configuration remains serializable (#7754)
Resolves #7597 I wasn't able to reproduce this. Figuring out how to run beam, flink and kafka together feels like too much effort. Without reproducing it is too hard to tell why the configuration is serialized, but my hunch is that it is enough to ensure that the configuration can be serialized.
- Loading branch information
Showing
5 changed files
with
76 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
.../src/main/java/io/opentelemetry/instrumentation/kafka/internal/OpenTelemetrySupplier.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.instrumentation.kafka.internal; | ||
|
||
import io.opentelemetry.api.OpenTelemetry; | ||
import java.io.Serializable; | ||
import java.util.Objects; | ||
import java.util.function.Supplier; | ||
|
||
/** | ||
* Wrapper for OpenTelemetry that can be injected into kafka configuration without breaking | ||
* serialization. https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/7597 | ||
* | ||
* <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 OpenTelemetrySupplier implements Supplier<OpenTelemetry>, Serializable { | ||
private static final long serialVersionUID = 1L; | ||
private final transient OpenTelemetry openTelemetry; | ||
|
||
public OpenTelemetrySupplier(OpenTelemetry openTelemetry) { | ||
Objects.requireNonNull(openTelemetry); | ||
this.openTelemetry = openTelemetry; | ||
} | ||
|
||
@Override | ||
public OpenTelemetry get() { | ||
return openTelemetry; | ||
} | ||
} |