init_loki_with_opentelemetry

Function init_loki_with_opentelemetry 

Source
pub fn init_loki_with_opentelemetry(
    loki_config: &LokiConfig,
    service_name: &str,
) -> Result<()>
Expand description

Initializes Loki logging with OpenTelemetry integration for distributed tracing.

This function sets up both Loki logging and OpenTelemetry tracing, creating an integrated observability pipeline. OpenTelemetry traces can be correlated with logs, providing a unified view of request flows across distributed systems. The integration enriches logs with trace context and enables more powerful debugging and monitoring capabilities.

§Parameters

  • loki_config - Configuration for the Loki connection and log processing
  • service_name - Name of the service, used for identifying the source in traces and logs

§Errors

Returns an error if the Loki layer or OpenTelemetry initialization fails, including configuration errors, connection issues, or pipeline setup problems