open-telemetry / opentelemetry-java-instrumentation

OpenTelemetry auto-instrumentation and instrumentation libraries for Java
https://opentelemetry.io
Apache License 2.0
1.96k stars 857 forks source link

Openelemetry plugin for kafka connect #2623

Open radzikp opened 3 years ago

radzikp commented 3 years ago

It would be nice to have kafka connect plugin for opentelemetry where messages are produced ansynchronously and kafka client is seperated from the 'service'.

An example: The outbox pattern.

The workaround for this: Create a custom transformation on kafka connect as 3rd party custom library to glue spans in one trace and propagate the context to the Kafka.

dharmaplay commented 2 years ago

any tentative date when can we get the kafka connector for opentelemetry?

mateuszrzeszutek commented 2 years ago

Hey @dharmaplay , Unfortunately we don't have enough time and resources to implement it on our own. We would greatly appreciate an external contribution for this.

deepeshhitachi commented 1 year ago

We are blocked as we are using opentelemetry and want to put opentelemetry data into timescale DB using Kafka connect but it is extremely difficult to parse - is kafka connect not support OpenTelemetry at all? We wanted to push from Kafka to Promscale using kafka connect instead of OTEL connector.

vidourem commented 1 year ago

I am trying to implement end-to-end traceability of the transactional outbox pattern with Debezium. There is a SMT for Kafka Connect that extracts the context previously recorded in a database table and propagates it in a ConnectRecord. I just made an evolution of this SMT to work with OpenTelemetry. It works perfectly. However, the Kafka ProducerRecord instrumentation with the interceptor always starts a new trace while the context is present in the record. Is this normal behavior? Could you evolve the instrumentation to extract the context from the record and use it if it exists?

vidourem commented 1 year ago

The issue I encounter between the ConnectRecord and the ProducerRecord is similar to https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/6297 and https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/2801 . I don't see any other solutions at the moment except to extend the ProducerRecord's interceptor, have I missed anything?

Cirilla-zmh commented 1 month ago

Hi @vidourem , the reason for the new trace in the Kafka producer might be due to an incorrect context propagation. I don’t believe any improvements are necessary for the kafka-clients instrumentations. Instead, you may need to retrieve the context created by the Kafka producer instrumentation and propagate it in your connector.