Skip to content

Conversation

@loewenheim
Copy link
Contributor

@loewenheim loewenheim commented Oct 16, 2025

This implements the normalization (backfilling/replacement) of deprecated attribute names based on sentry-conventions. The feature applies to spans V2 and logs alike. See the documentation of
normalize_attribute_names and the test_normalize_attributes test for the exact normalization logic.

Integration tests are a bit more basic than I would like because right now no attribute is set to "normalize" in sentry-conventions.

This PR also updates sentry-conventions from getsentry/sentry-conventions@7b0c420 to getsentry/sentry-conventions@4c7cda0 to revert the deprecation of sentry.observed_timestamp_nanos.

Closes INGEST-558.

This implements the normalization (backfilling/replacement) of deprecated
attribute names based on `sentry-conventions`. The feature applies to
spans V2 and logs alike. See the documentation of
`normalize_attribute_names` and the `test_normalize_attributes` test for
the exact normalization logic.
@loewenheim loewenheim requested a review from a team as a code owner October 16, 2025 13:07
@linear
Copy link

linear bot commented Oct 16, 2025

old_attribute.set_value(None);
old_attribute
.meta_mut()
.add_remark(Remark::new(RemarkType::Removed, "attribute.deprecated"));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is there something better that we could add to this remark as the "rule ID"?

Comment on lines 77 to 78
eap::normalize_attribute_types(&mut span.attributes);
eap::normalize_attribute_names(&mut span.attributes);
Copy link
Member

Choose a reason for hiding this comment

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

Did we agree on an approach how to handle normalization and PII scrubbing? Was it that PII scrubbing rules need to be migrated on the sentry side? IMO the best approach would be if PII Selectors would match on both field names, but that might be a stretch for this PR.

Even if we don't solve the PII problem right away, I would add a test case that documents current behavior (i.e. user has an advanced rule for a deprecated field, but the normalized new field does not get scrubbed).

Copy link
Member

Choose a reason for hiding this comment

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

Was it that PII scrubbing rules need to be migrated on the sentry side?

Maybe. It has its upsides, but also massive downsides :(

IMO the best approach would be if PII Selectors would match on both field names

I think that's maybe what we'd have to do, when resolving pii we'd need to consider all aliases.

Even if we don't solve the PII problem right away, I would add a test case that documents current behavior

👍

cursor[bot]

This comment was marked as outdated.

Co-authored-by: Joris Bayer <[email protected]>
old_attribute.set_value(None);
old_attribute
.meta_mut()
.add_remark(Remark::new(RemarkType::Removed, "attribute.deprecated"));
Copy link
Member

Choose a reason for hiding this comment

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

I think we'd want to differentiate here on the remarks:

  • removed
  • moved (renamed)
  • removed, not moved (because new attribute already exists)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  1. What is the difference between the first and the third?
  2. Which RemarkType would you use for the second?

Copy link
Member

Choose a reason for hiding this comment

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

What is the difference between the first and the third?

  1. it's just a deletion
  2. it was supposed to be a rename, but the target already existed so it was removed. This rename does degrade to a remove, but to better understand what it is happening, I imagine a hint that something was supposed to be moved but it degraded to a remove is helpful.

Which RemarkType would you use for the second?

Removed fits closest imo, we can further differentiate on the rule_id imo. Not sure if it's worth introducing a rename, when that is essentially a just a remove.
Alternatively, we can also only mark the new value that it was renamed.

Comment on lines 77 to 78
eap::normalize_attribute_types(&mut span.attributes);
eap::normalize_attribute_names(&mut span.attributes);
Copy link
Member

Choose a reason for hiding this comment

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

Was it that PII scrubbing rules need to be migrated on the sentry side?

Maybe. It has its upsides, but also massive downsides :(

IMO the best approach would be if PII Selectors would match on both field names

I think that's maybe what we'd have to do, when resolving pii we'd need to consider all aliases.

Even if we don't solve the PII problem right away, I would add a test case that documents current behavior

👍

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

@loewenheim loewenheim requested a review from Dav1dde October 29, 2025 13:57
@loewenheim loewenheim requested a review from jjbayer October 29, 2025 13:57
Copy link
Member

@jjbayer jjbayer left a comment

Choose a reason for hiding this comment

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

LGTM, do you think you could add the PII test I mentioned?

Even if we don't solve the PII problem right away, I would add a test case that documents current behavior (i.e. user has an advanced rule for a deprecated field, but the normalized new field does not get scrubbed).

@loewenheim loewenheim added this pull request to the merge queue Oct 30, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 30, 2025
@loewenheim loewenheim added this pull request to the merge queue Oct 30, 2025
Merged via the queue into master with commit 38917cc Oct 30, 2025
28 checks passed
@loewenheim loewenheim deleted the sebastian/normalize-attributes branch October 30, 2025 10:26
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