forked from mtusi2026/mtusi2026lab6
fix: address otel-telemetry verify findings
Shutdown budget leaves room for SDK shutdown, stand-from-scratch accepts only its throwaway project, OTLP exporters ignore proxy environment, telemetry-check covers log/trace links, health series and worker instance id; spec deltas match what the parser and SDK lifetime allow. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -17,6 +17,9 @@ from contextlib import contextmanager, suppress
|
||||
from dataclasses import dataclass, field
|
||||
from typing import Any
|
||||
|
||||
# транспорт экспортёров OTLP/HTTP (зависимость opentelemetry-exporter-otlp-
|
||||
# proto-http): своя сессия без окружения
|
||||
import requests
|
||||
from opentelemetry import trace
|
||||
from opentelemetry.context import Context
|
||||
from opentelemetry.exporter.otlp.proto.http import Compression
|
||||
@@ -253,9 +256,18 @@ def start(
|
||||
return True
|
||||
|
||||
|
||||
def _export_session() -> requests.Session:
|
||||
"""Сессия отправки без окружения: `HTTP(S)_PROXY`, `NO_PROXY`, `.netrc`
|
||||
и `REQUESTS_CA_BUNDLE` на неё не действуют — данные идут только по адресу
|
||||
`[telemetry]` (verify S5, как с `OTEL_*`, решение 8)."""
|
||||
session = requests.Session()
|
||||
session.trust_env = False
|
||||
return session
|
||||
|
||||
|
||||
def _otlp_exporters(config: TelemetrySettings) -> Exporters:
|
||||
"""OTLP/HTTP protobuf только из `[telemetry]`: адрес, срок, без
|
||||
заголовков и сжатия."""
|
||||
заголовков и сжатия, своя сессия без прокси окружения."""
|
||||
timeout = config.export_timeout_seconds
|
||||
endpoint = config.otlp_endpoint
|
||||
return Exporters(
|
||||
@@ -264,6 +276,7 @@ def _otlp_exporters(config: TelemetrySettings) -> Exporters:
|
||||
headers={},
|
||||
timeout=timeout,
|
||||
compression=Compression.NoCompression,
|
||||
session=_export_session(),
|
||||
),
|
||||
metrics=PeriodicExportingMetricReader(
|
||||
OTLPMetricExporter(
|
||||
@@ -272,6 +285,7 @@ def _otlp_exporters(config: TelemetrySettings) -> Exporters:
|
||||
timeout=timeout,
|
||||
compression=Compression.NoCompression,
|
||||
preferred_temporality=_CUMULATIVE,
|
||||
session=_export_session(),
|
||||
),
|
||||
export_interval_millis=config.metric_export_interval_seconds
|
||||
* 1000,
|
||||
@@ -282,6 +296,7 @@ def _otlp_exporters(config: TelemetrySettings) -> Exporters:
|
||||
headers={},
|
||||
timeout=timeout,
|
||||
compression=Compression.NoCompression,
|
||||
session=_export_session(),
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user