Skip to main content

TelemetryEvent

Struct TelemetryEvent 

Source
pub struct TelemetryEvent {
    pub name: String,
    pub severity: Severity,
    pub body: Option<String>,
    pub attributes: Vec<Attribute>,
    pub timestamp_ns: Option<u64>,
    pub span_id: Option<u64>,
}
Expand description

A discrete telemetry event.

Exported as one OTLP log record whose event_name is name, following the OTel logs data model (events are log records with a top-level event name).

An unnamed Info record: a plain log record once it has a body (see SPEC.md).

Fields§

§name: String

Event name. LiveKit-defined events use the lk. prefix (e.g. lk.ping); see SPEC.md.

§severity: Severity

How serious it is (OTLP severity number and text).

§body: Option<String>

Optional human-readable message (the OTLP log record body).

§attributes: Vec<Attribute>

The record’s own attributes; the session’s are added when it is captured.

§timestamp_ns: Option<u64>

Wall-clock time in nanoseconds since the Unix epoch. None is stamped when the record is queued, never at export.

§span_id: Option<u64>

The in-flight span this record belongs to (a handle from begin_span), if any. The trace id is always the session’s and is attached by the core.

Implementations§

Source§

impl TelemetryEvent

Source

pub fn new(name: impl Into<String>) -> Self

An Info event without attributes, stamped when emitted.

Source

pub fn in_span(self, span: u64) -> Self

Link this record to an in-flight span.

Source

pub fn with_severity(self, severity: Severity) -> Self

The same event with severity.

Source

pub fn with_body(self, body: impl Into<String>) -> Self

The same event with a display body.

Source

pub fn with_attribute( self, key: impl Into<String>, value: impl Into<AttributeValue>, ) -> Self

The same event with one more attribute.

Source

pub fn custom(name: &str, attributes: Vec<Attribute>) -> Self

A consumer’s own event. Always namespaced under custom. so it can never be mistaken for a LiveKit-defined lk.* event, and the backend can filter or quota it separately; attributes keep the caller’s namespace (acme.checkout.step).

Source

pub fn size_hint(&self) -> usize

Rough encoded size in bytes — strings plus a fixed overhead per record and per attribute. Drives the byte bounds on queue flushing and request size; cheaper than encoding and close enough for both. The name is counted twice (event_name and otel.event.name), and again when it doubles as the body.

Counts the attributes the record carries: once queued, that includes its session’s (lk.room.*, lk.participant.*, session.id) and the app’s correlation attributes, all taken at capture. Pipeline-wide attributes are added at export and are not counted.

Trait Implementations§

Source§

impl Clone for TelemetryEvent

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for TelemetryEvent

Source§

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

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

impl Default for TelemetryEvent

Source§

fn default() -> Self

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

impl From<DeviceEvent> for TelemetryEvent

Source§

fn from(event: DeviceEvent) -> Self

The SPEC.md event for a device event, with its display body.

Source§

impl From<LogRecord> for TelemetryEvent

Source§

fn from(record: LogRecord) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for TelemetryEvent

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for TelemetryEvent

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
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

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

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FutureExt for T

Source§

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

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

fn with_current_context(self) -> WithContext<Self> ⓘ

Attaches the current Context to this type, returning a WithContext 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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

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

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

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

Source§

fn vzip(self) -> V