BaggagePropagation implements Propagation<K> { public static List<String> allKeyNames(Propagation<String> propagation) { if (propagation == null) throw new NullPointerException("propagation == null"); TraceContextOrSamplingFlags emptyExtraction = propagation.extractor(NoopGetter.INSTANCE).extract(Boolean.TRUE); List<String> baggageKeyNames = getAllKeyNames(emptyExtraction); if (baggageKeyNames.isEmpty()) return propagation.keys(); List<String> result = new ArrayList<>(propagation.keys().size() + baggageKeyNames.size()); result.addAll(propagation.keys()); result.addAll(baggageKeyNames); return Collections.unmodifiableList(result); } BaggagePropagation(Propagation<K> delegate); static FactoryBuilder newFactoryBuilder(Propagation.Factory delegate); @Override List<K> keys(); static List<String> allKeyNames(Propagation<String> propagation); @Override Injector<R> injector(Setter<R, K> setter); @Override Extractor<R> extractor(Getter<R, K> getter);  }
@Test public void allKeyNames_extraFieldPropagation() { ExtraFieldPropagation.Factory factory = ExtraFieldPropagation.newFactory(B3SinglePropagation.FACTORY, "user-id", "session-id"); assertThat(BaggagePropagation.allKeyNames(factory.get())) .containsExactly("b3", "user-id", "session-id"); }