tracing_honeycomb

Function new_honeycomb_telemetry_layer_with_trace_sampling

Source
pub fn new_honeycomb_telemetry_layer_with_trace_sampling(
    service_name: &'static str,
    honeycomb_config: Config,
    sample_rate: u32,
) -> TelemetryLayer<HoneycombTelemetry<LibhoneyReporter>, SpanId, TraceId>
Expand description

Construct a TelemetryLayer that publishes telemetry to honeycomb.io using the provided honeycomb config, and sample rate.

This function differs from new_honeycomb_telemetry_layer and the sample_rate on the libhoney::Config there 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, the sample_rate parameter on the libhoney::Config should be set to 1, which is the default.

Specialized to the honeycomb.io-specific SpanId and TraceId provided by this crate.