-
Notifications
You must be signed in to change notification settings - Fork 529
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
translate otel messaging.* to ecs #5334
translate otel messaging.* to ecs #5334
Conversation
Opening this to start discussion. I'm modeling this after prior art, but also adding specific transaction/span translation according to https://github.com/elastic/apm/blob/master/specs/agents/tracing-instrumentation-messaging.md, which the PR I was looking at did not have. The questions I have are:
|
💚 Build Succeeded
Expand to view the summary
Build stats
Test stats 🧪
Trends 🧪 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The big question for me is: when do we create a transaction or a span? At the moment we only create a transaction for root otel spans, or otel spans with span kind SERVER. I think we should probably also create transactions for span kind CONSUMER... but only in some cases? Like you might consume a message within a transaction, and in that case it should be a span.
Wouldn't the current logic hold then? Whether span type is |
It appears when consuming a message the sarama otel wrapper is trying to pull out a parent span ctx. Messages sent using the sarama library will have a span context; preserving that relationship would be in line with what otel seems to be doing. If a producer isn't instrumented, but the consumer is, then we'll start a new transaction. Similarly, if a producer's span has no parent, it will also become a transaction. My personal confusion at having a parent/child relationship connected by an async message bus notwithstanding, it seems like we should probably adhere to the "if it's a root span -> new tx; else new span" flow we currently have? |
According to our messaging spec:
For the Sarama instrumentation you pointed at, we're only dealing with passive message reception: you register a callback and it's invoked whenever a new message is received. The "transaction" is the handling of a new message. For JMS on the other hand, there are two ways of receiving messages: a "MessageListener" (passive like sarama's consumer) and "MessageConsumer" (active).
Again following the spec (with a slight adjustment to allow root producer spans -> transactions):
The challenge is how to distinguish between the last two bullet points. I'm not sure that we can do this with the information we have. I think we would need open-telemetry/opentelemetry-specification#366 |
If the span.kind() is producer and `messaging.operation` hasn't been set, assume that it is `send`.
the check needs to be moved to later because `messaging.operation` might not be included
We don't have the necessary metadata to differentiate between active/passive message consumption, which defines, per our messaging spec, if it's a transaction or a span. Based on the assumption that the majority of message consumption is from a listener/callback, or "passive", all CONSUME type otel spans will be converted to transactions.
If spankind == consumption we always create a transaction, since we cannot differentiate between active and passive message consumption types from incoming otel spans.
Co-authored-by: Andrew Wilkins <axwalk@gmail.com>
Co-authored-by: Andrew Wilkins <axwalk@gmail.com> (cherry picked from commit 16618f2) # Conflicts: # changelogs/head.asciidoc
Co-authored-by: Andrew Wilkins <axwalk@gmail.com>
Co-authored-by: Andrew Wilkins <axwalk@gmail.com> (cherry picked from commit 16618f2) # Conflicts: # changelogs/head.asciidoc # processor/otel/consumer.go # processor/otel/consumer_test.go
Verified with 7.14.0-BC2, using the opentelemetry-go-contrib sarama example: Produce span type/subtype/action and properties: Receive transaction properties: Consume span type/action properties: The consume span is missing details, but that's because it's a custom span created by the example app without those details: https://github.com/open-telemetry/opentelemetry-go-contrib/blob/262f81f753760cd1333d1925918300be3f01e77e/instrumentation/github.com/Shopify/sarama/otelsarama/example/consumer/consumer.go#L87-L90 |
Motivation/summary
Translate relevant otel messaging.* semantic conventions to their
elastic-equivalent fields.
closes #5094
Checklist
How to test these changes
Ingest messaging spans from an otel-instrumented messaging service.
EDIT: https://github.com/open-telemetry/opentelemetry-go-contrib/tree/main/instrumentation/github.com/Shopify/sarama/otelsarama/example
Check the transactions and spans in the kibana UI for the following:
transaction:
transaction.type=messaging
queue.name
,system
, andoperation
.span:
span.type=messaging
span.subtype
is the framework name, eg. kafkaspan.action
is one ofreceive
,send
, orprocess
queue.name
.