opentelemetry.configure_opentelemetry()

Configure all needed parts of OpenTelemetry.

Usage

Source

opentelemetry.configure_opentelemetry(
    *, service_name, config, span_processor=None
)

This needs to be called before constructing any objects that are instrumented, e.g. construction a FastAPI app before running this, will result in missing instrumentation.

Setup of the TracerProvider is done programmatically. If disabled, this is a no-op, leaving the default no-op TracerProvider from the OpenTelemetry API in place.

By default, spans are exported via OTLP over HTTP using a BatchSpanProcessor.