Skip to content

fix(config): Move ObjectMapper to internal YamlObjectMapper class#8075

Open
MikeGoldsmith wants to merge 1 commit intoopen-telemetry:mainfrom
honeycombio:mike/move-objectmapper-to-internal
Open

fix(config): Move ObjectMapper to internal YamlObjectMapper class#8075
MikeGoldsmith wants to merge 1 commit intoopen-telemetry:mainfrom
honeycombio:mike/move-objectmapper-to-internal

Conversation

@MikeGoldsmith
Copy link
Member

Summary

Moves ObjectMapper configuration from package-private field in DeclarativeConfiguration to new public internal class YamlObjectMapper. Spring starter and other external code can now access the configured ObjectMapper without reflection.

Fixes #7843

Changes

  • New class: YamlObjectMapper in internal package with singleton getInstance() method
  • Refactored: DeclarativeConfiguration to use YamlObjectMapper.getInstance() instead of static MAPPER field
  • Removed now-unused Jackson imports from DeclarativeConfiguration

Testing

  • All existing tests pass

Spring starter needs same ObjectMapper config but can't access
package-private field without reflection. New public internal class
provides access.

Fixes open-telemetry#7843
@MikeGoldsmith MikeGoldsmith requested a review from a team as a code owner February 12, 2026 13:49
@MikeGoldsmith MikeGoldsmith changed the title fix(config: Move ObjectMapper to internal YamlObjectMapper class. fix(config): Move ObjectMapper to internal YamlObjectMapper class Feb 12, 2026
@codecov
Copy link

codecov bot commented Feb 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.20%. Comparing base (f42ac7d) to head (258835a).

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #8075   +/-   ##
=========================================
  Coverage     90.20%   90.20%           
- Complexity     7593     7595    +2     
=========================================
  Files           841      842    +1     
  Lines         22913    22915    +2     
  Branches       2289     2289           
=========================================
+ Hits          20668    20670    +2     
  Misses         1529     1529           
  Partials        716      716           

☔ 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.

@jack-berg
Copy link
Member

@zeitlinger / @trask is this still needed from the instrumentation side? The last comment in the issue indicates a preference for copy / paste rather than letting consumers leverage the same object mapper:

I personally prefer a bit of copy-paste over relying on internal APIs

My perspective: in addition to not relying on internal APIs, I don't like being in the business of having an API (public or internal) to access a jackson ObjectMapper. That's not our business.

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.

move declarative config ObjectMapper instance to internal class

2 participants