server.web.otlp.manager

Server-specific OTLP manager that builds on core functionality.

Attributes

OTLP_AVAILABLE

Classes

ServerOTLPManager

Server-specific OTLP manager that builds on core functionality.

Functions

get_server_otlp_manager(→ ServerOTLPManager)

Get or create the server OTLP manager singleton.

initialize_server_otlp(→ ServerOTLPManager)

Initialize server-specific OTLP functionality.

Module Contents

server.web.otlp.manager.OTLP_AVAILABLE = True
class server.web.otlp.manager.ServerOTLPManager

Server-specific OTLP manager that builds on core functionality.

Initialize server OTLP manager.

initialize() None

Initialize the core OTLP manager for server use.

property tracer_provider: Any | None

Get the tracer provider from core manager.

property logger_provider: Any | None

Get the logger provider from core manager.

get_tracer(name: str) Any | None

Get a tracer for the given name.

instrument_app(app: Any) None

Instrument FastAPI application with OpenTelemetry.

This is server-specific functionality that should not be in core.

classmethod instrument_requests() None

Instrument requests library - server-specific implementation.

classmethod instrument_sqlalchemy() None

Instrument SQLAlchemy globally - server-specific implementation.

classmethod instrument_engine(engine: Any) Any

Instrument a specific SQLAlchemy engine with OpenTelemetry.

This directly creates an EngineTracer for the engine, bypassing the SQLAlchemyInstrumentor class. This is necessary because:

  1. SQLAlchemyInstrumentor uses a class-level is_instrumented_by_opentelemetry flag that prevents _instrument() from running if global instrumentation was already performed.

  2. Our engine.py imports create_engine BEFORE instrument_sqlalchemy() patches it, so engines are created with the unpatched function.

  3. The EngineTracer attaches event listeners for query tracing that wouldn’t otherwise be present.

Returns:

The EngineTracer instance (kept alive to prevent garbage collection of event listeners), or None if instrumentation failed.

server.web.otlp.manager.get_server_otlp_manager() ServerOTLPManager

Get or create the server OTLP manager singleton.

server.web.otlp.manager.initialize_server_otlp() ServerOTLPManager

Initialize server-specific OTLP functionality.

This should be called by the server during startup.

Returns:

The server OTLP manager instance