Skip to content

Commit 30bc6dd

Browse files
committed
internal
1 parent 06184d1 commit 30bc6dd

File tree

5 files changed

+17
-21
lines changed

5 files changed

+17
-21
lines changed

instrumentation/kafka/kafka-clients/kafka-clients-2.6/library/README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,9 @@ There are two options for capturing traces, either using interceptors or wrappin
3131

3232
#### Using interceptors
3333

34-
The Kafka clients API provides a way to "intercept" messages before they are sent to the brokers as well as messages received from the broker before being passed to the application.
35-
The OpenTelemetry instrumented Kafka library provides two interceptors to be configured to add tracing information automatically.
36-
The interceptor class has to be set in the properties bag used to create the Kafka client.
34+
The Kafka clients API provides a way to intercept messages before they are sent to the brokers as well as messages received from the broker before being passed to the application.
3735

38-
For the producer:
36+
To intercept messages and emit telemetry for a `KafkaProducer`:
3937

4038
```java
4139
KafkaTelemetry telemetry = KafkaTelemetry.create(openTelemetry);
@@ -47,7 +45,7 @@ props.putAll(telemetry.producerInterceptorConfigProperties());
4745
Producer<String, String> producer = new KafkaProducer<>(props);
4846
```
4947

50-
For the consumer:
48+
To intercept messages and emit telemetry for a `KafkaConsumer`:
5149

5250
```java
5351
KafkaTelemetry telemetry = KafkaTelemetry.create(openTelemetry);

instrumentation/kafka/kafka-clients/kafka-clients-2.6/library/src/main/java/io/opentelemetry/instrumentation/kafkaclients/v2_6/KafkaTelemetry.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
import io.opentelemetry.instrumentation.kafkaclients.common.v0_11.internal.OpenTelemetryMetricsReporter;
2727
import io.opentelemetry.instrumentation.kafkaclients.common.v0_11.internal.OpenTelemetrySupplier;
2828
import io.opentelemetry.instrumentation.kafkaclients.common.v0_11.internal.TracingList;
29+
import io.opentelemetry.instrumentation.kafkaclients.v2_6.internal.OpenTelemetryConsumerInterceptor;
30+
import io.opentelemetry.instrumentation.kafkaclients.v2_6.internal.OpenTelemetryProducerInterceptor;
2931
import java.lang.reflect.InvocationTargetException;
3032
import java.lang.reflect.Proxy;
3133
import java.util.Collections;
Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6-
package io.opentelemetry.instrumentation.kafkaclients.v2_6;
6+
package io.opentelemetry.instrumentation.kafkaclients.v2_6.internal;
77

88
import com.google.errorprone.annotations.CanIgnoreReturnValue;
99
import io.opentelemetry.context.Context;
1010
import io.opentelemetry.instrumentation.api.internal.Timer;
1111
import io.opentelemetry.instrumentation.kafkaclients.common.v0_11.internal.KafkaConsumerContext;
1212
import io.opentelemetry.instrumentation.kafkaclients.common.v0_11.internal.KafkaConsumerContextUtil;
13+
import io.opentelemetry.instrumentation.kafkaclients.v2_6.KafkaTelemetry;
1314
import java.util.Map;
1415
import java.util.Objects;
1516
import java.util.function.Supplier;
@@ -21,14 +22,10 @@
2122
import org.apache.kafka.common.TopicPartition;
2223

2324
/**
24-
* A ConsumerInterceptor that adds OpenTelemetry instrumentation. Add this interceptor's class name
25-
* or class via ConsumerConfig.INTERCEPTOR_CLASSES_CONFIG property to your Consumer's properties to
26-
* get it instantiated and used. See more details on ConsumerInterceptor usage in its Javadoc.
25+
* A ConsumerInterceptor that adds OpenTelemetry instrumentation.
2726
*
28-
* <p>To configure the interceptor, use {@link KafkaTelemetry#consumerInterceptorConfigProperties}
29-
* to obtain the configuration properties and add them to your consumer configuration.
30-
*
31-
* @see KafkaTelemetry#consumerInterceptorConfigProperties()
27+
* <p>This class is internal and is hence not for public use. Its APIs are unstable and can change
28+
* at any time.
3229
*/
3330
public class OpenTelemetryConsumerInterceptor<K, V> implements ConsumerInterceptor<K, V> {
3431

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6-
package io.opentelemetry.instrumentation.kafkaclients.v2_6;
6+
package io.opentelemetry.instrumentation.kafkaclients.v2_6.internal;
77

88
import com.google.errorprone.annotations.CanIgnoreReturnValue;
9+
import io.opentelemetry.instrumentation.kafkaclients.v2_6.KafkaTelemetry;
910
import java.util.Map;
1011
import java.util.Objects;
1112
import java.util.function.Supplier;
@@ -16,14 +17,10 @@
1617
import org.apache.kafka.clients.producer.RecordMetadata;
1718

1819
/**
19-
* A ProducerInterceptor that adds OpenTelemetry instrumentation. Add this interceptor's class name
20-
* or class via ProducerConfig.INTERCEPTOR_CLASSES_CONFIG property to your Producer's properties to
21-
* get it instantiated and used. See more details on ProducerInterceptor usage in its Javadoc.
20+
* A ProducerInterceptor that adds OpenTelemetry instrumentation.
2221
*
23-
* <p>To configure the interceptor, use {@link KafkaTelemetry#producerInterceptorConfigProperties}
24-
* to obtain the configuration properties and add them to your producer configuration.
25-
*
26-
* @see KafkaTelemetry#producerInterceptorConfigProperties()
22+
* <p>This class is internal and is hence not for public use. Its APIs are unstable and can change
23+
* at any time.
2724
*/
2825
public class OpenTelemetryProducerInterceptor<K, V> implements ProducerInterceptor<K, V> {
2926

instrumentation/kafka/kafka-clients/kafka-clients-2.6/library/src/test/java/io/opentelemetry/instrumentation/kafkaclients/v2_6/KafkaTelemetryInterceptorTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
import static org.assertj.core.api.Assertions.assertThat;
99
import static org.assertj.core.api.Assertions.assertThatThrownBy;
1010

11+
import io.opentelemetry.instrumentation.kafkaclients.v2_6.internal.OpenTelemetryConsumerInterceptor;
12+
import io.opentelemetry.instrumentation.kafkaclients.v2_6.internal.OpenTelemetryProducerInterceptor;
1113
import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension;
1214
import io.opentelemetry.instrumentation.testing.junit.LibraryInstrumentationExtension;
1315
import java.io.ByteArrayInputStream;

0 commit comments

Comments
 (0)