-
-
Notifications
You must be signed in to change notification settings - Fork 168
ref(tracing): rework tracing
to Sentry span name/op conversion
#887
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
Merged
+257
−27
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
d1e64e6
ref(tracing): rework tracing to Sentry span name/op conversion
lcian e0b4c50
wip
lcian 04e614e
wip
lcian 7093257
Merge branch 'master' into lcian/ref/tracing-attributes
lcian 7312bc2
update changelog
lcian ef97dc7
Fix punctuation in CHANGELOG for Sentry span ops
lcian 975a11d
Merge branch 'master' into lcian/ref/tracing-attributes
lcian 93a8c04
update test
lcian 6f1a645
assert name
lcian 9117788
improve
lcian 29a8077
address comments
lcian 5965984
Merge branch 'master' into lcian/ref/tracing-attributes
lcian e808a35
address comments
lcian 3658945
add default attributes
lcian 1d68f98
lifetime
lcian 5fdd55f
changelog
lcian File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
mod shared; | ||
|
||
#[tracing::instrument(fields( | ||
some = "value", | ||
sentry.name = "updated name", | ||
sentry.op = "updated op", | ||
))] | ||
fn test_fun_record_on_creation() {} | ||
|
||
#[tracing::instrument(fields( | ||
some = "value", | ||
sentry.name = tracing::field::Empty, | ||
sentry.op = tracing::field::Empty, | ||
))] | ||
fn test_fun_record_later() { | ||
tracing::Span::current().record("sentry.name", "updated name"); | ||
tracing::Span::current().record("sentry.op", "updated op"); | ||
} | ||
lcian marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
#[test] | ||
fn should_update_sentry_op_and_name_based_on_fields() { | ||
let transport = shared::init_sentry(1.0); | ||
|
||
for f in [test_fun_record_on_creation, test_fun_record_later] { | ||
f(); | ||
|
||
let data = transport.fetch_and_clear_envelopes(); | ||
assert_eq!(data.len(), 1); | ||
|
||
let transaction = data.first().expect("should have 1 transaction"); | ||
let transaction = match transaction.items().next().unwrap() { | ||
sentry::protocol::EnvelopeItem::Transaction(transaction) => transaction, | ||
unexpected => panic!("Expected transaction, but got {unexpected:#?}"), | ||
}; | ||
|
||
assert_eq!(transaction.name.as_deref().unwrap(), "updated name"); | ||
let ctx = transaction.contexts.get("trace"); | ||
match ctx { | ||
Some(sentry::protocol::Context::Trace(trace_ctx)) => { | ||
assert_eq!(trace_ctx.op, Some("updated op".to_owned())) | ||
} | ||
_ => panic!("expected trace context"), | ||
} | ||
} | ||
} | ||
lcian marked this conversation as resolved.
Show resolved
Hide resolved
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.