pub fn init4() -> Option<OtelGuard>Expand description
Init metrics and tracing, including OTLP if enabled.
This will perform the following:
- Read environment configuration for tracing
- Determine whether to enable OTLP
- Install a global tracing subscriber, using the OTLP provider if enabled
- Read environment configuration for metrics
- Install a global metrics recorder and serve it over HTTP on 0.0.0.0
See init_tracing and init_metrics for more
details on specific actions taken and env vars read.
ยงReturns
The OpenTelemetry guard, if OTLP is enabled. This guard should be kept alive for the lifetime of the program to ensure the exporter continues to send data to the remote API.