@Target(METHOD) @Retention(RUNTIME) public @interface ChildSpan
SpanAspect
to a Spring bean.
It provides a declarative way for creating child spans when calling an annotated method from another class. In doing so it measures the duration of the method call, captures info about the call site (such as the method name), and reports on any exceptions that may have been thrown (but does not swallow it).
The child span created by the Aspect can be further customised by this annotation's parameters. Additionally, if you
are interested in capturing any method arguments, you can use SpanField
in conjunction with this annotation.
By default, no arguments will be captured.
Since Spring AOP uses a proxy mechanism, this will not work when calling the method from within the same class. For reference, "Understanding AOP Proxies explains this mechanism.
@ChildSpan
public void doStuff(@SpanField
final String id,@SpanField
final String name) { // the following returns the Span created by using the @ChildSpan annotation Span childSpan = beeline.getActiveSpan(); // add more contextual info in addition to the captured arguments (see @SpanField) childSpan.addField(...); }
Modifier and Type | Optional Element | Description |
---|---|---|
boolean |
addResult |
If set to true, the Aspect will capture the return value and add it as a field
() to the Span.
|
String |
name |
Overrides the default name given to the operation covered by the child Span created by the Aspect.
|
String |
value |
Overrides the default name given to the operation covered by the child Span created by the Aspect.
|
@AliasFor("name") String value
If no value is provided, the Aspect will fallback to using the method name (capitalized) instead.
This is an alias for name()
.
@AliasFor("value") String name
If no value is provided, the Aspect will fallback to using the method name (capitalized) instead.
This is an alias for value()
.
Copyright © 2019–2020 Honeycomb. All rights reserved.