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
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions relay-general/src/store/normalize/span/tag_extraction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.

// or `db.operation`. This is not guaranteed, and we'll need to
// parse the span description in that case.
let action = match (span_module, span_op.as_str(), scrubbed_description) {
(Some("http"), _, _) => span
.data
.value()
// TODO(iker): some SDKs extract this as method
.and_then(|v| v.get("http.method"))
.and_then(|v| {
v.get("http.request.method")
.or(v.get("http.method"))
.or(v.get("method"))
})
.and_then(|method| method.as_str())
.map(|s| s.to_uppercase()),
(_, "db.redis", Some(desc)) => {
Expand Down
Loading