Skip to content

Commit

Permalink
Move to kafka-clients-2.6.
Browse files Browse the repository at this point in the history
  • Loading branch information
alesj committed Sep 30, 2021
1 parent c697ba6 commit 0912ff3
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 22 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@ plugins {
id("otel.library-instrumentation")
}

val versions: Map<String, String> by project

dependencies {
implementation(project(":instrumentation:kafka-clients:kafka-clients-common:library"))
library("org.apache.kafka:kafka-clients:2.8.1")
library("org.apache.kafka:kafka-clients:2.6.0")

testImplementation(project(":instrumentation:kafka-clients:kafka-clients-0.11:testing"))

testImplementation("org.testcontainers:kafka:${versions["org.testcontainers"]}")
testImplementation("org.testcontainers:kafka")
}

tasks {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,21 @@

package io.opentelemetry.instrumentation.kafkaclients;

import io.opentelemetry.api.GlobalOpenTelemetry;
import java.util.Map;
import org.apache.kafka.clients.consumer.ConsumerInterceptor;
import org.apache.kafka.clients.consumer.ConsumerRecords;
import org.apache.kafka.clients.consumer.OffsetAndMetadata;
import org.apache.kafka.common.TopicPartition;

public class TracingConsumerInterceptor<K, V> extends KafkaTracingHolder
implements ConsumerInterceptor<K, V> {
/**
* A ConsumerInterceptor that adds tracing capability. Add this interceptor's class name or class
* via ConsumerConfig.INTERCEPTOR_CLASSES_CONFIG property to your Consumer's properties to get it
* instantiated and used. See more details on ConsumerInterceptor usage in its Javadoc.
*/
public class TracingConsumerInterceptor<K, V> implements ConsumerInterceptor<K, V> {

private static final KafkaTracing tracing = KafkaTracing.create(GlobalOpenTelemetry.get());

@Override
public ConsumerRecords<K, V> onConsume(ConsumerRecords<K, V> records) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,21 @@

package io.opentelemetry.instrumentation.kafkaclients;

import io.opentelemetry.api.GlobalOpenTelemetry;
import java.util.Map;
import org.apache.kafka.clients.producer.ProducerInterceptor;
import org.apache.kafka.clients.producer.ProducerRecord;
import org.apache.kafka.clients.producer.RecordMetadata;

public class TracingProducerInterceptor<K, V> extends KafkaTracingHolder
implements ProducerInterceptor<K, V> {
/**
* A ProducerInterceptor that adds tracing capability. Add this interceptor's class name or class
* via ProducerConfig.INTERCEPTOR_CLASSES_CONFIG property to your Producer's properties to get it
* instantiated and used. See more details on ProducerInterceptor usage in its Javadoc.
*/
public class TracingProducerInterceptor<K, V> implements ProducerInterceptor<K, V> {

private static final KafkaTracing tracing = KafkaTracing.create(GlobalOpenTelemetry.get());

@Override
public ProducerRecord<K, V> onSend(ProducerRecord<K, V> producerRecord) {
tracing.buildAndInjectSpan(producerRecord);
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,8 @@ include(":instrumentation:jsf:mojarra-1.2:javaagent")
include(":instrumentation:jsf:myfaces-1.2:javaagent")
include(":instrumentation:jsp-2.3:javaagent")
include(":instrumentation:kafka-clients:kafka-clients-0.11:javaagent")
include(":instrumentation:kafka-clients:kafka-clients-0.11:library")
include(":instrumentation:kafka-clients:kafka-clients-0.11:testing")
include(":instrumentation:kafka-clients:kafka-clients-2.6:library")
include(":instrumentation:kafka-clients:kafka-clients-common:library")
include(":instrumentation:kafka-streams-0.11:javaagent")
include(":instrumentation:kotlinx-coroutines:javaagent")
Expand Down

0 comments on commit 0912ff3

Please sign in to comment.