Skip to content

Conversation

@Ahmed-Labs
Copy link
Contributor

@Ahmed-Labs Ahmed-Labs commented Dec 15, 2025

Double writes SpanV2 attributes to legacy attributes to achieve backwards compatibility. With both conventions present in a span, V2 spans will continue to be compatible with our products while we simultaneously start accumulating spans that conform to sentry conventions.

DB and HTTP spans both fall back to legacy attributes, this is done so that when the transactions span pipeline gets unified into the span first pipeline, they continue to be normalized.

See DACI for more information: https://www.notion.so/sentry/DACI-Backwards-compatibility-for-span-first-attribute-conventions-2c48b10e4b5d802dbfc3d90610b2537b?source=copy_link

Note: bumps sentry conventions

@Ahmed-Labs Ahmed-Labs changed the title feat(spanv2): Double write legacy attributes for backwards compatibility feat(spanv2): Double write to legacy attributes for backwards compatibility Dec 15, 2025
@Ahmed-Labs Ahmed-Labs force-pushed the ahmedmo/feat/double-write-attributes-spanv2 branch 2 times, most recently from 24e46c9 to a2d9fd9 Compare December 15, 2025 21:19
@Ahmed-Labs Ahmed-Labs changed the base branch from master to ahmedmo/feat/spanv2-normalize-http-attributes December 15, 2025 21:20
@Ahmed-Labs Ahmed-Labs force-pushed the ahmedmo/feat/spanv2-normalize-http-attributes branch 2 times, most recently from d9ac0b2 to 3f7dd38 Compare December 15, 2025 21:38
@Ahmed-Labs Ahmed-Labs force-pushed the ahmedmo/feat/double-write-attributes-spanv2 branch from 180b946 to 79e7eea Compare December 16, 2025 03:03
Base automatically changed from ahmedmo/feat/spanv2-normalize-http-attributes to master December 16, 2025 18:45
@Ahmed-Labs Ahmed-Labs force-pushed the ahmedmo/feat/double-write-attributes-spanv2 branch from 79e7eea to acfecc8 Compare December 16, 2025 19:02
@Ahmed-Labs Ahmed-Labs marked this pull request as ready for review December 16, 2025 19:56
@Ahmed-Labs Ahmed-Labs requested a review from a team as a code owner December 16, 2025 19:56
@jjbayer
Copy link
Member

jjbayer commented Dec 17, 2025

@loewenheim could this be covered by generic double-write rules in sentry conventions instead?

Copy link
Member

@Dav1dde Dav1dde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What @jjbayer mentioned, would be interested if the deprecation flow we added to conventions doesn't already cover this case, as it seems quite straight forward 1:1 mapping. If it does not, what changes do we need to make to get this covered?

// This is equivalent to conditionally scrubbing by span category in the V1 pipeline.
if !attributes.contains_key(HTTP_REQUEST_METHOD) {
if !attributes.contains_key(HTTP_REQUEST_METHOD)
&& !attributes.contains_key("http.request_method")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want to have all attributes used defined in relay-conventions/src/consts.rs and added to conventions, unless there is a good reason not to add it to conventions.

I think even adding (still in use) legacy attributes to the conventions has values.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just thought that since legacy attributes like http.request_method don't align with OTel and we're going in a direction where the SDKs won't be sending it at all, it would be counter productive to include it. I do also see value in adding it to conventions tho because that attribute will always be present in some spans (even with span first, there will be people with unupgraded SDKs I guess).

@Ahmed-Labs
Copy link
Contributor Author

Ahmed-Labs commented Dec 17, 2025

What @jjbayer mentioned, would be interested if the deprecation flow we added to conventions doesn't already cover this case, as it seems quite straight forward 1:1 mapping. If it does not, what changes do we need to make to get this covered?

The problem is that the mapping isn't 1:1, for example sentry.action maps to db.operation.name,http.request.method, and more. I don't think there's a way to mark the legacy attribute as deprecated and have it be replaced by multiple attributes. Some of these attributes are also not being deprecated, just used for different reasons (like sentry.description), so marking them as deprecated could be problematic (whether in eap queries or relay attribute name normalization).

So to make this work we would probably have to add something like a legacy/fallback field to conventions where you can specify fields to write back to. That way, we don't have to falsely mark deprecation, and we would know which attribute http.request.method maps back to (even if other attributes fall back to the same attribute).

@Ahmed-Labs
Copy link
Contributor Author

Following up on this, I've added the attributes to sentry conventions (PR) and updated my changes accordingly.

Note: I wasn't able to add http.request_method because upon adding it, the conventions code gen created conflicting variable names with the existing http.request.method attribute (in the generated libraries) because it doesn't differentiate between periods and underscores in all cases. So it seems like the sentry conventions code gen needs to be updated, and I've created a ticket for it.

@mjq mjq requested a review from a team December 18, 2025 18:36
@Ahmed-Labs Ahmed-Labs enabled auto-merge December 18, 2025 19:36
@Ahmed-Labs Ahmed-Labs added this pull request to the merge queue Dec 18, 2025
Merged via the queue into master with commit d250b0b Dec 18, 2025
29 checks passed
@Ahmed-Labs Ahmed-Labs deleted the ahmedmo/feat/double-write-attributes-spanv2 branch December 18, 2025 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants