Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Kafka Producer transactions shown as unknown on kibana apm dashboard #1655

Closed
wants to merge 1 commit into from

Conversation

heisGarvit
Copy link

@heisGarvit heisGarvit commented Sep 21, 2024

Transactions with kakfa producers are shown as unknown on elastic apm kibana dashboard, while transaction with kafka consumer are shown as messaging. This pull request adds changes to fixes the issue.

Opentelemetry Instrumentation code for instrumenting producing message on kafka:
image

Producer Transactions visible as unknown on Kibana Dashboard:
image

Opentelemetry Instrumentation code for instrumenting consuming message from kafka:
image

Consumer Transactions visible as messaging on Kibana Dashboard:
image

After the Pull request changes:
image

Transactions with kakfa producers are shown as unknown on elastic apm kibana dashboard, while transaction with kafka consumer are shown as messaging. This commit adds fixes the issue.
@heisGarvit heisGarvit requested a review from a team as a code owner September 21, 2024 10:24
@dmathieu
Copy link
Member

Doing this would break our specifications: https://github.com/elastic/apm/blob/main/specs/agents/tracing-api-otel.md#transaction-type

The reason producer transactions are not defined is that transactions on the elastic model are root spans.
Messages should never be produced as a root span. They would be meaningless (you know something was produced, but you wan't know what did it).

An incoming HTTP request, or a message being received would be root spans (to a service), because those are entrypoints into said service.

Within spans, we do mark producer ones as messaging when the messaging.system attribute is set:

case "messaging.system":
s.span.Type = "messaging"

So while I wouldn't be opposed to applying this change (it would need tests), the fact that you need it might be a smell within your own flow.

@heisGarvit
Copy link
Author

@dmathieu

The reason producer transactions are not defined is that transactions on the elastic model are root spans.
Messages should never be produced as a root span. They would be meaningless (you know something was produced, but you wan't know what did it).

Root span should not be producer, makes sense, thanks for pointing out.

@heisGarvit heisGarvit closed this Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants