Struct vector_core::event::EventMetadata

source ·
pub struct EventMetadata { /* private fields */ }
Expand description

The top-level metadata structure contained by both struct Metric and struct LogEvent types.

Implementations§

source§

impl EventMetadata

source

pub fn default_with_value(value: Value) -> Self

Creates EventMetadata with the given Value, and the rest of the fields with default values

source

pub fn value(&self) -> &Value

Returns a reference to the metadata value

source

pub fn value_mut(&mut self) -> &mut Value

Returns a mutable reference to the metadata value

source

pub fn secrets(&self) -> &Secrets

Returns a reference to the secrets

source

pub fn secrets_mut(&mut self) -> &mut Secrets

Returns a mutable reference to the secrets

source

pub fn source_id(&self) -> Option<&Arc<ComponentKey>>

Returns a reference to the metadata source id.

source

pub fn source_type(&self) -> Option<&str>

Returns a reference to the metadata source type.

source

pub fn upstream_id(&self) -> Option<&OutputId>

Returns a reference to the metadata parent id. This is the OutputId of the previous component the event was sent through (if any).

source

pub fn set_source_id(&mut self, source_id: Arc<ComponentKey>)

Sets the source_id in the metadata to the provided value.

source

pub fn set_source_type<S: Into<Cow<'static, str>>>(&mut self, source_type: S)

Sets the source_type in the metadata to the provided value.

source

pub fn set_upstream_id(&mut self, upstream_id: Arc<OutputId>)

Sets the upstream_id in the metadata to the provided value.

source

pub fn datadog_api_key(&self) -> Option<Arc<str>>

Return the datadog API key, if it exists

source

pub fn set_datadog_api_key(&mut self, secret: Arc<str>)

Set the datadog API key to passed value

source

pub fn splunk_hec_token(&self) -> Option<Arc<str>>

Return the splunk hec token, if it exists

source

pub fn set_splunk_hec_token(&mut self, secret: Arc<str>)

Set the splunk hec token to passed value

source

pub fn add_dropped_field(&mut self, meaning: KeyString, value: Value)

Adds the value to the dropped fields list. There is currently no way to remove a field from this list, so if a field is dropped and then the field is re-added with a new value - the dropped value will still be retrieved.

source

pub fn dropped_field(&self, meaning: impl AsRef<str>) -> Option<&Value>

Fetches the dropped field by meaning.

source

pub fn datadog_origin_metadata(&self) -> Option<&DatadogMetricOriginMetadata>

Returns a reference to the DatadogMetricOriginMetadata.

source

pub fn source_event_id(&self) -> Option<Uuid>

Returns a reference to the event id.

source§

impl EventMetadata

source

pub fn with_finalizer(self, finalizer: EventFinalizer) -> Self

Replaces the existing event finalizers with the given one.

source

pub fn with_finalizers(self, finalizers: EventFinalizers) -> Self

Replaces the existing event finalizers with the given ones.

source

pub fn with_batch_notifier(self, batch: &BatchNotifier) -> Self

Replace the finalizer with a new one created from the given batch notifier.

source

pub fn with_batch_notifier_option(self, batch: &Option<BatchNotifier>) -> Self

Replace the finalizer with a new one created from the given optional batch notifier.

source

pub fn with_schema_definition(self, schema_definition: &Arc<Definition>) -> Self

Replace the schema definition with the given one.

source

pub fn with_source_type<S: Into<Cow<'static, str>>>( self, source_type: S, ) -> Self

Replaces the existing source_type with the given one.

source

pub fn with_origin_metadata( self, origin_metadata: DatadogMetricOriginMetadata, ) -> Self

Replaces the existing DatadogMetricOriginMetadata with the given one.

source

pub fn with_source_event_id(self, source_event_id: Option<Uuid>) -> Self

Replaces the existing source_event_id with the given one.

source

pub fn merge(&mut self, other: Self)

Merge the other EventMetadata into this. If a Datadog API key is not set in self, the one from other will be used. If a Splunk HEC token is not set in self, the one from other will be used.

source

pub fn update_status(&self, status: EventStatus)

Update the finalizer(s) status.

source

pub fn update_sources(&mut self)

Update the finalizers’ sources.

source

pub fn finalizers(&self) -> &EventFinalizers

Gets a reference to the event finalizers.

source

pub fn add_finalizer(&mut self, finalizer: EventFinalizer)

Add a new event finalizer to the existing list of event finalizers.

source

pub fn take_finalizers(&mut self) -> EventFinalizers

Consumes all event finalizers and returns them, leaving the list of event finalizers empty.

source

pub fn merge_finalizers(&mut self, finalizers: EventFinalizers)

Merges the given event finalizers into the existing list of event finalizers.

source

pub fn schema_definition(&self) -> &Arc<Definition>

Get the schema definition.

source

pub fn set_schema_definition(&mut self, definition: &Arc<Definition>)

Set the schema definition.

source

pub fn add_schema_meaning( &mut self, target_path: OwnedTargetPath, meaning: &str, )

Helper function to add a semantic meaning to the schema definition.

This replaces the common code sequence of:

let new_schema = log_event
    .metadata()
    .schema_definition()
    .as_ref()
    .clone()
    .with_meaning(target_path, meaning);
log_event
    .metadata_mut()
    .set_schema_definition(new_schema);

Trait Implementations§

source§

impl ByteSizeOf for EventMetadata

source§

fn allocated_bytes(&self) -> usize

Returns the allocated bytes of this type Read more
§

fn size_of(&self) -> usize

Returns the in-memory size of this type Read more
source§

impl Clone for EventMetadata

source§

fn clone(&self) -> EventMetadata

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for EventMetadata

source§

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

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

impl Default for EventMetadata

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for EventMetadata

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl EventDataEq for EventMetadata

source§

fn event_data_eq(&self, _other: &Self) -> bool

source§

impl From<EventMetadata> for Metadata

source§

fn from(value: EventMetadata) -> Self

Converts to this type from the input type.
source§

impl From<Metadata> for EventMetadata

source§

fn from(value: Metadata) -> Self

Converts to this type from the input type.
source§

impl PartialEq for EventMetadata

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for EventMetadata

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

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
§

impl<T> ArchivePointee for T

§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
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
§

impl<F, W, T, D> Deserialize<With<T, W>, D> for F
where W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,

§

fn deserialize( &self, deserializer: &mut D, ) -> Result<With<T, W>, <D as Fallible>::Error>

Deserializes using the given deserializer
source§

impl<T> DynClone for T
where T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FromRef<T> for T
where T: Clone,

§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
§

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> IntoRequest<T> for T

source§

fn into_request(self) -> Request<T>

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

impl<T> LayoutRaw for T

§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Gets the layout of the type.
§

impl<Source, Target> OctetsInto<Target> for Source
where Target: OctetsFrom<Source>,

§

type Error = <Target as OctetsFrom<Source>>::Error

§

fn try_octets_into( self, ) -> Result<Target, <Source as OctetsInto<Target>>::Error>

Performs the conversion.
§

fn octets_into(self) -> Target
where Self::Error: Into<Infallible>,

Performs an infallible conversion.
§

impl<D> OwoColorize for D

§

fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>
where C: Color,

Set the foreground color generically Read more
§

fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>
where C: Color,

Set the background color generically. Read more
§

fn black<'a>(&'a self) -> FgColorDisplay<'a, Black, Self>

Change the foreground color to black
§

fn on_black<'a>(&'a self) -> BgColorDisplay<'a, Black, Self>

Change the background color to black
§

fn red<'a>(&'a self) -> FgColorDisplay<'a, Red, Self>

Change the foreground color to red
§

fn on_red<'a>(&'a self) -> BgColorDisplay<'a, Red, Self>

Change the background color to red
§

fn green<'a>(&'a self) -> FgColorDisplay<'a, Green, Self>

Change the foreground color to green
§

fn on_green<'a>(&'a self) -> BgColorDisplay<'a, Green, Self>

Change the background color to green
§

fn yellow<'a>(&'a self) -> FgColorDisplay<'a, Yellow, Self>

Change the foreground color to yellow
§

fn on_yellow<'a>(&'a self) -> BgColorDisplay<'a, Yellow, Self>

Change the background color to yellow
§

fn blue<'a>(&'a self) -> FgColorDisplay<'a, Blue, Self>

Change the foreground color to blue
§

fn on_blue<'a>(&'a self) -> BgColorDisplay<'a, Blue, Self>

Change the background color to blue
§

fn magenta<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>

Change the foreground color to magenta
§

fn on_magenta<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>

Change the background color to magenta
§

fn purple<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>

Change the foreground color to purple
§

fn on_purple<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>

Change the background color to purple
§

fn cyan<'a>(&'a self) -> FgColorDisplay<'a, Cyan, Self>

Change the foreground color to cyan
§

fn on_cyan<'a>(&'a self) -> BgColorDisplay<'a, Cyan, Self>

Change the background color to cyan
§

fn white<'a>(&'a self) -> FgColorDisplay<'a, White, Self>

Change the foreground color to white
§

fn on_white<'a>(&'a self) -> BgColorDisplay<'a, White, Self>

Change the background color to white
§

fn default_color<'a>(&'a self) -> FgColorDisplay<'a, Default, Self>

Change the foreground color to the terminal default
§

fn on_default_color<'a>(&'a self) -> BgColorDisplay<'a, Default, Self>

Change the background color to the terminal default
§

fn bright_black<'a>(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>

Change the foreground color to bright black
§

fn on_bright_black<'a>(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>

Change the background color to bright black
§

fn bright_red<'a>(&'a self) -> FgColorDisplay<'a, BrightRed, Self>

Change the foreground color to bright red
§

fn on_bright_red<'a>(&'a self) -> BgColorDisplay<'a, BrightRed, Self>

Change the background color to bright red
§

fn bright_green<'a>(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>

Change the foreground color to bright green
§

fn on_bright_green<'a>(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>

Change the background color to bright green
§

fn bright_yellow<'a>(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>

Change the foreground color to bright yellow
§

fn on_bright_yellow<'a>(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>

Change the background color to bright yellow
§

fn bright_blue<'a>(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>

Change the foreground color to bright blue
§

fn on_bright_blue<'a>(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>

Change the background color to bright blue
§

fn bright_magenta<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>

Change the foreground color to bright magenta
§

fn on_bright_magenta<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>

Change the background color to bright magenta
§

fn bright_purple<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>

Change the foreground color to bright purple
§

fn on_bright_purple<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>

Change the background color to bright purple
§

fn bright_cyan<'a>(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>

Change the foreground color to bright cyan
§

fn on_bright_cyan<'a>(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>

Change the background color to bright cyan
§

fn bright_white<'a>(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>

Change the foreground color to bright white
§

fn on_bright_white<'a>(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>

Change the background color to bright white
§

fn bold<'a>(&'a self) -> BoldDisplay<'a, Self>

Make the text bold
§

fn dimmed<'a>(&'a self) -> DimDisplay<'a, Self>

Make the text dim
§

fn italic<'a>(&'a self) -> ItalicDisplay<'a, Self>

Make the text italicized
§

fn underline<'a>(&'a self) -> UnderlineDisplay<'a, Self>

Make the text italicized
Make the text blink
Make the text blink (but fast!)
§

fn reversed<'a>(&'a self) -> ReversedDisplay<'a, Self>

Swap the foreground and background colors
§

fn hidden<'a>(&'a self) -> HiddenDisplay<'a, Self>

Hide the text
§

fn strikethrough<'a>(&'a self) -> StrikeThroughDisplay<'a, Self>

Cross out the text
§

fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>
where Color: DynColor,

Set the foreground color at runtime. Only use if you do not know which color will be used at compile-time. If the color is constant, use either OwoColorize::fg or a color-specific method, such as OwoColorize::green, Read more
§

fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>
where Color: DynColor,

Set the background color at runtime. Only use if you do not know what color to use at compile-time. If the color is constant, use either OwoColorize::bg or a color-specific method, such as OwoColorize::on_yellow, Read more
§

fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the foreground color to a specific RGB value.
§

fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the background color to a specific RGB value.
§

fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>

Sets the foreground color to an RGB value.
§

fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>

Sets the background color to an RGB value.
§

fn style(&self, style: Style) -> Styled<&Self>

Apply a runtime-determined style
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Pointee for T

§

type Metadata = ()

The type for metadata in pointers and references to Self.
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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>,

§

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
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,