opentelemetry-configuration: OTLP HTTP exporter does not validate TLS files exist at startup

Aperta Adatta ai principianti
#5,928 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

@Dotify71 ci sta già lavorando.

Dal 12/11/2026.

  • #5929 di @Dotify71 — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
78/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python

Direzione di ricerca

Leggi i percorsi di creazione degli esportatori HTTP OTLP in _tracer_provider.py, _meter_provider.py e _logger_provider.py, quindi confronta la loro gestione di TLS con l’helper gRPC _read_tls_file(). Controlla come gli esportatori HTTP ricevono ca_file, key_file e cert_file e cerca i test di configurazione correlati. Il lavoro è completo quando i file TLS configurati mancanti o non leggibili causano ConfigurationError all’avvio degli esportatori HTTP.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Describe your environment
  • Component: opentelemetry-configuration
  • SDK Version: main (commit af91f2864c1ce6ee118bbb01e6d6fe7297e05275 / PR #5781)
  • Python Version: Python 3.10+
  • OS: All platforms
What happened?

In PR #5781, TLS and mTLS support was added to declarative configuration for both gRPC and HTTP exporters.

For otlp_grpc, certificate and key file paths are read and validated right away at startup using _read_tls_file(). If a path does not exist or cannot be read, it fails immediately with a clear ConfigurationError:

def _read_tls_file(path: str, field: str) -> bytes:
    try:
        with open(path, "rb") as file:
            return file.read()
    except OSError as exc:
        raise ConfigurationError(f"Failed to read tls.{field} '{path}': {exc}") from exc

However, for otlp_http exporters (_tracer_provider.py, _meter_provider.py, and _logger_provider.py), the file paths are passed straight to the exporter constructors (OTLPSpanExporter, OTLPMetricExporter, OTLPLogExporter) as raw strings without checking if the files actually exist or can be read.

Why this is a problem in production
  1. Delayed failures and silent data loss: If a user makes a typo in a certificate path or mounts a Kubernetes secret file with the wrong name or permissions, the service starts up normally without any warning or error. The failure only happens much later when the background worker thread tries to send batches of telemetry over HTTP, causing failed exports and lost data.
  2. Inconsistent behavior: otlp_grpc fails fast at startup with ConfigurationError, while otlp_http silently ignores missing files until runtime requests fail.
Steps to Reproduce
  1. Use an otel-config.yaml with a missing certificate path:
file_format: "1.0"
tracer_provider:
  processors:
    - simple:
        exporter:
          otlp_http:
            endpoint: https://collector.example.com:4318/v1/traces
            tls:
              ca_file: /path/to/missing_ca.pem
  1. Initialize OpenTelemetry:
from opentelemetry.configuration import load_config_file

load_config_file("otel-config.yaml")
  1. Startup finishes without any error or validation warning.
  2. If you change otlp_http to otlp_grpc, startup immediately fails fast with:
    ConfigurationError: Failed to read tls.ca_file '/path/to/missing_ca.pem'
Expected Result

_create_otlp_http_*_exporter should check that configured ca_file, key_file, and cert_file exist and are readable at startup (for example using _read_tls_file or a shared file validation helper), raising ConfigurationError to fail fast just like otlp_grpc.

Would you like to implement a fix?

Yes, happy to help open a pull request.

Lingua principale
Python
Stelle
2.7k
Fork
1.1k
Merge medio
4g 13m
PR unite (30g)
38

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di open-telemetry/opentelemetry-python

Tutte le issue di open-telemetry/opentelemetry-python

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.