OTel logs correlation breaks for transactions-mapped spans
- Dominant language
- Go
- Stars
- 12
- Forks
- 31
- Avg merge
- 8h 55m
- Merged PRs (30d)
- 2
Description
## When does the problem occur?
When receiving an OTel span `S` that is being mapped to a transaction (e.g. root span, or `SpanKind = SERVER`) and in addition an OTel log event `L` that is correlated to that span `S` (i.e. the log event has the OTLP field `SpanID` pointing to that span).
## Problem
Correlation on the span / transaction breaks.
## Reason
In the above situation we map the OTel span `S` to a transaction document. Thus, the OTLP field `SpanID` [is being mapped to the `transaction.id` field in the internal model.](https://github.com/elastic/apm-data/blob/d06eace7d4c6da0a46d1af2c4fc68f6484fea753/input/otlp/traces.go#L154)
When receiving the corresponding log event `L`, the log event points to `S` through an OTLP `SpanID` field. However, since the log event `L` does not carry the characteristics of the span `S` (but only the `SpanID`) we cannot decide whether the OTLP field `SpanID` on the log event needs to be mapped to a `span.id` or a `transaction.id` field. As a result the `SpanID` OTLP field is [always being mapped to the `span.id`](https://github.com/elastic/apm-data/blob/d06eace7d4c6da0a46d1af2c4fc68f6484fea753/input/otlp/logs.go#L108) field (even for associated transaction documents).
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.