pub fn init(
otlp: Option<OtlpConfig>,
fmt_default_filter: &str,
otel_default_filter: &str,
tracer_name: &str,
) -> Result<TelemetryGuard, TelemetryError>Expand description
Install the global tracing subscriber.
The subscriber has a stdout JSON fmt layer. When otlp is Some, the
subscriber also has a batch OTLP export layer.
fmt_default_filter: thefmtlayer’s filter whenRUST_LOGis unset.otel_default_filter: the OTLP layer’s filter whenKRABKA_OTLP_FILTERis unset.tracer_name: the name that this function passes toTracerProvider::tracer(...).
You must call this function exactly one time, and from inside the tokio runtime. The gRPC exporter captures the current runtime handle.
§Errors
Returns TelemetryError::Exporter when an OTLP exporter cannot be built.
On wasm32-wasip1, returns TelemetryError::Unsupported for any OTLP
configuration and installs nothing.