Annotation Type SpanAttribute
-
@Target(PARAMETER) @Retention(RUNTIME) public @interface SpanAttribute
This annotation marks that a parameter of a method annotated by theWithSpanannotation should be added as an attribute to the newly createdSpan. Using this annotation is equivalent to callingSpan.currentSpan().setAttribute(...)within the body of the method.Application developers can use this annotation to signal OpenTelemetry auto-instrumentation that a new span attribute should be added to a span created when the parent method is executed.
If you are a library developer, then probably you should NOT use this annotation, because it is non-functional without the OpenTelemetry auto-instrumentation agent, or some other annotation processor.
- Since:
- 1.4.0
- See Also:
- OpenTelemetry OpenTelemetry Instrumentation for Java
-
-
Element Detail
-
value
String value
Optional name of the attribute.If not specified and the code is compiled using the `
-parameters` argument to `javac`, the parameter name will be used instead. If the parameter name is not available, e.g., because the code was not compiled with that flag, the attribute will be ignored.- Default:
- ""
-
-