@Bean
-FinishedSpanHandler handlerOne() {
- return new FinishedSpanHandler() {
+SpanHandler handlerOne() {
+ return new SpanHandler() {
@Override
- public boolean handle(TraceContext traceContext, MutableSpan span) {
+ public boolean end(TraceContext traceContext, MutableSpan span,
+ Cause cause) {
span.name("foo");
return true; // keep this span
}
@@ -1688,10 +1689,11 @@ FinishedSpanHandler handlerOne() {
}
@Bean
-FinishedSpanHandler handlerTwo() {
- return new FinishedSpanHandler() {
+SpanHandler handlerTwo() {
+ return new SpanHandler() {
@Override
- public boolean handle(TraceContext traceContext, MutableSpan span) {
+ public boolean end(TraceContext traceContext, MutableSpan span,
+ Cause cause) {
span.name(span.name() + " bar");
return true; // keep this span
}
diff --git a/reference/html/spring-cloud-sleuth.html b/reference/html/spring-cloud-sleuth.html
index 6cbbdae93..92043df25 100644
--- a/reference/html/spring-cloud-sleuth.html
+++ b/reference/html/spring-cloud-sleuth.html
@@ -1664,23 +1664,24 @@ To achieve that, you can pass the following property to your application to over
11.6. Customization of Reported Spans
Before reporting spans (for example, to Zipkin) you may want to modify that span in some way.
-You can do so by using the FinishedSpanHandler interface.
+You can do so by implementing a SpanHandler.
In Sleuth, we generate spans with a fixed name.
Some users want to modify the name depending on values of tags.
-You can implement the FinishedSpanHandler interface to alter that name.
+You can implement the SpanHandler interface to alter that name.
-The following example shows how to register two beans that implement FinishedSpanHandler:
+The following example shows how to register two beans that implement SpanHandler:
@Bean
-FinishedSpanHandler handlerOne() {
- return new FinishedSpanHandler() {
+SpanHandler handlerOne() {
+ return new SpanHandler() {
@Override
- public boolean handle(TraceContext traceContext, MutableSpan span) {
+ public boolean end(TraceContext traceContext, MutableSpan span,
+ Cause cause) {
span.name("foo");
return true; // keep this span
}
@@ -1688,10 +1689,11 @@ FinishedSpanHandler handlerOne() {
}
@Bean
-FinishedSpanHandler handlerTwo() {
- return new FinishedSpanHandler() {
+SpanHandler handlerTwo() {
+ return new SpanHandler() {
@Override
- public boolean handle(TraceContext traceContext, MutableSpan span) {
+ public boolean end(TraceContext traceContext, MutableSpan span,
+ Cause cause) {
span.name(span.name() + " bar");
return true; // keep this span
}