core.otlp.handlers ================== .. py:module:: core.otlp.handlers .. autoapi-nested-parse:: Custom OTLP logging handlers that prevent global log pollution. Classes ------- .. autoapisummary:: core.otlp.handlers.JobmonOTLPLoggingHandler core.otlp.handlers.JobmonOTLPStructlogHandler Module Contents --------------- .. py:class:: JobmonOTLPLoggingHandler(level: int = logging.NOTSET, exporter: Optional[Union[Any, Dict]] = None) Bases: :py:obj:`logging.Handler` Universal OTLP logging handler supporting dict configs and pre-configured exporters. This handler follows the principle of single responsibility while being flexible enough to work with different configuration patterns: 1. Inline dict configuration (server pattern): handlers: otlp_logs: class: jobmon.core.otlp.JobmonOTLPLoggingHandler level: INFO exporter: module: opentelemetry.exporter.otlp.proto.grpc._log_exporter class: OTLPLogExporter endpoint: otelcol.dev.aks.scicomp.ihme.washington.edu:443 options: [["grpc.max_send_message_length", 16777216]] max_export_batch_size: 8 2. Pre-configured exporter instance: handler = JobmonOTLPLoggingHandler(exporter=my_exporter) .. py:attribute:: _exporter_config :value: None .. py:attribute:: _otlp_handler :type: Optional[logging.Handler] :value: None .. py:attribute:: _debug_mode .. py:method:: emit(record: logging.LogRecord) -> None Emit a log record to OTLP. .. py:method:: _create_handler() -> Optional[logging.Handler] Create OTLP handler by processing the exporter configuration. .. py:method:: _create_exporter_from_dict(config: Any) -> Optional[Any] Create an OTLP exporter from dictionary configuration (handles ConvertingDict). .. py:method:: _create_processor_from_dict(exporter: Any, config: Any) -> Any Create a batch processor with configuration from dict (handles ConvertingDict). .. py:class:: JobmonOTLPStructlogHandler(level: int = logging.NOTSET, exporter: Optional[Union[Any, Dict]] = None) Bases: :py:obj:`JobmonOTLPLoggingHandler` OTLP logging handler with structlog formatting for structured logs. This handler extends JobmonOTLPLoggingHandler to provide structured logging using structlog formatting before sending to OTLP.