rama::http::dep::core::telemetry::opentelemetry::logs

Trait LogRecord

pub trait LogRecord {
    // Required methods
    fn set_event_name(&mut self, name: &'static str);
    fn set_target<T>(&mut self, _target: T)
       where T: Into<Cow<'static, str>>;
    fn set_timestamp(&mut self, timestamp: SystemTime);
    fn set_observed_timestamp(&mut self, timestamp: SystemTime);
    fn set_severity_text(&mut self, text: &'static str);
    fn set_severity_number(&mut self, number: Severity);
    fn set_body(&mut self, body: AnyValue);
    fn add_attributes<I, K, V>(&mut self, attributes: I)
       where I: IntoIterator<Item = (K, V)>,
             K: Into<Key>,
             V: Into<AnyValue>;
    fn add_attribute<K, V>(&mut self, key: K, value: V)
       where K: Into<Key>,
             V: Into<AnyValue>;

    // Provided method
    fn set_trace_context(
        &mut self,
        trace_id: TraceId,
        span_id: SpanId,
        trace_flags: Option<TraceFlags>,
    ) { ... }
}
Expand description

SDK implemented trait for managing log records

Required Methods§

fn set_event_name(&mut self, name: &'static str)

Sets the event_name of a record

fn set_target<T>(&mut self, _target: T)
where T: Into<Cow<'static, str>>,

Sets the target of a record. Currently, both opentelemetry-appender-tracing and opentelemetry-appender-log create a single logger with a scope that doesn’t accurately reflect the component emitting the logs. Exporters MAY use this field to override the instrumentation_scope.name.

fn set_timestamp(&mut self, timestamp: SystemTime)

Sets the time when the event occurred measured by the origin clock, i.e. the time at the source.

fn set_observed_timestamp(&mut self, timestamp: SystemTime)

Sets the observed event timestamp.

fn set_severity_text(&mut self, text: &'static str)

Sets severity as text.

fn set_severity_number(&mut self, number: Severity)

Sets severity as a numeric value.

fn set_body(&mut self, body: AnyValue)

Sets the message body of the log.

fn add_attributes<I, K, V>(&mut self, attributes: I)
where I: IntoIterator<Item = (K, V)>, K: Into<Key>, V: Into<AnyValue>,

Adds multiple attributes.

fn add_attribute<K, V>(&mut self, key: K, value: V)
where K: Into<Key>, V: Into<AnyValue>,

Adds a single attribute.

Provided Methods§

fn set_trace_context( &mut self, trace_id: TraceId, span_id: SpanId, trace_flags: Option<TraceFlags>, )

Sets the trace context of the log.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§