Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(otlp): infer span category from attributes #4509

Merged
merged 9 commits into from
Feb 20, 2025

Conversation

mjq
Copy link
Member

@mjq mjq commented Feb 19, 2025

Relay assigns a category to incoming spans based on their op (see our docs for possible category values).

Unlike Sentry's op field, OTel span names aren't structured and therefore can't be used to determine the span category.

In order to support categorizing incoming OTel spans, update the span categorization algorithm to:

  1. Use the incoming sentry.category attribute directly if given. This allows our SDKs to be explicit about the intended category and also lets users explicitly perform categorization in case our automatic categorization is ever incorrect.
  2. Extract the category from op. This is what we do today, and will keep categorization consistent for Sentry SDK clients sending spans via transaction events now and in the future.
  3. When op is missing (e.g. an OTLP span), infer the category based on the span's attributes. This will categorize incoming OTel spans based on semantic conventions.

Currently the inference only supports the five categories we use in the transaction summary page's operation filter, which is the page the Performance team is currently migrating to EAP. We'll expand it in the future as we move more of the product surface area over to support EAP/span-first/OTLP.

@@ -8174,6 +8174,7 @@ expression: metrics
],
),
tags: {
"span.category": "ui",
Copy link
Member Author

Choose a reason for hiding this comment

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

Based on our docs on categories this update seems correct (in other words, it was incorrect that this was previously missing).

@mjq mjq marked this pull request as ready for review February 19, 2025 16:15
@mjq mjq requested a review from a team as a code owner February 19, 2025 16:15
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.

Maybe you can also find an existing integration test, which we can extend for this.

@mjq mjq merged commit fddc641 into master Feb 20, 2025
25 checks passed
@mjq mjq deleted the mjq-span-category-generation branch February 20, 2025 21:15
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.

2 participants