Skip to content

Low allocation OTLP marshalers for OtlpJsonLogging{Signal}Exporters#7616

Closed
vasantteja wants to merge 14 commits into
open-telemetry:mainfrom
vasantteja:low-allocation-marshalers-for-json-exporter
Closed

Low allocation OTLP marshalers for OtlpJsonLogging{Signal}Exporters#7616
vasantteja wants to merge 14 commits into
open-telemetry:mainfrom
vasantteja:low-allocation-marshalers-for-json-exporter

Conversation

@vasantteja

Copy link
Copy Markdown
Contributor

Resolves #6474

@vasantteja vasantteja requested a review from a team as a code owner August 26, 2025 01:18
@codecov

codecov Bot commented Aug 26, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.01%. Comparing base (68fcd44) to head (e1fc21e).
⚠️ Report is 14 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #7616   +/-   ##
=========================================
  Coverage     90.01%   90.01%           
- Complexity     7090     7096    +6     
=========================================
  Files           803      803           
  Lines         21443    21461   +18     
  Branches       2092     2092           
=========================================
+ Hits          19301    19319   +18     
  Misses         1477     1477           
  Partials        665      665           

☔ View full report in Codecov by Sentry.
📢 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.

Co-authored-by: Hilmar Falkenberg <hilmar.falkenberg@sap.com>
@linux-foundation-easycla

linux-foundation-easycla Bot commented Sep 6, 2025

Copy link
Copy Markdown

CLA Signed

The committers listed above are authorized under a signed CLA.

@vasantteja

vasantteja commented Sep 6, 2025

Copy link
Copy Markdown
Contributor Author

CLA Not Signed

@hilmarf Can you please sign this so that I can include your suggestion?

@jkwatson jkwatson left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable to me. Thanks!

@jkwatson

jkwatson commented Sep 7, 2025

Copy link
Copy Markdown
Contributor

@hilmarf Are you able to sign the CLA, so we can accept your contribution to this PR?

@zeitlinger

Copy link
Copy Markdown
Member

I'll also do a review.

@zeitlinger

Copy link
Copy Markdown
Member

Thanks a lot for the PR 😄

  • setMemoryMode and boolean useLowAllocation do the same thing - so we should stick to setMemoryMode
  • setWrapperJsonObject and useLowAllocation is unrelated - I don't understand why it was renamed
  • OtlpJsonLogging{Signal}Exporter is kind of deprecated
    • If you want to have more options, such as low allocation, you can use OtlpStdout{Signal}Exporter
    • e.g. OtlpStdoutLogRecordExporter.builder().setMemoryMode(MemoryMode.REUSABLE_DATA).build()

In total, I don't understand what is possible with this PR that was not possible before.

@jkwatson

jkwatson commented Sep 11, 2025

Copy link
Copy Markdown
Contributor
  • setWrapperJsonObject and useLowAllocation is unrelated - I don't understand why it was renamed

"setWrapperJsonObject" doens't mean anything to the end user. The new API is a request for low allocation, so it makes sense to name the boolean after what the user wants, rather than an implementation detail. I'm not sure about the internal renames and if it makes sense to have them as well.

@vasantteja

Copy link
Copy Markdown
Contributor Author

Thanks a lot for the PR 😄

  • setMemoryMode and boolean useLowAllocation do the same thing - so we should stick to setMemoryMode

  • setWrapperJsonObject and useLowAllocation is unrelated - I don't understand why it was renamed

  • OtlpJsonLogging{Signal}Exporter is kind of deprecated

    • If you want to have more options, such as low allocation, you can use OtlpStdout{Signal}Exporter
    • e.g. OtlpStdoutLogRecordExporter.builder().setMemoryMode(MemoryMode.REUSABLE_DATA).build()

In total, I don't understand what is possible with this PR that was not possible before.

Thanks for the feedback! You're absolutely right - I'm planning to close this PR and I believe we can close the related issue.

Why:

  1. Functionality already exists: Users can already get low allocation with OtlpStdoutMetricExporter.builder().setMemoryMode(MemoryMode.REUSABLE_DATA).build()

  2. API duplication: setMemoryMode and boolean useLowAllocation do the same thing, creating confusion

  3. Architectural mismatch: OtlpJsonLogging*Exporter are legacy compatibility wrappers. New features belong in the modern OtlpStdout*Exporter APIs.

  4. Conflated concerns: JSON wrapper format and memory allocation are separate concepts that shouldn't be tied together

The right solution:

Direct users to the existing, better API:

OtlpStdoutMetricExporter.builder().setMemoryMode(MemoryMode.REUSABLE_DATA).build()

This keeps the architecture clean and avoids unnecessary API complexity. Thanks for the thoughtful review! Let me know your thoughts.

CC: @zeitlinger, @jkwatson

@vasantteja vasantteja closed this Sep 12, 2025
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.

OtlpJsonLogging{Signal}Exporters should have option to use low allocation OTLP marshalers

4 participants