Skip to content
New issue

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

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

Already on GitHub? # to your account

feat(spans): Keep domain + extension for image resources #2826

Merged
merged 4 commits into from
Dec 11, 2023

Conversation

jjbayer
Copy link
Member

@jjbayer jjbayer commented Dec 7, 2023

Group resource.img spans by domain + extension. Known path segments like data are also allowed.

This PR does not yet enable span ingestion for all orgs (still restricted to all-modules).

ref: getsentry/sentry#61161

Comment on lines +304 to +308
let basename = if ty == "img" {
Cow::Borrowed("*")
} else {
scrub_resource_segment(basename)
};
Copy link
Member Author

Choose a reason for hiding this comment

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

This is the main functional change in this PR: for img spans, only keep the extension.

Comment on lines -301 to -302
let mut segments = base_path.split('/').map(scrub_resource_segment);
let mut joined = segments.join("/");
Copy link
Member Author

Choose a reason for hiding this comment

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

Drive-by fix: Segments are already handled in scrub_resource, so no need to do it again here.

@jjbayer jjbayer marked this pull request as ready for review December 7, 2023 10:16
@jjbayer jjbayer requested a review from a team as a code owner December 7, 2023 10:16
Comment on lines +577 to +588
span_description_test!(
resource_no_ids_img_known_segment,
"https://data.domain.com/data/guide.gif",
"resource.img",
"https://*.domain.com/data/guide.gif"
"https://*.domain.com/data/*.gif"
);

span_description_test!(
resource_no_ids_img,
"https://data.domain.com/something/guide.gif",
"resource.img",
"https://*.domain.com/*/*.gif"
Copy link
Member Author

Choose a reason for hiding this comment

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

@DominikB2014 these tests illustrate what the new span descriptions will look like.

"resource.img",
"https://example.org/*/media/*/weird-stuff-*-*-*.jpg"
"https://example.org/p/fit=cover,width=150,height=150,format=auto,quality=90/media/photosV2/weird-stuff-123-234-456.js",
"resource.script",
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we changing existing tests, instead of adding new ones? Should we update the test names if we update what they're testing?

Copy link
Member Author

Choose a reason for hiding this comment

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

The intention of the test was to make sure commas don't make it into the scrubbed description, and that is now trivially true for resource.img because the entire base name gets removed. But you are right, I will duplicate the tests instead.

@DominikB2014
Copy link
Contributor

One thing we might have to consider in the future is that we can still have images that don't have the span.op:resource.img, once merged, I can monitor how it looks in this case.

@jjbayer jjbayer merged commit 771e87a into master Dec 11, 2023
20 checks passed
@jjbayer jjbayer deleted the feat/spans-resource-img branch December 11, 2023 07:59
jjbayer added a commit that referenced this pull request Dec 18, 2023
#2826 introduced grouping
`resource.img` spans by domain + extension, allowing us to enable span
metrics for this op. Now also enable `resource.img` for the spans
dataset.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants