This commit is contained in:
DDDonut 2026-08-26 21:05:17 -04:00 committed by GitHub
commit 56ee73c874
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 2 deletions

View file

@ -206,7 +206,7 @@ def build_metric_reader(config: OpenTelemetryV2Config) -> "MetricReader":
``console`` (and any unrecognized kind) exports to the console; ``otlp_http``
and ``otlp_grpc`` export over OTLP with the configured endpoint/headers. The
reader exports on a 5s period, matching v1.
reader uses the OpenTelemetry SDK's standard ``OTEL_METRIC_EXPORT_INTERVAL`` setting.
Histograms keep the SDK's default cumulative temporality. Prometheus-backed
OTLP receivers (Grafana Cloud / Mimir, and the Prometheus OTLP endpoint)
@ -248,7 +248,7 @@ def build_metric_reader(config: OpenTelemetryV2Config) -> "MetricReader":
else:
exporter = ConsoleMetricExporter()
return PeriodicExportingMetricReader(exporter, export_interval_millis=5000)
return PeriodicExportingMetricReader(exporter)
def _otlp_logs_endpoint(endpoint: str | None) -> str | None:

View file

@ -532,6 +532,14 @@ def test_otlp_metric_exporter_uses_cumulative_histogram_temporality():
assert temporality[Histogram] is AggregationTemporality.CUMULATIVE
def test_metric_reader_honors_standard_export_interval(monkeypatch):
monkeypatch.setenv("OTEL_METRIC_EXPORT_INTERVAL", "12345")
reader = providers.build_metric_reader(OpenTelemetryV2Config(exporter="console"))
assert reader._export_interval_millis == 12345
def test_otlp_logs_endpoint_normalization():
norm = providers._otlp_logs_endpoint
# A base endpoint gets the signal path appended (the common OTLP env shape).