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
feat(otlp): Derive a sentry.op attribute for V2 spans (#4796)
In support of [Span Field
Transition](https://linear.app/getsentry/document/span-field-transition-e0e4b8e59f11),
this PR adds a change to how `SpanV2` spans are converted to `Span`.
Before, we used to put the `name` field of `SpanV2` into the `op` field
of the `Span`. This is _roughly_ correct, but not quite correct.
Instead, it does this:
1. If the payload includes a `sentry.op` attribute (as it might, in new
SDKs that send `SpanV2` spans that aren't covered under OTel
definitions, like `ui.click`), we respect `sentry.op`
2. If the payload did not include a `sentry.op`, derives a simple
`sentry.op` from the available attributes
3. If it's not possible to derive `sentry.op`, sets it to `"default"`
The logic is copied from the [JavaScript
SDK](https://github.com/getsentry/sentry-javascript/blob/master/packages/opentelemetry/src/utils/parseSpanDescription.ts#L41-L94)
which already has this logic.
N.B. Once this logic is active, SDKs technically don't have to infer the
`op`, since Relay will do it.
This has two important upstream/downstream implications (but they are
negotiable)
1. `sentry.op` will never be blank, and it won't fall back to `name`.
It'll be `"default"`. This should be very rare, but that's the fallback
for missing transaction ops, so I adopted it here. Another alternative
is to fall back to `name`, but I'm trying to avoid mixing those concepts
as much as possible
2. We will rely on frontend SDKs to continue sending `sentry.op` for
cases where we can't derive it for now
The Rust code here is no good, style and logic suggestions would be very
welcome!
0 commit comments