Package org.springframework.cloud.sleuth
Annotation Type SpanName
-
@Target({TYPE,METHOD}) @Retention(RUNTIME) @Documented public @interface SpanName
Annotation to provide the name for the span. You should annotate all your customRunnable
orCallable
classes for the instrumentation logic to pick up how to name the span.Having for example the following code
Will result in creating a span with name@SpanName("custom-operation") class CustomRunnable implements Runnable { @Override public void run() { // latency of this method will be recorded in a span named "custom-operation" } }
custom-operation
.When there's no @SpanName annotation,
toString
is used. Here's an example of the above, but via an anonymous instance.
Starting with versionreturn new Runnable() { -- snip -- @Override public String toString() { return "custom-operation"; } };
1.3.0
you can also put the annotation on anAsync
annotated method and the value of that annotation will be used as the span name.- Since:
- 1.0.0
- Author:
- Marcin Grzejszczak
-
-
Element Detail
-
value
String value
Name of the span to be resolved at runtime.- Returns:
- - value of the span name.
-
-