opentelemetry-configuration: OTLP HTTP exporter does not validate TLS files exist at startup
Maintainer thường phản hồi trong vòng 2 ngày
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 78/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- python
- Lĩnh vực
- backend-api-design
Hướng nghiên cứu
Đọc các đường dẫn tạo trình xuất HTTP OTLP trong _tracer_provider.py, _meter_provider.py và _logger_provider.py, sau đó so sánh cách xử lý TLS của chúng với hàm trợ giúp gRPC _read_tls_file(). Kiểm tra cách các trình xuất HTTP nhận ca_file, key_file và cert_file, đồng thời tìm các kiểm thử cấu hình liên quan. Công việc hoàn tất khi các tệp TLS đã cấu hình nhưng bị thiếu hoặc không thể đọc gây ra ConfigurationError lúc khởi động các trình xuất HTTP.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Python
- Star
- 2.7k
- Fork
- 1.1k
- Merge trung bình
- 4 ngày 13 phút
- Pull request đã merge (30 ngày)
- 38
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của open-telemetry/opentelemetry-python
-
W3CBaggagePropagator drops a list-member over 4096 bytes that W3C Baggage requires it to propagateCó thể đã có người làm @codedbyadiiii đã nhận 7 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
open-telemetry/opentelemetry-python#5913 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
otel.sdk.processor.{span,log}.queue.capacity uses synchronous UpDownCounter recorded once in __init__Có thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
open-telemetry/opentelemetry-python#5891 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Prometheus map_unit incorrectly normalizes percent ratio units such as %/sCó thể đã có người làm @knowprasad đã nhận 10 ngày trước. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
open-telemetry/opentelemetry-python#5875 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 2 ngày
-
OTLP HTTP exporter reports a 3xx response as a successful export, so redirected batches are dropped without any logCó thể đã có người làm @d4rshnn đã nhận 18 ngày trước. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
open-telemetry/opentelemetry-python#5865 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 70/100
open-telemetry/opentelemetry-python#5700 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của open-telemetry/opentelemetry-python
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
docling-project/docling-pipelines#669 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
blocked kind/enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
opendatahub-io/agent-eval-harness#329 · 2 bình luận · 1 reaction ·
-
cc_wrapper crashes with ValueError on Windows when a path is on another driveCó thể đã có người làm @TrapsterDK đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
tweag/rules_haskell#2492 ·
Maintainer thường phản hồi trong vòng 1 ngày