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(spans): Improve span data http method extraction #2396

Merged
merged 4 commits into from
Aug 10, 2023

Conversation

AbhiPrasad
Copy link
Member

@AbhiPrasad AbhiPrasad commented Aug 9, 2023

Check http.request.method and method fields when trying to extract span.action from an http span.

As a we start rolling out getsentry/team-sdks#19 to more SDKs, we updated the span data field for HTTP methods from http.method to http.request.method. This is to match the new OpenTelemetry conventions.

image

Not sure how to best test this, feedback appreciated!

#skip-changelog

Check `http.request.method` and `method` fields when trying to extract
`span.action` from an http span.
Copy link
Contributor

@iker-barriocanal iker-barriocanal left a comment

Choose a reason for hiding this comment

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

The code looks good!

Adding new spans to this test and running it should update a couple of snapshots and the tag should be available in there.

@AbhiPrasad
Copy link
Member Author

Added snapshot tests with d0de357

I also changed db.system to be postgresql in the snapshot test, this should reflect real world usage a little more closely.

@@ -200,15 +200,18 @@ pub(crate) fn extract_tags(span: &Span, config: &Config) -> BTreeMap<SpanTagKey,
.and_then(|data| data.get("description.scrubbed"))
.and_then(|value| value.as_str());

// TODO(iker): we're relying on the existance of `http.method`
// TODO(iker): we're relying on the existance of `http.method`/`http.response.method`
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we remove this TODO now and just put in the doc string the places we actually look in (and maybe why? E.g. open telemetry scheme etc.), which in my opinion makes more sense.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes I can amend this, good call.

Copy link
Contributor

@iker-barriocanal iker-barriocanal left a comment

Choose a reason for hiding this comment

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

🚀

@AbhiPrasad AbhiPrasad enabled auto-merge (squash) August 10, 2023 13:48
@AbhiPrasad AbhiPrasad merged commit 248cc31 into master Aug 10, 2023
19 checks passed
@AbhiPrasad AbhiPrasad deleted the abhi-span-http-request branch August 10, 2023 14:09
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.

3 participants