Interface AssertingSpan
-
- All Superinterfaces:
Span
,SpanCustomizer
public interface AssertingSpan extends Span
Span
that performs additional assertions such as allowed name, tag, event verification and upon reporting, whether the span had been started in the first place. You need to turn on assertions via system properties or environment variables to start breaking your tests or production code. CheckDocumentedSpanAssertions
for more information.- Since:
- 3.1.0
- Author:
- Marcin Grzejszczak
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.springframework.cloud.sleuth.Span
Span.Builder, Span.Kind
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default void
abandon()
Ends the span.default TraceContext
context()
static AssertingSpan
continueSpan(DocumentedSpan documentedSpan, Span span)
default void
end()
Ends the span.default AssertingSpan
error(Throwable throwable)
Records an exception for this span.default AssertingSpan
event(String value)
Sets an event on this span.default AssertingSpan
event(EventValue value)
Annotates with an event viaEventValue
.Span
getDelegate()
DocumentedSpan
getDocumentedSpan()
default boolean
isNoop()
default boolean
isStarted()
default AssertingSpan
name(String name)
Sets a name on this span.static AssertingSpan
of(DocumentedSpan documentedSpan, Span span)
default Span
remoteIpAndPort(String ip, int port)
Sets the remote url on the span.default AssertingSpan
remoteServiceName(String remoteServiceName)
Sets the remote service name for the span.default AssertingSpan
start()
Starts this span.default AssertingSpan
tag(String key, String value)
Sets a tag on this span.default AssertingSpan
tag(TagKey key, String value)
Tags a span viaTagKey
.static <T extends Span>
Tunwrap(Span span)
Returns the underlying delegate.
-
-
-
Method Detail
-
getDocumentedSpan
DocumentedSpan getDocumentedSpan()
- Returns:
- a
DocumentedSpan
with span configuration
-
isStarted
default boolean isStarted()
- Returns:
true
when this span was started
-
tag
default AssertingSpan tag(String key, String value)
Description copied from interface:Span
Sets a tag on this span.- Specified by:
tag
in interfaceSpan
- Specified by:
tag
in interfaceSpanCustomizer
- Parameters:
key
- tag keyvalue
- tag value- Returns:
- this span
-
tag
default AssertingSpan tag(TagKey key, String value)
Tags a span viaTagKey
.- Parameters:
key
- tag keyvalue
- tag value- Returns:
- this for chaining
-
event
default AssertingSpan event(String value)
Description copied from interface:Span
Sets an event on this span.- Specified by:
event
in interfaceSpan
- Specified by:
event
in interfaceSpanCustomizer
- Parameters:
value
- event name to set on the span- Returns:
- this span
-
event
default AssertingSpan event(EventValue value)
Annotates with an event viaEventValue
.- Parameters:
value
- event value- Returns:
- this for chaining
-
name
default AssertingSpan name(String name)
Description copied from interface:Span
Sets a name on this span.- Specified by:
name
in interfaceSpan
- Specified by:
name
in interfaceSpanCustomizer
- Parameters:
name
- name to set on the span- Returns:
- this span
-
isNoop
default boolean isNoop()
-
context
default TraceContext context()
- Specified by:
context
in interfaceSpan
- Returns:
TraceContext
corresponding to this span.
-
start
default AssertingSpan start()
Description copied from interface:Span
Starts this span.
-
error
default AssertingSpan error(Throwable throwable)
Description copied from interface:Span
Records an exception for this span.
-
end
default void end()
Description copied from interface:Span
Ends the span. The span gets stopped and recorded if not noop.
-
abandon
default void abandon()
Description copied from interface:Span
Ends the span. The span gets stopped but does not get recorded.
-
remoteServiceName
default AssertingSpan remoteServiceName(String remoteServiceName)
Description copied from interface:Span
Sets the remote service name for the span.- Specified by:
remoteServiceName
in interfaceSpan
- Parameters:
remoteServiceName
- remote service name- Returns:
- this span
-
remoteIpAndPort
default Span remoteIpAndPort(String ip, int port)
Description copied from interface:Span
Sets the remote url on the span.- Specified by:
remoteIpAndPort
in interfaceSpan
- Parameters:
ip
- remote ipport
- remote port- Returns:
- this span
-
of
static AssertingSpan of(DocumentedSpan documentedSpan, Span span)
- Parameters:
documentedSpan
- span configurationspan
- span to wrap in assertions- Returns:
- asserting span
-
continueSpan
static AssertingSpan continueSpan(DocumentedSpan documentedSpan, Span span)
- Parameters:
documentedSpan
- span configurationspan
- span to wrap in assertions- Returns:
- asserting span
-
-