Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
- Removed the public `ClientOptions::sample_rate` field. Use `ClientOptions::event_sampling_strategy` to inspect the configured event sampling strategy, and use the existing `ClientOptions::sample_rate(...)` builder setter to configure fixed-rate sampling.
- Removed the public `ClientOptions::sample_rate` field. Use `ClientOptions::event_sampling_strategy` to inspect the configured event sampling strategy, and use the existing `ClientOptions::sample_rate(...)` builder setter to configure fixed-rate sampling ([#1228](https://github.com/getsentry/sentry-rust/pull/1228)).
- Removed the public `ClientOptions::traces_sample_rate` and `ClientOptions::traces_sampler` fields. Use `ClientOptions::traces_sampling_strategy` to inspect the configured traces sampling strategy, and use the existing `ClientOptions::traces_sample_rate(...)` and `ClientOptions::traces_sampler(...)` builder setters to configure fixed-rate and callback-based sampling ([#1227](https://github.com/getsentry/sentry-rust/pull/1227)).
- [`EnvelopeItem`](https://docs.rs/sentry-types/0.49.0/sentry_types/protocol/envelope/enum.EnvelopeItem.html) now stores `Event` and `Transaction` payloads in `Box` values. Code that constructs or pattern-matches these variants must account for the additional indirection ([#1255](https://github.com/getsentry/sentry-rust/pull/1255)).

## 0.48.5

Expand Down
2 changes: 1 addition & 1 deletion sentry-opentelemetry/tests/associates_event_with_span.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ fn test_associates_event_with_span() {
});
}
sentry::protocol::EnvelopeItem::Transaction(tx) => {
transaction = Some(tx.clone());
transaction = Some(*tx.clone());
tx.spans.iter().for_each(|span| {
span_id = Some(span.span_id.to_string());
});
Expand Down
19 changes: 9 additions & 10 deletions sentry-tracing/tests/transaction_assertions/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use sentry::protocol::{EnvelopeItem, Transaction};
use sentry::protocol::EnvelopeItem;
use sentry::Envelope;

/// Assert that the given envelopes contain exactly one `Envelope`, containing
Expand All @@ -7,15 +7,14 @@ pub fn assert_transaction(envelopes: Vec<Envelope>, name: &str) {
let envelope = get_and_assert_only_item(envelopes, "expected exactly one envelope");
let item = get_and_assert_only_item(envelope.into_items(), "expected exactly one item");

assert!(
matches!(
item,
EnvelopeItem::Transaction(Transaction {
name: Some(expected_name),
..
}) if expected_name == name
),
"expected a Transaction item with name {name:?}"
let EnvelopeItem::Transaction(transaction) = item else {
panic!("expected a Transaction item, got {item:?}");
};

assert_eq!(
transaction.name.as_deref(),
Some(name),
"did not get expected transaction name"
);
}

Expand Down
11 changes: 5 additions & 6 deletions sentry-types/src/protocol/envelope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,12 @@ struct EnvelopeItemHeader {
/// for more details.
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
#[allow(clippy::large_enum_variant)]
pub enum EnvelopeItem {
/// An Event Item.
///
/// See the [Event Item documentation](https://develop.sentry.dev/sdk/envelopes/#event)
/// for more details.
Event(Event<'static>),
Event(Box<Event<'static>>),
/// A Session Item.
///
/// See the [Session Item documentation](https://develop.sentry.dev/sdk/envelopes/#session)
Expand All @@ -176,7 +175,7 @@ pub enum EnvelopeItem {
///
/// See the [Transaction Item documentation](https://develop.sentry.dev/sdk/envelopes/#transaction)
/// for more details.
Transaction(Transaction<'static>),
Transaction(Box<Transaction<'static>>),
/// An Attachment Item.
///
/// See the [Attachment Item documentation](https://develop.sentry.dev/sdk/envelopes/#attachment)
Expand Down Expand Up @@ -283,7 +282,7 @@ impl EnvelopeItem {

impl From<Event<'static>> for EnvelopeItem {
fn from(event: Event<'static>) -> Self {
EnvelopeItem::Event(event)
EnvelopeItem::Event(event.into())
}
}

Expand All @@ -301,7 +300,7 @@ impl From<SessionAggregates<'static>> for EnvelopeItem {

impl From<Transaction<'static>> for EnvelopeItem {
fn from(transaction: Transaction<'static>) -> Self {
EnvelopeItem::Transaction(transaction)
EnvelopeItem::Transaction(transaction.into())
}
}

Expand Down Expand Up @@ -513,7 +512,7 @@ impl Envelope {
};

items.iter().find_map(|item| match item {
EnvelopeItem::Event(event) => Some(event),
EnvelopeItem::Event(event) => Some(&**event),
_ => None,
})
}
Expand Down
Loading