diff --git a/multi/multi__managing_spans_with_annotations.html b/multi/multi__managing_spans_with_annotations.html
index 0d3bbc129..cd81acde9 100644
--- a/multi/multi__managing_spans_with_annotations.html
+++ b/multi/multi__managing_spans_with_annotations.html
@@ -9,10 +9,10 @@ Also, we provide the @SpanTag annotation to add tag
void testMethod();
Annotating the method without any parameter leads to creating a new span whose name equals the annotated method name.
@NewSpan("customNameOnTestMethod4") void testMethod4();
If you provide the value in the annotation (either directly or by setting the name parameter), the created span has the provided value as the name.
// method declaration @NewSpan(name = "customNameOnTestMethod5") -void testMethod5(); +void testMethod5(@SpanTag("testTag") String param); // and method execution -this.testBean.testMethod5();
You can combine both the name and a tag. Let’s focus on the latter. +this.testBean.testMethod5("test");
You can combine both the name and a tag. Let’s focus on the latter.
In this case, the value of the annotated method’s parameter runtime value becomes the value of the tag.
In our sample, the tag key is testTag, and the tag value is test.
@NewSpan(name = "customNameOnTestMethod3") @Override @@ -21,23 +21,25 @@ In our sample, the tag key istestTag, and the tag If you override the interface’s method and provide a different value for the@NewSpanannotation, the most concrete one wins (in this casecustomNameOnTestMethod3is set).If you want to add tags and annotations to an existing span, you can use the
@ContinueSpanannotation, as shown in the following example:// method declaration @ContinueSpan(log = "testMethod11") -void testMethod11(); +void testMethod11(@SpanTag("testTag11") String param); // method execution -this.testBean.testMethod11(); +this.testBean.testMethod11("test"); this.testBean.testMethod13();(Note that, in contrast with the
@NewSpanannotation ,you can also add logs with thelogparameter.)That way, the span gets continued and:
- Log entries named
testMethod11.beforeandtestMethod11.afterare created.- If an exception is thrown, a log entry named
testMethod11.afterFailureis also created.- A tag with a key of
testTag11and a value oftestis created.There are 3 different ways to add tags to a span. All of them are controlled by the
SpanTagannotation. The precedence is as follows:
- Try with a bean of
TagValueResolvertype and a provided name.- If the bean name has not been provided, try to evaluate an expression. We search for a
TagValueExpressionResolverbean. The default implementation uses SPEL expression resolution. IMPORTANT You can only reference properties from the SPEL expression. Method execution is not allowed due to security constraints.- If we do not find any expression to evaluate, return the
toString()value of the parameter.The value of the tag for the following method is computed by an implementation of
TagValueResolverinterface. Its class name has to be passed as the value of theresolverattribute.Consider the following annotated method:
@NewSpan -public void getAnnotationForTagValueResolver() { +public void getAnnotationForTagValueResolver( + @SpanTag(key = "test", resolver = TagValueResolver.class) String test) { }Now further consider the following
TagValueResolverbean implementation:@Bean(name = "myCustomTagValueResolver") public TagValueResolver tagValueResolver() { - return () -> "Value from myCustomTagValueResolver"; + return parameter -> "Value from myCustomTagValueResolver"; }The two preceding examples lead to setting a tag value equal to
Value from myCustomTagValueResolver.Consider the following annotated method:
@NewSpan -public void getAnnotationForTagValueExpression() { +public void getAnnotationForTagValueExpression( + @SpanTag(key = "test", expression = "'hello' + ' characters'") String test) { }No custom implementation of a
TagValueExpressionResolverleads to evaluation of the SPEL expression, and a tag with a value of4 charactersis set on the span. If you want to use some other expression resolution mechanism, you can create your own implementation of the bean.Consider the following annotated method:
@NewSpan -public void getAnnotationForArgumentToString() { +public void getAnnotationForArgumentToString(@SpanTag("test") Long param) { }Running the preceding method with a value of
15leads to setting a tag with a String value of"15".