Skip to content

chore(tracing-otel): inline HeadersTextMap{Getter,Setter} into OtelTracer#198

Merged
eschizoid merged 1 commit into
mainfrom
chore/otel-tracer-inline-textmap-adapters
Jun 19, 2026
Merged

chore(tracing-otel): inline HeadersTextMap{Getter,Setter} into OtelTracer#198
eschizoid merged 1 commit into
mainfrom
chore/otel-tracer-inline-textmap-adapters

Conversation

@eschizoid

Copy link
Copy Markdown
Owner

Summary

  • Both HeadersTextMapGetter and HeadersTextMapSetter were package-private SPI adapters with exactly one production callsite (OtelTracer itself), zero tests, zero examples. Their Javadoc already declared them as "Used by OtelTracer#..." — conceptually private helpers leaking out as top-level types.
  • Inlined both as private static final class nested inside OtelTracer (kept as parallel nested classes rather than mixing a lambda for the setter and a class for the getter — TextMapGetter has two methods so it can't be a lambda anyway, and the symmetric shape reads better).
  • Preserved the stateless-singleton INSTANCE semantics from the originals; callsites were updated from HeadersTextMapGetter.INSTANCE / HeadersTextMapSetter.INSTANCE to the nested HeadersGetter.INSTANCE / HeadersSetter.INSTANCE.
  • Dropped the [HeadersTextMapSetter] / [HeadersTextMapGetter] bullet from package-info.java and folded the propagation note into the OtelTracer bullet.

Cohesion win

  • The adapters are now invisible outside OtelTracer — they cannot be referenced from anywhere else in the module, which matches their actual usage. One fewer top-level surface for kpipe-tracing-otel to defend.
  • Two fewer compilation units in the module (3 → 1 production class).
  • LOC delta: -61 / +53 = -8 lines including the Javadoc carry-over and the new imports for TextMapGetter / TextMapSetter / Header / ArrayList / StandardCharsets in OtelTracer.

JPMS

  • module-info.java only exports io.github.eschizoid.kpipe.tracing.otel; (whole package). The deleted classes were package-private, so they were never independently visible. No module-info edit needed.

Test plan

  • ./gradlew :lib:kpipe-tracing-otel:test → BUILD SUCCESSFUL
  • grep -rn 'HeadersTextMapGetter\|HeadersTextMapSetter' lib/ examples/ benchmarks/ --include='*.java' --include='*.kt' returns no hits

…acer

Both adapters were package-private SPI helpers with exactly one production
callsite (OtelTracer itself), zero tests, zero examples. Their Javadoc already
declared them as "Used by OtelTracer#..." — conceptually private. Pulling them
into OtelTracer as private static nested final classes (preserving the
stateless-singleton INSTANCE shape) drops two top-level files, keeps the
TextMapGetter/Setter SPI shape intact, and tightens encapsulation: the
adapters now cannot be referenced from anywhere else in the module.

Net LOC: -61 / +53 = -8 lines, one less compilation unit.

JPMS unchanged: package-info still exports the same package; the deleted
classes were never independently exported, so no module-info edit needed.
@eschizoid

Copy link
Copy Markdown
Owner Author

@copilot please review

@codecov

codecov Bot commented Jun 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 60.00000% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.82%. Comparing base (4ccac98) to head (cb9d5e9).
⚠️ Report is 5 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...ithub/eschizoid/kpipe/tracing/otel/OtelTracer.java 60.00% 3 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##               main     #198   +/-   ##
=========================================
  Coverage     77.82%   77.82%           
+ Complexity      732      727    -5     
=========================================
  Files            68       66    -2     
  Lines          2800     2800           
  Branches        346      348    +2     
=========================================
  Hits           2179     2179           
  Misses          462      462           
  Partials        159      159           

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

@eschizoid eschizoid deleted the chore/otel-tracer-inline-textmap-adapters branch June 22, 2026 04:02
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.

1 participant