You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When consuming events with kafka in Application Insights it should show java exceptions on the same level as the rest of the process.
Just like this screenshot, but with an exception between the google calls:
Actual behavior
When the exception happens the trace tree is missing some parts and has incorrect indentation:
All event consumptions from other traces don't show up:
But they show up in the trace where the exception happened:
I set up a sample application in the following repo. It contains the issue details, a workaround and instructions to reproduce: appinsights-otel-kafka-eventhub
System information
SDK Version: 3.2.11 and 3.3.0-BETA (commit 4e7fe08)
OS type and version: Docker - amd64 - eclipse-temurin:17-jre-alpine
Using spring-boot: Yes
Additional relevant libraries (from the pom.xml of the sample application):
<applicationinsights-agent.version>3.2.11</applicationinsights-agent.version>
<opentelemetry-api.version>1.13.0</opentelemetry-api.version>
<kafka-clients.version>3.1.0</kafka-clients.version>
<applicationinsights-spring-boot-starter.version>2.6.4</applicationinsights-spring-boot-starter.version>
Workaround
A workaround is that you could extract the "traceparent" header from the event inside the consumer and make this the current trace context.
After a restart the "good" traces now look like this. Mind the wrong indentation:
When the exceptions gets thrown the trace looks a bit better. The exception is out of place because the parent is missing:
The subsequent traces also look better, but they are missing the queue time information:
Expected behavior
When consuming events with kafka in Application Insights it should show java exceptions on the same level as the rest of the process.
Just like this screenshot, but with an exception between the google calls:
Actual behavior
When the exception happens the trace tree is missing some parts and has incorrect indentation:
All event consumptions from other traces don't show up:
But they show up in the trace where the exception happened:
To Reproduce
Create a kafka consumer like this: azure/azure-event-hubs-for-kafka
Let that consumer throw an exception.
Sample Application
I set up a sample application in the following repo. It contains the issue details, a workaround and instructions to reproduce: appinsights-otel-kafka-eventhub
System information
<applicationinsights-agent.version>3.2.11</applicationinsights-agent.version>
<opentelemetry-api.version>1.13.0</opentelemetry-api.version>
<kafka-clients.version>3.1.0</kafka-clients.version>
<applicationinsights-spring-boot-starter.version>2.6.4</applicationinsights-spring-boot-starter.version>
Workaround
A workaround is that you could extract the "traceparent" header from the event inside the consumer and make this the current trace context.
After a restart the "good" traces now look like this. Mind the wrong indentation:
When the exceptions gets thrown the trace looks a bit better. The exception is out of place because the parent is missing:
The subsequent traces also look better, but they are missing the queue time information:
Polling without the workaround:
With the workaround:
The text was updated successfully, but these errors were encountered: