Skip to content

fix(eap): Correctly normalize attributes with placeholders#6012

Merged
loewenheim merged 6 commits into
masterfrom
sebastian/attribute-normalization-placeholders
May 22, 2026
Merged

fix(eap): Correctly normalize attributes with placeholders#6012
loewenheim merged 6 commits into
masterfrom
sebastian/attribute-normalization-placeholders

Conversation

@loewenheim
Copy link
Copy Markdown
Contributor

This implements correct normalization (backfilling/replacement) for attributes containing placeholders. Currently, there is only one attribute in sentry-conventions which contains a placeholder and has normalization enabled: cls.source.<key> -> browser.web_vital.cls.source.<key>. This PR makes it so that cls.source.foobar is backfilled to browser.web_vital.cls.source.foobar.

It also puts a compile-time check in relay-conventions that ensures that we don't attempt to normalize between attributes that do and don't have placeholders (cases which we definitely can't handle without specifying what should happen in sentry-conventions).

Fixes #5982. Fixes RELAY-241.

@loewenheim loewenheim requested a review from a team as a code owner May 20, 2026 15:57
@linear-code
Copy link
Copy Markdown

linear-code Bot commented May 20, 2026

RELAY-241

@loewenheim loewenheim self-assigned this May 20, 2026
// The other cases would mean that either the original attribute contains a placeholder
// and the replacement doesn't, or vice versa. This is ruled out by a compile-time check
// in `relay-conventions`.
_ => unreachable!(),
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

To be extra safe we could also make the function fallible and have it return None in this case.

Comment on lines -420 to +428
"browser.web_vital.cls.source.<key>": {
"browser.web_vital.cls.source.1": {
"type": "string",
"value": "AppContainer > NavContent > MobileTopbar > StyledButton",
},
"browser.web_vital.cls.source.2": {
"type": "string",
"value": "div.app-1azrk9k.etjky0h0 > AppContainer > BodyContainer > BaseFooter",
},
"browser.web_vital.cls.source.3": {"type": "string", "value": "<unknown>"},
Copy link
Copy Markdown
Contributor Author

@loewenheim loewenheim May 20, 2026

Choose a reason for hiding this comment

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

The previous snapshot for this test was absolute nonsense. We were trying to backfill each of cls.source.{1,2,3} to browser.web_vital.cls.source.<key> and only the first backfill succeeded.

Comment thread relay-event-normalization/src/eap/mod.rs
@loewenheim loewenheim added this pull request to the merge queue May 22, 2026
Merged via the queue into master with commit e4dc91c May 22, 2026
33 checks passed
@loewenheim loewenheim deleted the sebastian/attribute-normalization-placeholders branch May 22, 2026 08:46
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.

eap: Handle placeholders during attribute normalization

2 participants