Struct TypedEnvelope

Source
pub struct TypedEnvelope<G>(/* private fields */);
Expand description

A wrapper for ManagedEnvelope with assigned processing group type.

Implementations§

Source§

impl<G> TypedEnvelope<G>

Source

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.

Source

pub fn accept(self)

Accepts the envelope and drops the internal managed envelope with its context.

This should be called if the envelope has been accepted by the upstream, which means that the responsibility for logging outcomes has been moved. This function will not log any outcomes.

Methods from Deref<Target = ManagedEnvelope>§

Source

pub fn envelope(&self) -> &Envelope

Returns a reference to the contained [Envelope].

Source

pub fn envelope_mut(&mut self) -> &mut Envelope

Returns a mutable reference to the contained [Envelope].

Source

pub fn update(&mut self) -> &mut Self

Update the context with envelope information.

This updates the item summary as well as the event id.

Source

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.

Source

pub fn drop_items_silently(&mut self)

Drops every item in the envelope.

Source

pub fn scope(&mut self, scoping: Scoping) -> &mut Self

Re-scopes this context to the given scoping.

Source

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.

Source

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.

Source

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.

Source

pub fn scoping(&self) -> Scoping

Returns scoping stored in this context.

Source

pub fn partition_key(&self) -> Option<u32>

Returns the partition key, which is set on upstream requests in the X-Sentry-Relay-Shard header.

Source

pub fn set_partition_key(&mut self, partition_key: Option<u32>) -> &mut Self

Sets a new Self::partition_key.

Source

pub fn meta(&self) -> &RequestMeta

Returns the contained original request meta.

Source

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.

Source

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.

Source

pub fn age(&self) -> Duration

Returns the time elapsed in seconds since the envelope was received by this Relay.

In case the elapsed time is negative, it is assumed that no time elapsed.

Trait Implementations§

Source§

impl<G> Debug for TypedEnvelope<G>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<G> Deref for TypedEnvelope<G>

Source§

type Target = ManagedEnvelope

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<G> DerefMut for TypedEnvelope<G>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<G> From<TypedEnvelope<G>> for ManagedEnvelope

Source§

fn from(value: TypedEnvelope<G>) -> Self

Converts to this type from the input type.
Source§

impl<G: TryFrom<ProcessingGroup>> TryFrom<(ManagedEnvelope, ProcessingGroup)> for TypedEnvelope<G>

Source§

type Error = InvalidProcessingGroupType

The type returned in the event of a conversion error.
Source§

fn try_from( (envelope, group): (ManagedEnvelope, ProcessingGroup), ) -> Result<Self, Self::Error>

Performs the conversion.

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FutureExt for T

§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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

§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
§

impl<L> LayerExt<L> for L

§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in [Layered].
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSendSync for T