Deprecate TextMapGetter keys method#8531
Conversation
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8531 +/- ##
============================================
- Coverage 91.64% 91.63% -0.02%
+ Complexity 10348 10347 -1
============================================
Files 1013 1013
Lines 27380 27381 +1
Branches 3218 3218
============================================
- Hits 25092 25090 -2
- Misses 1558 1559 +1
- Partials 730 732 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Added |
@jack-berg I've converted it to a draft. |
|
From the spec discussion: open-telemetry/opentelemetry-specification#5150 (comment)
So until the spec discussion is settled, can the |
jkwatson
left a comment
There was a problem hiding this comment.
I have no opinion one way or another on this one. I understand the appeal of being able to make this a functional interface, but it seems not good to have an empty iterable be the default, as that could end up being confusing for consumers. I'm fine with this either way.
Pull request dashboard statusStatus last refreshed: 2026-07-20 21:22:48 UTC.
This automated status or its linked feedback items may be incorrect. If something looks wrong, report it with the result you expected. |
|
Given that it's not actually used anywhere by OpenTelemetry itself, should the default implementation throw an UnsupportedOperationException? |
Signed-off-by: Arnab Nandy <arnab_nandy7@yahoo.com>
I think returning an empty iterable is safer than throwing Although most propagators do not use Given the ongoing spec discussion, I also think we should keep the default implementation but avoid deprecating |
|
This would only happen on custom lambda propagators, and I would rather my custom propagator explode loudly with an exception than having to spend hours or days trying to debug why it doesn't propagate baggage. 🙂 |
Signed-off-by: Arnab Nandy <arnab_nandy7@yahoo.com>
|
@cfredri4 I’ve updated the default I also removed the deprecation for now, since that broader decision is still being discussed in the specification. |
Description
Deprecates
TextMapGetter.keys()and gives it a default empty implementation soTextMapGettercan be used as a functional interface.This lets callers implement
TextMapGetterwith a lambda when onlyget()behavior is needed, while preserving existing carrier-key enumeration behavior for implementations that overridekeys().Changes
TextMapGetteras@FunctionalInterface.TextMapGetter.keys().keys()implementation returning an empty iterable.TextMapGetterimplementation.keys()usage in deprecated Jaeger and OT trace baggage extraction paths.opentelemetry-contextAPI diff.Testing
./gradlew :context:test --tests io.opentelemetry.context.propagation.TextMapGetterTest./gradlew :extensions:trace-propagators:compileJava./gradlew :context:jApiCmp./gradlew :context:spotlessApply :extensions:trace-propagators:spotlessApplygit diff --checkFixes #8470 and dependent on spec:5177