pub struct TypedEnvelope<G>(/* private fields */);
Expand description
A wrapper for ManagedEnvelope
with assigned processing group type.
Implementations§
Source§impl<G> TypedEnvelope<G>
impl<G> TypedEnvelope<G>
Sourcepub fn into_processed(self) -> TypedEnvelope<Processed>
pub fn into_processed(self) -> TypedEnvelope<Processed>
Changes the typed of the current envelope to processed.
Once it’s marked processed it can be submitted to upstream.
Methods from Deref<Target = ManagedEnvelope>§
Sourcepub fn envelope_mut(&mut self) -> &mut Envelope
pub fn envelope_mut(&mut self) -> &mut Envelope
Returns a mutable reference to the contained [Envelope
].
Sourcepub fn update(&mut self) -> &mut Self
pub fn update(&mut self) -> &mut Self
Update the context with envelope information.
This updates the item summary as well as the event id.
Sourcepub fn retain_items<F>(&mut self, f: F)where
F: FnMut(&mut Item) -> ItemAction,
pub fn retain_items<F>(&mut self, f: F)where
F: FnMut(&mut Item) -> ItemAction,
Retains or drops items based on the ItemAction
.
This method operates in place and preserves the order of the retained items.
Sourcepub fn drop_items_silently(&mut self)
pub fn drop_items_silently(&mut self)
Drops every item in the envelope.
Sourcepub fn scope(&mut self, scoping: Scoping) -> &mut Self
pub fn scope(&mut self, scoping: Scoping) -> &mut Self
Re-scopes this context to the given scoping.
Sourcepub fn reject_event(&mut self, outcome: Outcome)
pub fn reject_event(&mut self, outcome: Outcome)
Removes event item(s) and logs an outcome.
Note: This function relies on the envelope summary being correct.
Sourcepub fn track_outcome(
&self,
outcome: Outcome,
category: DataCategory,
quantity: usize,
)
pub fn track_outcome( &self, outcome: Outcome, category: DataCategory, quantity: usize, )
Records an outcome scoped to this envelope’s context.
This managed envelope should be updated using update
soon after this
operation to ensure that subsequent outcomes are consistent.
Sourcepub fn reject(&mut self, outcome: Outcome)
pub fn reject(&mut self, outcome: Outcome)
Records rejection outcomes for all items stored in this context.
This does not send outcomes for empty envelopes or request-only contexts.
Sourcepub fn partition_key(&self) -> Option<u32>
pub fn partition_key(&self) -> Option<u32>
Returns the partition key, which is set on upstream requests in the X-Sentry-Relay-Shard
header.
Sourcepub fn set_partition_key(&mut self, partition_key: Option<u32>) -> &mut Self
pub fn set_partition_key(&mut self, partition_key: Option<u32>) -> &mut Self
Sets a new Self::partition_key
.
Sourcepub fn estimated_size(&self) -> usize
pub fn estimated_size(&self) -> usize
Returns estimated size of this envelope.
This is just an estimated size, which in reality can be somewhat bigger, depending on the list of additional attributes allocated on all of the inner types.
NOTE: Current implementation counts in only the size of the items payload and stack
allocated parts of [Envelope
] and ManagedEnvelope
. All the heap allocated fields
within early mentioned types are skipped.
Sourcepub fn received_at(&self) -> DateTime<Utc>
pub fn received_at(&self) -> DateTime<Utc>
Returns the time at which the envelope was received at this Relay.
This is the date time equivalent to start_time
.
Trait Implementations§
Source§impl<G> Debug for TypedEnvelope<G>
impl<G> Debug for TypedEnvelope<G>
Source§impl<G> Deref for TypedEnvelope<G>
impl<G> Deref for TypedEnvelope<G>
Source§impl<G> DerefMut for TypedEnvelope<G>
impl<G> DerefMut for TypedEnvelope<G>
Source§impl<G> From<TypedEnvelope<G>> for ManagedEnvelope
impl<G> From<TypedEnvelope<G>> for ManagedEnvelope
Source§fn from(value: TypedEnvelope<G>) -> Self
fn from(value: TypedEnvelope<G>) -> Self
Source§impl<G: TryFrom<ProcessingGroup>> TryFrom<(ManagedEnvelope, ProcessingGroup)> for TypedEnvelope<G>
impl<G: TryFrom<ProcessingGroup>> TryFrom<(ManagedEnvelope, ProcessingGroup)> for TypedEnvelope<G>
Source§type Error = InvalidProcessingGroupType
type Error = InvalidProcessingGroupType
Auto Trait Implementations§
impl<G> Freeze for TypedEnvelope<G>
impl<G> !RefUnwindSafe for TypedEnvelope<G>
impl<G> Send for TypedEnvelope<G>where
G: Send,
impl<G> Sync for TypedEnvelope<G>where
G: Sync,
impl<G> Unpin for TypedEnvelope<G>where
G: Unpin,
impl<G> !UnwindSafe for TypedEnvelope<G>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request
§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered
].