pub struct VenatorBuilder { /* private fields */ }
Implementations§
Source§impl VenatorBuilder
impl VenatorBuilder
Sourcepub fn with_host<H: Into<String>>(self, host: H) -> VenatorBuilder
pub fn with_host<H: Into<String>>(self, host: H) -> VenatorBuilder
This will set the host address of the Venator
layer used to connect to
the Venator app.
Setting the host again will overwrite the previous value. The default is
"127.0.0.1:8362"
.
§Examples
let venator_layer = Venator::builder()
.with_host("localhost:8362")
.build()
.install();
Sourcepub fn with_enter_events(self, emit: bool) -> VenatorBuilder
pub fn with_enter_events(self, emit: bool) -> VenatorBuilder
This configures whether the layer emits on_enter
and on_exit
events
to Venator.
This may not be desired if your case is entirely synchronous (thus “enter” and “exit” are redundant with “create” and “close”) or if your case is asynchronous and don’t need those events (also used for “busy” metric) and need to reduce the load.
Setting this again will overwrite the previous value. The default is
true
.
§Examples
let venator_layer = Venator::builder()
.with_enter_events(false)
.build()
.install();
Sourcepub fn with_attribute<A: Into<String>, V: Value>(
self,
attribute: A,
value: V,
) -> VenatorBuilder
pub fn with_attribute<A: Into<String>, V: Value>( self, attribute: A, value: V, ) -> VenatorBuilder
This will add an attribute to the Venator
layer. These will be
provided to the Venator app and all events and spans will have these
root attributes.
Providing an attribute with the same name as another will overwrite the
previous value. Note that some values (like None
) don’t record a
“value” and will not set or overwrite that attribute.
§Examples
let venator_layer = Venator::builder()
.with_attribute("service", "my_app")
.with_attribute("service.version", 5)
.with_attribute("environment", "dev")
.with_attribute("environment.debug", true)
.build()
.install();
Sourcepub fn build(self) -> Venator
pub fn build(self) -> Venator
This will build the Venator
layer. It will need to be added to another
subscriber via .with()
or installed globally with .install()
to be useful.
§Examples
let venator_layer = Venator::builder()
.with_host("localhost:8362")
.with_attribute("service", "my_app")
.with_attribute("environment", "dev")
.build();
tracing_subscriber::registry()
.with(venator_layer)
.with(tracing_subscriber::fmt::Layer::default())
.with(tracing_subscriber::EnvFilter::from_default_env())
.init();