@@ -176,7 +176,8 @@ static class BraveNoBaggageConfiguration {
176
176
Factory propagationFactory (TracingProperties properties ) {
177
177
Iterable <Factory > injectorFactories = PropagationFactoryFactory
178
178
.factoriesFor (properties .getPropagation ().getType ());
179
- Iterable <Factory > extractorFactories = PropagationFactoryFactory .factoriesFor (PropagationType .values ());
179
+ Iterable <Factory > extractorFactories = PropagationFactoryFactory
180
+ .factoriesFor (PropagationType .orderedValues ());
180
181
return new CompositePropagationFactory (injectorFactories , extractorFactories );
181
182
}
182
183
@@ -199,7 +200,7 @@ BaggagePropagation.FactoryBuilder propagationFactoryBuilder(
199
200
Iterable <Factory > injectorFactories = PropagationFactoryFactory .factoriesFor (BRAVE_BAGGAGE_MANAGER ,
200
201
this .tracingProperties .getPropagation ().getType ());
201
202
Iterable <Factory > extractorFactories = PropagationFactoryFactory .factoriesFor (BRAVE_BAGGAGE_MANAGER ,
202
- PropagationType .values ());
203
+ PropagationType .orderedValues ());
203
204
Factory delegate = new CompositePropagationFactory (injectorFactories , extractorFactories );
204
205
FactoryBuilder builder = BaggagePropagation .newFactoryBuilder (delegate );
205
206
baggagePropagationCustomizers .orderedStream ().forEach ((customizer ) -> customizer .customize (builder ));
@@ -258,23 +259,31 @@ ScopeDecorator correlationScopeDecorator(CorrelationScopeDecorator.Builder build
258
259
/**
259
260
* Factory for {@link Factory propagation factories}.
260
261
*/
261
- private static class PropagationFactoryFactory {
262
+ private static final class PropagationFactoryFactory {
262
263
263
264
private PropagationFactoryFactory () {
264
265
}
265
266
266
267
/**
267
- * Creates a new B3 propagation factory.
268
- * @return B3 propagation factory.
268
+ * Creates a new B3 propagation factory using a single B3 header .
269
+ * @return the B3 propagation factory
269
270
*/
270
- private static Factory b3 () {
271
+ private static Factory b3Single () {
271
272
return B3Propagation .newFactoryBuilder ().injectFormat (B3Propagation .Format .SINGLE_NO_PARENT ).build ();
272
273
}
273
274
275
+ /**
276
+ * Creates a new B3 propagation factory using multiple B3 headers.
277
+ * @return the B3 propagation factory
278
+ */
279
+ private static Factory b3Multi () {
280
+ return B3Propagation .newFactoryBuilder ().injectFormat (B3Propagation .Format .MULTI ).build ();
281
+ }
282
+
274
283
/**
275
284
* Creates a new W3C propagation factory.
276
285
* @param baggageManager baggage manager to use, or {@code null}
277
- * @return W3C Propagation propagation factory
286
+ * @return the W3C propagation factory
278
287
*/
279
288
private static W3CPropagation w3c (BaggageManager baggageManager ) {
280
289
return (baggageManager != null ) ? new W3CPropagation (baggageManager , Collections .emptyList ())
@@ -283,25 +292,18 @@ private static W3CPropagation w3c(BaggageManager baggageManager) {
283
292
284
293
private static Factory forType (BaggageManager baggageManager , PropagationType type ) {
285
294
return switch (type ) {
286
- case B3 -> PropagationFactoryFactory .b3 ();
295
+ case B3 -> PropagationFactoryFactory .b3Single ();
296
+ case B3_MULTI -> PropagationFactoryFactory .b3Multi ();
287
297
case W3C -> PropagationFactoryFactory .w3c (baggageManager );
288
298
};
289
299
}
290
300
291
301
private static List <Factory > factoriesFor (Collection <PropagationType > types ) {
292
- return factoriesFor (null , types .toArray (PropagationType []::new ));
293
- }
294
-
295
- private static List <Factory > factoriesFor (PropagationType ... types ) {
296
302
return factoriesFor (null , types );
297
303
}
298
304
299
305
private static List <Factory > factoriesFor (BaggageManager baggageManager , Collection <PropagationType > types ) {
300
- return factoriesFor (baggageManager , types .toArray (PropagationType []::new ));
301
- }
302
-
303
- private static List <Factory > factoriesFor (BaggageManager baggageManager , PropagationType ... types ) {
304
- List <Factory > result = new ArrayList <>(types .length );
306
+ List <Factory > result = new ArrayList <>(types .size ());
305
307
for (PropagationType type : types ) {
306
308
result .add (forType (baggageManager , type ));
307
309
}
0 commit comments