opentelemetry-configuration: OTLP HTTP exporter does not validate TLS files exist at startup
Maintainer antworten meist innerhalb von 2 Tagen
Bewertung
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Anfängerfreundlichkeit
- 78/100
- Issue-Typ
- Bug
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- python
- Bereich
- backend-api-design
Rechercherichtung
Lies die Erstellungswege der OTLP-HTTP-Exporter in _tracer_provider.py, _meter_provider.py und _logger_provider.py und vergleiche anschließend ihre TLS-Behandlung mit dem gRPC-Helfer _read_tls_file(). Prüfe, wie die HTTP-Exporter ca_file, key_file und cert_file erhalten, und suche nach verwandten Konfigurationstests. Fertig ist die Aufgabe, wenn nicht lesbare oder fehlende konfigurierte TLS-Dateien beim Start für HTTP-Exporter ConfigurationError auslösen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Describe your environment
- Component:
opentelemetry-configuration - SDK Version:
main(commitaf91f2864c1ce6ee118bbb01e6d6fe7297e05275/ 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
- 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.
- Inconsistent behavior:
otlp_grpcfails fast at startup withConfigurationError, whileotlp_httpsilently ignores missing files until runtime requests fail.
Steps to Reproduce
- Use an
otel-config.yamlwith 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
- Initialize OpenTelemetry:
from opentelemetry.configuration import load_config_file
load_config_file("otel-config.yaml")
- Startup finishes without any error or validation warning.
- If you change
otlp_httptootlp_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.
- Vorherrschende Sprache
- Python
- Sterne
- 2.7k
- Forks
- 1.1k
- Ø Merge
- 4 T. 13 Min.
- Gemergte PRs (30 T.)
- 38
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus open-telemetry/opentelemetry-python
-
W3CBaggagePropagator drops a list-member over 4096 bytes that W3C Baggage requires it to propagateEvtl. vergeben @codedbyadiiii hat das vor 8 Tagen übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
open-telemetry/opentelemetry-python#5913 ·
Maintainer antworten meist innerhalb von 2 Tagen
-
otel.sdk.processor.{span,log}.queue.capacity uses synchronous UpDownCounter recorded once in __init__Evtl. wieder frei Ein Pull Request dazu wurde ohne Merge geschlossen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
open-telemetry/opentelemetry-python#5891 ·
Maintainer antworten meist innerhalb von 2 Tagen
-
Prometheus map_unit incorrectly normalizes percent ratio units such as %/sEvtl. vergeben @knowprasad hat das vor 10 Tagen übernommen. Offenbug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
open-telemetry/opentelemetry-python#5875 · 1 Kommentar · 1 Reaktion ·
Maintainer antworten meist innerhalb von 2 Tagen
-
OTLP HTTP exporter reports a 3xx response as a successful export, so redirected batches are dropped without any logEvtl. vergeben @d4rshnn hat das vor 18 Tagen übernommen. Offenbug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
open-telemetry/opentelemetry-python#5865 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 2 Tagen
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 70/100
open-telemetry/opentelemetry-python#5700 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 2 Tagen
Alle Issues in open-telemetry/opentelemetry-python
Ähnliche Issues
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 66/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
docling-project/docling-pipelines#669 ·
Maintainer antworten meist innerhalb von 1 Tag
-
blocked kind/enhancement
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
opendatahub-io/agent-eval-harness#329 · 2 Kommentare · 1 Reaktion ·
-
cc_wrapper crashes with ValueError on Windows when a path is on another driveEvtl. vergeben @TrapsterDK hat das heute übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 79/100
tweag/rules_haskell#2492 ·
Maintainer antworten meist innerhalb von 1 Tag