server.web.otlp

Server-specific OpenTelemetry instrumentation for jobmon.

This package contains server-specific OTLP functionality that should not be in the shared jobmon_core package. It handles:

  • FastAPI application instrumentation

  • SQLAlchemy engine instrumentation

  • Server-specific configuration patterns

  • Structured logging with structlog

Architecture: - Delegates to JobmonOTLPManager from core for shared functionality - Adds server-specific instrumentation methods - Provides server-specific structured logging handlers

Submodules

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.

Package Contents

server.web.otlp.OTLP_AVAILABLE = True[source]
class server.web.otlp.ServerOTLPManager[source]

Server-specific OTLP manager that builds on core functionality.

_core_manager: Any | None = None
_initialized = False
_fastapi_instrumented = False
_requests_instrumented = False
_sqlalchemy_instrumented = False
initialize() None[source]

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[source]

Get a tracer for the given name.

instrument_app(app: Any) None[source]

Instrument FastAPI application with OpenTelemetry.

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

classmethod instrument_requests() None[source]

Instrument requests library - server-specific implementation.

classmethod instrument_sqlalchemy() None[source]

Instrument SQLAlchemy globally - server-specific implementation.

classmethod instrument_engine(engine: Any) None[source]

Instrument a specific SQLAlchemy engine - server-specific implementation.

server.web.otlp.get_server_otlp_manager() ServerOTLPManager[source]

Get or create the server OTLP manager singleton.

server.web.otlp.initialize_server_otlp() ServerOTLPManager[source]

Initialize server-specific OTLP functionality.

This should be called by the server during startup.

Returns:

The server OTLP manager instance