-
-
Notifications
You must be signed in to change notification settings - Fork 167
feat(core): add some DSC fields to transaction envelope headers #869
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
Merged
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
b16d9c3
feat(types): add all the missing supported envelope headers
lcian 7d3898c
no pub for now
lcian 740739d
improve
lcian dae4b57
improve
lcian 5ea5360
improve
lcian 9f24e6e
improve
lcian ccd1de8
improve
lcian 17d75e7
improve
lcian 5480d79
improve
lcian 5cdb44c
improve
lcian 280abd8
feat(types): add accessors for envelope headers
lcian 2c94b08
changelog
lcian 8ec6826
improve
lcian c8cd1f7
improve
lcian 135dff0
&mut self
lcian e64452e
mut self
lcian 53c2c3f
address all feedback
lcian ddc2811
remove print
lcian 51a6096
Merge branch 'master' into lcian/feat/envelope-headers/accessors
lcian df7126a
fix whitespace
lcian 23ed1ce
feat(core): add some DSC fields to transaction envelope headers
lcian 2b129e3
improve
lcian 567b420
improve
lcian 8186794
improve
lcian e186167
improve
lcian c90f2d7
improve
lcian 28eab25
improve
lcian 37d6388
improve
lcian 34cbb3f
improve
lcian 8ebbc35
Merge branch 'master' into lcian/feat/dsc-info-for-transactions
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,10 @@ | |
use std::sync::atomic::{AtomicUsize, Ordering}; | ||
use std::sync::Arc; | ||
|
||
use sentry::protocol::{Attachment, Context, EnvelopeItem}; | ||
use sentry::types::Uuid; | ||
use sentry::protocol::{ | ||
Attachment, Context, DynamicSamplingContext, EnvelopeHeaders, EnvelopeItem, | ||
}; | ||
use sentry::types::{Dsn, Uuid}; | ||
|
||
#[test] | ||
fn test_basic_capture_message() { | ||
|
@@ -578,3 +580,39 @@ fn test_basic_capture_log_macro_message_formatted_with_attributes() { | |
_ => panic!("expected item container"), | ||
} | ||
} | ||
|
||
#[test] | ||
fn test_transaction_envelope_dsc_headers() { | ||
let mut trace_id: Option<sentry::protocol::TraceId> = None; | ||
let dsn: Option<Dsn> = "http://[email protected]/42".parse().ok(); | ||
let envelopes = sentry::test::with_captured_envelopes_options( | ||
|| { | ||
let transaction_ctx = sentry::TransactionContext::new("name transaction", "op"); | ||
trace_id = Some(transaction_ctx.trace_id()); | ||
let transaction = sentry::start_transaction(transaction_ctx); | ||
sentry::configure_scope(|scope| scope.set_span(Some(transaction.clone().into()))); | ||
transaction.finish(); | ||
}, | ||
sentry::ClientOptions { | ||
dsn: dsn.clone(), | ||
traces_sample_rate: 1.0, | ||
..Default::default() | ||
}, | ||
); | ||
|
||
assert!(trace_id.is_some()); | ||
let trace_id = trace_id.unwrap(); | ||
assert_eq!(envelopes.len(), 1); | ||
let envelope = envelopes.into_iter().next().unwrap(); | ||
assert!(envelope.uuid().is_some()); | ||
let uuid = envelope.uuid().copied().unwrap(); | ||
|
||
let expected = EnvelopeHeaders::new().with_event_id(uuid).with_trace( | ||
DynamicSamplingContext::new() | ||
.with_trace_id(trace_id) | ||
.with_public_key(dsn.unwrap().public_key().to_owned()) | ||
.with_sample_rate(1.0) | ||
.with_sampled(true), | ||
); | ||
assert_eq!(envelope.headers(), &expected); | ||
} |
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.