-
Notifications
You must be signed in to change notification settings - Fork 119
feat(spans): Equalize name and description for manual spans #6070
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
Changes from all commits
61a998e
5a42efc
03de602
01e0fff
18d7a6f
e7c7306
7dbff4a
3084fd3
14ab996
91bf9a6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| use relay_conventions::attributes::*; | ||
| use relay_event_schema::protocol::Attributes; | ||
| use relay_protocol::{Annotated, Value}; | ||
|
|
||
| /// Derives a description for a V2 span, based on its name | ||
| /// and attributes. | ||
| /// | ||
| /// For now, this tries the following steps, in order: | ||
| /// - returns the span's name if its [`SENTRY__ORIGIN`] attribute is `"manual"` | ||
| /// - returns the span's [`DB__QUERY__TEXT`] attribute if it exists | ||
| /// - returns a combination of the span's [`HTTP__REQUEST__METHOD`] and | ||
| /// [`URL__FULL`] attributes, if they both exists. | ||
| /// | ||
| /// In the future, this logic will be partly moved to and extended in `sentry-conventions`. | ||
| pub fn derive_description_for_v2_span( | ||
| attributes: &Attributes, | ||
| name: &Annotated<String>, | ||
| ) -> Option<String> { | ||
| if attributes | ||
| .get_value(SENTRY__ORIGIN) | ||
| .and_then(|o| o.as_str()) | ||
| == Some("manual") | ||
|
Comment on lines
+19
to
+22
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This formatting is weird af |
||
| { | ||
| return name.value().cloned(); | ||
| } | ||
|
cursor[bot] marked this conversation as resolved.
cursor[bot] marked this conversation as resolved.
|
||
|
|
||
| if let Some(&Value::String(db_query)) = attributes.get_value(DB__QUERY__TEXT).as_ref() { | ||
| return Some(db_query.clone()); | ||
| } | ||
|
Comment on lines
+27
to
+29
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Moving Suggested FixEnsure that derived span descriptions are generated before the PII scrubbing process runs. This would involve calling Prompt for AI Agent |
||
|
|
||
| if let Some(&Value::String(method)) = attributes.get_value(HTTP__REQUEST__METHOD).as_ref() | ||
| && let Some(&Value::String(url)) = attributes.get_value(URL__FULL).as_ref() | ||
| { | ||
| return Some(format!("{method} {url}")); | ||
| } | ||
|
|
||
| None | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.