NamedInternalEvent

Derive Macro NamedInternalEvent 

Source
#[derive(NamedInternalEvent)]
Expand description

Derives NamedInternalEvent so InternalEvent::name() returns a stable compile-time identifier for the event type.

Apply this derive to any struct that also implements InternalEvent or RegisterInternalEvent:

use vector_lib::internal_event::{InternalEvent, NamedInternalEvent};

#[derive(Debug, NamedInternalEvent)]
pub struct UdpSendIncompleteError {
    pub data_size: usize,
    pub sent: usize,
}

impl InternalEvent for UdpSendIncompleteError {
    fn emit(self) {
        // ... emit metrics/logging ...
    }
}

// Later, `UdpSendIncompleteError::name()` returns the string "UdpSendIncompleteError".

Notes:

  • Works with lifetimes and generics.
  • The generated implementation returns stringify!(TypeName) which avoids compiler-version-dependent module paths.