No elegant way to get span in Kafka ErrorHandler
See original GitHub issueI need a way to get span in Kafka ErrorHanlder. I do the next thing in error handler -
@Override
public void handle(Exception ex, ConsumerRecord<?, ?> consumerRecord) {
var curSpan = this.kafkaTracing.nextSpan(consumerRecord).name("on-message").start()
try (Tracer.SpanInScope ws = tracer.withSpanInScope(curSpan)) {
log.error(ex);
} finally {
span.finish();
}
}
But method in KafkaTracing nextSpan() - clear all headers before error handler do its job. And KafkaTracing if final and i can’t inherit from it. I have a question - is it a bug that you don’t give an opportunity not to remove headers from ConsumerRecord?
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Stack Overflow
Currently I've faced with an issue, span creates in MessageListenerMethodInterceptor which triggers on KafkaListener, but in case of exception ...
Read more >Error Handling Patterns in Kafka - Confluent
And in the world of distributed systems, what can go wrong often goes wrong. This blog post covers different ways to handle errors...
Read more >Spring for Apache Kafka
The simplest way to get started is to use start.spring.io (or the wizards in Spring Tool Suits and Intellij IDEA) and create a...
Read more >Documentation - Apache Kafka
This tutorial assumes you are starting fresh and have no existing Kafka or ZooKeeper data. Since Kafka console scripts are different for Unix-based...
Read more >std::span in C++20: Bounds-Safe Views for Sequences of ...
The following program shows how a subspan can be used to modify the referenced objects from a std::vector. // spanTransform.cpp #include < ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Same problem here ! It seems that the
ConsumerRecord<?,?>
received in the@Override public void handle(Exception ex, ConsumerRecord<?, ?> consumerRecord)
method has been stripped from its headers, including the traceId.Probably you can add a ThreadLocal, this will be setted in proxy. example -