rama::telemetry::opentelemetry

Trait AttributesFactory

pub trait AttributesFactory<State>:
    Send
    + Sync
    + 'static {
    // Required method
    fn attributes(
        &self,
        size_hint: usize,
        ctx: &Context<State>,
    ) -> Vec<KeyValue>;
}
Expand description

Trait that can be used to implement your own attributes creator. It is used by layers as a starting point for attributes, and they will add their own attributes on top.

Required Methods§

fn attributes(&self, size_hint: usize, ctx: &Context<State>) -> Vec<KeyValue>

Create an attributes Vec.

The size_hint indicates how many attributes the callee may wish to add on top

Implementations on Foreign Types§

§

impl<State> AttributesFactory<State> for ()

§

fn attributes(&self, size_hint: usize, _ctx: &Context<State>) -> Vec<KeyValue>

§

impl<State> AttributesFactory<State> for Vec<KeyValue>

§

fn attributes(&self, size_hint: usize, _ctx: &Context<State>) -> Vec<KeyValue>

Implementors§

§

impl<State, F> AttributesFactory<State> for F
where F: Fn(usize, &Context<State>) -> Vec<KeyValue> + Send + Sync + 'static,