Skip to main content
OpenTelemetry logging instrumentation for Mellea. Provides log export using OpenTelemetry Logs API with OTLP exporter support. Configuration via environment variables:
  • MELLEA_LOGS_OTLP: Enable OTLP log exporter (default: false)
  • OTEL_EXPORTER_OTLP_LOGS_ENDPOINT: Log-specific endpoint (optional, overrides general)
  • OTEL_EXPORTER_OTLP_ENDPOINT: General endpoint for all signals (fallback)
  • OTEL_SERVICE_NAME: Service name for logs (default: mellea)
Example: export MELLEA_LOGS_OTLP=true export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317 Programmatic usage: from mellea.telemetry.logging import get_otlp_log_handler import logging logger = logging.getLogger(“my_logger”) handler = get_otlp_log_handler() if handler: logger.addHandler(handler) logger.info(“This log will be exported via OTLP”)

Functions

FUNC get_otlp_log_handler

Get an OTLP logging handler for Python’s logging module. The logger provider is initialised on the first call so that environment variables set after module import (e.g. MELLEA_LOGS_OTLP) are respected without requiring a module reload. Returns:
  • LoggingHandler instance if OTLP logging is enabled and configured,
  • None otherwise.