pub struct Builder<R> { /* private fields */ }Expand description
Builds Honeycomb Telemetry with custom configuration values.
Methods can be chained in order to set the configuration values. The
TelemetryLayer is constructed by calling build.
New instances of Builder are obtained via Builder::new_libhoney
or Builder::new_stdout.
Builder::new_stdout is useful when instrumenting e.g. AWS Lambda functions.
See more at AWS Lambda Instrumentation. For almost all other use cases you are probably
looking for Builder::new_libhoney.
Implementations§
Source§impl Builder<StdoutReporter>
impl Builder<StdoutReporter>
Sourcepub fn new_stdout(service_name: &'static str) -> Self
pub fn new_stdout(service_name: &'static str) -> Self
Returns a new Builder that reports data to stdout
Source§impl Builder<LibhoneyReporter>
impl Builder<LibhoneyReporter>
Sourcepub fn new_libhoney(service_name: &'static str, config: Config) -> Self
pub fn new_libhoney(service_name: &'static str, config: Config) -> Self
Returns a new Builder that reports data to a libhoney::Client
Source§impl<R: Reporter> Builder<R>
impl<R: Reporter> Builder<R>
Sourcepub fn with_trace_sampling(self, sample_rate: u32) -> Self
pub fn with_trace_sampling(self, sample_rate: u32) -> Self
Enables sampling for the telemetry layer.
The sample_rate on the libhoney::Config is different from this in an important way.
libhoney samples Event data, which is individual spans on each trace.
This means that using the sampling logic in libhoney may result in missing
event data or incomplete traces.
Calling this function provides trace-level sampling, meaning sampling
decisions are based on a modulo of the traceID, and events in a single trace
will not be sampled differently. If the trace is sampled, then all spans
under it will be sent to honeycomb. If a trace is not sampled, no spans or
events under it will be sent. When using this trace-level sampling,
when using a LibhoneyReporter the sample_rate parameter on the
libhoney::Config should be set to 1, which is the default.
Sourcepub fn build(self) -> TelemetryLayer<HoneycombTelemetry<R>, SpanId, TraceId>
pub fn build(self) -> TelemetryLayer<HoneycombTelemetry<R>, SpanId, TraceId>
Constructs the configured TelemetryLayer
Trait Implementations§
Auto Trait Implementations§
impl<R> Freeze for Builder<R>where
R: Freeze,
impl<R> RefUnwindSafe for Builder<R>where
R: RefUnwindSafe,
impl<R> Send for Builder<R>where
R: Send,
impl<R> Sync for Builder<R>where
R: Sync,
impl<R> Unpin for Builder<R>where
R: Unpin,
impl<R> UnwindSafe for Builder<R>where
R: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more