Skip to content

Include aggregation temporality in LoggingMetricExporter toString#8623

Draft
thswlsqls wants to merge 1 commit into
open-telemetry:mainfrom
thswlsqls:fix/logging-metric-exporter-tostring-temporality
Draft

Include aggregation temporality in LoggingMetricExporter toString#8623
thswlsqls wants to merge 1 commit into
open-telemetry:mainfrom
thswlsqls:fix/logging-metric-exporter-tostring-temporality

Conversation

@thswlsqls

Copy link
Copy Markdown
Contributor

Fixes #8622

Description

  • LoggingMetricExporter.toString() returned the constant "LoggingMetricExporter{}", so create(DELTA) and the default create() (CUMULATIVE) printed identically, hiding this exporter's only setting.
  • This reaches real debug output: OpenTelemetrySdk.toString() prints the meter provider, and PeriodicMetricReader.toString() appends "exporter=" + exporter.
  • The other three MetricExporter implementations that override toString() (OtlpGrpcMetricExporter, OtlpHttpMetricExporter, OtlpStdoutMetricExporter) already print their temporality.
  • Plain concatenation rather than StringJoiner, since there is a single field — the form used elsewhere for single-field toString() (e.g. SdkMeter, SdkObservableInstrument).
  • Precedent: Add missing fields to OTLP metric exporters #6402 "Add missing fields to OTLP metric exporters" fixed the same gap for the OTLP metric exporters and left this class out.
return "LoggingMetricExporter{aggregationTemporality=" + aggregationTemporality + "}";

Testing done

  • Extended LoggingMetricExporterTest#stringRepresentation to assert that create() prints CUMULATIVE and create(DELTA) prints DELTA; it fails against the old constant.
  • ./gradlew :exporters:logging:check --rerun-tasks — 15 tests passed.
  • No public API change (toString() signature unchanged), so no apidiff update.

@codecov

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.60%. Comparing base (63ebd94) to head (9945128).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #8623      +/-   ##
============================================
- Coverage     91.63%   91.60%   -0.03%     
- Complexity    10326    10343      +17     
============================================
  Files          1013     1013              
  Lines         27295    27352      +57     
  Branches       3205     3215      +10     
============================================
+ Hits          25011    25057      +46     
- Misses         1558     1567       +9     
- Partials        726      728       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LoggingMetricExporter toString omits aggregation temporality

1 participant