From 300b7d9458785d2f772a4db6c50a5f8c95fa2de1 Mon Sep 17 00:00:00 2001
From: buildmaster
Baggage is a set of key:value pairs stored in
and is attached to every span. Spring Cloud Sleuth will understand that a header is baggage related if the HTTP
header is prefixed with baggage- and for messaging it starts with baggage_.
![]() | Important |
|---|---|
There’s currently no limitation of the count or size of baggage items. However, keep in mind that too many can decrease system throughput or increase RPC latency. In extreme cases, it could crash the app due -to exceeding transport-level message or header capacity. |
Example of setting baggage on a span:
Span initialSpan = this.tracer.createSpan("span"); -initialSpan.setBaggageItem("foo", "bar"); -initialSpan.setBaggageItem("UPPER_CASE", "someValue");
Baggage travels with the trace (i.e. every child span contains the baggage of its parent). Zipkin has no knowledge of +to exceeding transport-level message or header capacity.
Example of setting baggage on a span:
Span initialSpan = this.tracer.nextSpan().name("span").start(); +try (Tracer.SpanInScope ws = this.tracer.withSpanInScope(initialSpan)) { + ExtraFieldPropagation.set("foo", "bar"); + ExtraFieldPropagation.set("UPPER_CASE", "someValue");
Baggage travels with the trace (i.e. every child span contains the baggage of its parent). Zipkin has no knowledge of baggage and will not even receive that information.
Tags are attached to a specific span - they are presented for that particular span only. However you can search by tag to find the trace, where there exists a span having the searched tag value.
If you want to be able to lookup a span based on baggage, you should add corresponding entry as a tag in the root span.
@Autowired Tracer tracer; diff --git a/1.3.x/single/spring-cloud-sleuth.html b/1.3.x/single/spring-cloud-sleuth.html index e03ad18ef..3671e24d8 100644 --- a/1.3.x/single/spring-cloud-sleuth.html +++ b/1.3.x/single/spring-cloud-sleuth.html @@ -128,9 +128,10 @@ Baggage is an optional part.Baggage is a set of key:value pairs stored in and is attached to every span. Spring Cloud Sleuth will understand that a header is baggage related if the HTTP header is prefixed with
baggage-and for messaging it starts withbaggage_.
Important There’s currently no limitation of the count or size of baggage items. However, keep in mind that too many can decrease system throughput or increase RPC latency. In extreme cases, it could crash the app due -to exceeding transport-level message or header capacity.
Example of setting baggage on a span:
Span initialSpan = this.tracer.createSpan("span"); -initialSpan.setBaggageItem("foo", "bar"); -initialSpan.setBaggageItem("UPPER_CASE", "someValue");Baggage travels with the trace (i.e. every child span contains the baggage of its parent). Zipkin has no knowledge of +to exceeding transport-level message or header capacity.
Example of setting baggage on a span:
Span initialSpan = this.tracer.nextSpan().name("span").start(); +try (Tracer.SpanInScope ws = this.tracer.withSpanInScope(initialSpan)) { + ExtraFieldPropagation.set("foo", "bar"); + ExtraFieldPropagation.set("UPPER_CASE", "someValue");Baggage travels with the trace (i.e. every child span contains the baggage of its parent). Zipkin has no knowledge of baggage and will not even receive that information.
Tags are attached to a specific span - they are presented for that particular span only. However you can search by tag to find the trace, where there exists a span having the searched tag value.
If you want to be able to lookup a span based on baggage, you should add corresponding entry as a tag in the root span.
@Autowired Tracer tracer; diff --git a/1.3.x/spring-cloud-sleuth.xml b/1.3.x/spring-cloud-sleuth.xml index 673e6723c..c7c9b7342 100644 --- a/1.3.x/spring-cloud-sleuth.xml +++ b/1.3.x/spring-cloud-sleuth.xml @@ -4,7 +4,7 @@Spring Cloud Sleuth -2018-01-19 +2018-01-20 Adrian Cole, Spencer Gibb, Marcin Grzejszczak, Dave Syer @@ -348,9 +348,10 @@ too many can decrease system throughput or increase RPC latency. In extreme case to exceeding transport-level message or header capacity.Example of setting baggage on a span: -Span initialSpan = this.tracer.createSpan("span"); -initialSpan.setBaggageItem("foo", "bar"); -initialSpan.setBaggageItem("UPPER_CASE", "someValue"); +Span initialSpan = this.tracer.nextSpan().name("span").start(); +try (Tracer.SpanInScope ws = this.tracer.withSpanInScope(initialSpan)) { + ExtraFieldPropagation.set("foo", "bar"); + ExtraFieldPropagation.set("UPPER_CASE", "someValue"); Baggage vs. Span Tags Baggage travels with the trace (i.e. every child span contains the baggage of its parent). Zipkin has no knowledge of