From cfba0b4e2d456d86c45246da1a89c9dbe816dbe1 Mon Sep 17 00:00:00 2001
From: buildmaster x-vcap-request-id the field as-is but send the country-code and user-id fields on the wire as x-baggage-country-code and x-baggage-user-id, respectively:
Tracing.newBuilder().propagationFactory(
ExtraFieldPropagation.newFactoryBuilder(B3Propagation.FACTORY)
.addField("x-vcap-request-id")
- .addPrefixedFields("baggage-", Arrays.asList("country-code", "user-id"))
+ .addPrefixedFields("x-baggage-", Arrays.asList("country-code", "user-id"))
.build()
);Later, you can call the following code to affect the country code of the current trace context:
ExtraFieldPropagation.set("country-code", "FO"); String countryCode = ExtraFieldPropagation.get("country-code");
Alternatively, if you have a reference to a trace context, you can use it explicitly, as shown in the following example:
ExtraFieldPropagation.set(span.context(), "country-code", "FO"); diff --git a/2.0.x/single/spring-cloud-sleuth.html b/2.0.x/single/spring-cloud-sleuth.html index 9e06e75b4..3ec9bd81c 100644 --- a/2.0.x/single/spring-cloud-sleuth.html +++ b/2.0.x/single/spring-cloud-sleuth.html @@ -450,7 +450,7 @@ for you to create a bean of that type and we will set it in thex-vcap-request-idthe field as-is but send thecountry-codeanduser-idfields on the wire asx-baggage-country-codeandx-baggage-user-id, respectively:Tracing.newBuilder().propagationFactory( ExtraFieldPropagation.newFactoryBuilder(B3Propagation.FACTORY) .addField("x-vcap-request-id") - .addPrefixedFields("baggage-", Arrays.asList("country-code", "user-id")) + .addPrefixedFields("x-baggage-", Arrays.asList("country-code", "user-id")) .build() );Later, you can call the following code to affect the country code of the current trace context:
ExtraFieldPropagation.set("country-code", "FO"); String countryCode = ExtraFieldPropagation.get("country-code");Alternatively, if you have a reference to a trace context, you can use it explicitly, as shown in the following example:
ExtraFieldPropagation.set(span.context(), "country-code", "FO"); diff --git a/2.0.x/spring-cloud-sleuth.xml b/2.0.x/spring-cloud-sleuth.xml index 303d97a37..bf5c5333c 100644 --- a/2.0.x/spring-cloud-sleuth.xml +++ b/2.0.x/spring-cloud-sleuth.xml @@ -1015,7 +1015,7 @@ The following example shows how to propagatex-vcap-request-id Tracing.newBuilder().propagationFactory( ExtraFieldPropagation.newFactoryBuilder(B3Propagation.FACTORY) .addField("x-vcap-request-id") - .addPrefixedFields("baggage-", Arrays.asList("country-code", "user-id")) + .addPrefixedFields("x-baggage-", Arrays.asList("country-code", "user-id")) .build() );Later, you can call the following code to affect the country code of the current trace context: