Skip to content

Add toString to OtlpJsonLogging exporters - #8725

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

Add toString to OtlpJsonLogging exporters#8725
thswlsqls wants to merge 1 commit into
open-telemetry:mainfrom
thswlsqls:fix/otlp-json-logging-metric-exporter-tostring

Conversation

@thswlsqls

Copy link
Copy Markdown
Contributor

Fixes #8724

Description

  • OtlpJsonLoggingMetricExporter, OtlpJsonLoggingSpanExporter and OtlpJsonLoggingLogRecordExporter had no toString(), so they printed an identity hash such as OtlpJsonLoggingMetricExporter@6d06d69c.
  • These strings are user-visible: PeriodicMetricReader.toString() embeds the exporter as "exporter=" + exporter.
  • For the metric exporter this hid its only user-settable option, the AggregationTemporality passed to create(AggregationTemporality).
  • Formats match the siblings in :exporters:logging: LoggingMetricExporter{aggregationTemporality=...}, LoggingSpanExporter{}, SystemOutLogRecordExporter{}.
  • Delegating to the wrapped OtlpStdout*Exporter does not work: it is not exposed, and create(AggregationTemporality) never forwards the temporality, so the delegate still reports the builder default alwaysCumulative().
  • Same shape as Add toString to OTLP exporters #5686 and Add toString to ComposableAnnotatingSampler #8645; the metric format follows Include aggregation temporality in LoggingMetricExporter toString #8623.

Testing done

  • Added stringRepresentation() to OtlpJsonLoggingMetricExporterTest (cumulative and delta), OtlpJsonLoggingSpanExporterTest and OtlpJsonLoggingLogRecordExporterTest. All three fail on main and pass with this change.
  • ./gradlew :exporters:logging-otlp:check — 80 tests passed, 0 failures.
  • Committed the updated docs/apidiffs/current_vs_latest/opentelemetry-exporter-logging-otlp.txt.

@otelbot otelbot Bot added the api-change Changes to public API surface area label Aug 17, 2026
@otelbot

otelbot Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

⚠️ API changes detected — additional maintainer review required

@jack-berg @jkwatson

This PR modifies the public API surface area of the following module(s):

  • opentelemetry-exporter-logging-otlp

Please review the changes in docs/apidiffs/current_vs_latest/ carefully before approving.

@codecov

codecov Bot commented Aug 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.26%. Comparing base (f4bb945) to head (98c710b).

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #8725   +/-   ##
=========================================
  Coverage     91.26%   91.26%           
- Complexity    10461    10464    +3     
=========================================
  Files          1006     1006           
  Lines         28244    28247    +3     
  Branches       3564     3564           
=========================================
+ Hits          25778    25781    +3     
  Misses         1674     1674           
  Partials        792      792           

☔ 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

api-change Changes to public API surface area

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add toString to OtlpJsonLogging exporters

1 participant