From 5e2b1774ea9ba4684f97d8937d24ea7f90184c02 Mon Sep 17 00:00:00 2001 From: buildmaster Date: Sat, 20 Jan 2018 08:07:55 +0000 Subject: [PATCH] Sync docs from master to gh-pages --- multi/multi__customizations.html | 8 +++++++- single/spring-cloud-sleuth.html | 8 +++++++- spring-cloud-sleuth.xml | 8 +++++++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/multi/multi__customizations.html b/multi/multi__customizations.html index 0312372d4..0a34819f6 100644 --- a/multi/multi__customizations.html +++ b/multi/multi__customizations.html @@ -32,7 +32,13 @@ add to the Span a tag with key custom and a value < from your application. To achieve that it’s enough to just pass the following property to your application to override that value (example for foo service name):

spring.zipkin.service.name: foo

12.5 Customization of reported spans

Before reporting spans to e.g. Zipkin you can be interested in modifying that span in some way. You can achieve that by using the SpanAdjuster interface.

In Sleuth we’re generating spans with a fixed name. Some users want to modify the name depending on values -of tags. Implementation of the SpanAdjuster interface can be used to alter that name. Example:

Example. If you register two beans of SpanAdjuster type:

Unresolved directive in spring-cloud-sleuth.adoc - include::../../../..//spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/autoconfig/SpanAdjusterAspectTests.java[tags=adjuster,indent=0]

This will lead in changing the name of the reported span to foo bar, just before it gets reported (e.g. to Zipkin).

12.6 Host locator

[Important]Important

This section is about defining host from service discovery. It’s NOT +of tags. Implementation of the SpanAdjuster interface can be used to alter that name. Example:

Example. If you register two beans of SpanAdjuster type:

@Bean SpanAdjuster adjusterOne() {
+	return span -> span.toBuilder().name("foo").build();
+}
+
+@Bean SpanAdjuster adjusterTwo() {
+	return span -> span.toBuilder().name(span.name() + " bar").build();
+}

This will lead in changing the name of the reported span to foo bar, just before it gets reported (e.g. to Zipkin).

12.6 Host locator

[Important]Important

This section is about defining host from service discovery. It’s NOT about finding Zipkin in service discovery.

In order to define the host that is corresponding to a particular span we need to resolve the host name and port. The default approach is to take it from server properties. If those for some reason are not set then we’re trying to retrieve the host name from the network interfaces.

If you have the discovery client enabled and prefer to retrieve the host address from the registered diff --git a/single/spring-cloud-sleuth.html b/single/spring-cloud-sleuth.html index 2ee1e3960..a78ecc7c5 100644 --- a/single/spring-cloud-sleuth.html +++ b/single/spring-cloud-sleuth.html @@ -695,7 +695,13 @@ add to the Span a tag with key custom and a value < from your application. To achieve that it’s enough to just pass the following property to your application to override that value (example for foo service name):

spring.zipkin.service.name: foo

12.5 Customization of reported spans

Before reporting spans to e.g. Zipkin you can be interested in modifying that span in some way. You can achieve that by using the SpanAdjuster interface.

In Sleuth we’re generating spans with a fixed name. Some users want to modify the name depending on values -of tags. Implementation of the SpanAdjuster interface can be used to alter that name. Example:

Example. If you register two beans of SpanAdjuster type:

Unresolved directive in spring-cloud-sleuth.adoc - include::../../../..//spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/autoconfig/SpanAdjusterAspectTests.java[tags=adjuster,indent=0]

This will lead in changing the name of the reported span to foo bar, just before it gets reported (e.g. to Zipkin).

12.6 Host locator

[Important]Important

This section is about defining host from service discovery. It’s NOT +of tags. Implementation of the SpanAdjuster interface can be used to alter that name. Example:

Example. If you register two beans of SpanAdjuster type:

@Bean SpanAdjuster adjusterOne() {
+	return span -> span.toBuilder().name("foo").build();
+}
+
+@Bean SpanAdjuster adjusterTwo() {
+	return span -> span.toBuilder().name(span.name() + " bar").build();
+}

This will lead in changing the name of the reported span to foo bar, just before it gets reported (e.g. to Zipkin).

12.6 Host locator

[Important]Important

This section is about defining host from service discovery. It’s NOT about finding Zipkin in service discovery.

In order to define the host that is corresponding to a particular span we need to resolve the host name and port. The default approach is to take it from server properties. If those for some reason are not set then we’re trying to retrieve the host name from the network interfaces.

If you have the discovery client enabled and prefer to retrieve the host address from the registered diff --git a/spring-cloud-sleuth.xml b/spring-cloud-sleuth.xml index 8341706ff..fbe0efbb3 100644 --- a/spring-cloud-sleuth.xml +++ b/spring-cloud-sleuth.xml @@ -1503,7 +1503,13 @@ class MyFilter extends GenericFilterBean { In Sleuth we’re generating spans with a fixed name. Some users want to modify the name depending on values of tags. Implementation of the SpanAdjuster interface can be used to alter that name. Example: Example. If you register two beans of SpanAdjuster type: -Unresolved directive in spring-cloud-sleuth.adoc - include::../../../..//spring-cloud-sleuth-core/src/test/java/org/springframework/cloud/sleuth/autoconfig/SpanAdjusterAspectTests.java[tags=adjuster,indent=0] +@Bean SpanAdjuster adjusterOne() { + return span -> span.toBuilder().name("foo").build(); +} + +@Bean SpanAdjuster adjusterTwo() { + return span -> span.toBuilder().name(span.name() + " bar").build(); +} This will lead in changing the name of the reported span to foo bar, just before it gets reported (e.g. to Zipkin).