Support output_stream in declarative config of otlp_file/development - #8676
Open
robintra wants to merge 2 commits into
Open
Support output_stream in declarative config of otlp_file/development#8676robintra wants to merge 2 commits into
robintra wants to merge 2 commits into
Conversation
|
|
robintra
force-pushed
the
declarative-config-output-stream
branch
from
July 31, 2026 16:38
b3ab6ed to
3d94c71
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8676 +/- ##
============================================
+ Coverage 91.47% 91.48% +0.01%
- Complexity 10465 10471 +6
============================================
Files 1021 1022 +1
Lines 27694 27722 +28
Branches 3247 3251 +4
============================================
+ Hits 25333 25362 +29
+ Misses 1617 1615 -2
- Partials 744 745 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Pull request dashboard statusWaiting on reviewers · refreshed 2026-07-31 19:39 UTC Review the latest changes. Status above doesn't look right?
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #8675.
The OTLP file exporter builders already accept an arbitrary
OutputStreamand the generated config model already carriesoutput_stream, but the declarative configuration component providers never read it so only stdout was reachable without writing code. The support table inopentelemetry-configurationreports Java asnot_implementedfor this option, while C++ and PHP reportsupported.This wires the option through for spans, metrics and logs:
stdoutsetsSystem.outexplicitly, rather than relying on the default installed by the staticbuilder()factory. Matching is case-insensitive, like the sibling options parsed in the samecreate()call.java.net.URI, so bothfile:///pathand the authority-lessfile:/pathare accepted, with any scheme casing. Missing parent directories are created, the file is opened withCREATE+APPENDand the stream is wrapped in aBufferedOutputStream.StreamJsonWriterflushes after every record so buffering does not delay output.ConfigurationException, distinguishing an unusable value from a file that could not be opened.Two choices worth confirming:
Tests are added to
AbstractOtlpStdoutExporterTestso they run for all three signals:stdout, a plainfile://URI producing the expected JSON, the authority-less and upper case URI form, parent directory creation, an unrecognized value, and a path that cannot be opened.DeclarativeConfigurationCreateTest.parseAndCreate_Examplesneeded one adjustment. TheExperimentalOtlpFile*_file.yamlsnippets write tofile:///var/log/*.jsonl, which is not writable in tests. The test already rewritesca_file,key_fileandcert_fileto temp files for the same reason sooutput_streamis rewritten the same way.Two limitations are left as-is, since addressing either would go beyond wiring up the option. I am happy to follow up if maintainers want them handled here:
StreamJsonWriterdoes not synchronize so concurrent writes can interleave.Verification
./gradlew :exporters:logging-otlp:checkand./gradlew :sdk-extensions:declarative-config:checkpass.jApiCmpreports no API change since the new class lives in aninternalpackage sodocs/apidiffsis unchanged.Also verified end to end with a throwaway test that runs
DeclarativeConfiguration.parseAndCreateon:and confirms the span is written as one JSON line to the file with nothing on stdout.