Interface AssertingSpan
-
- All Superinterfaces:
Span,SpanCustomizer
public interface AssertingSpan extends Span
Spanthat 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. CheckDocumentedSpanAssertionsfor 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 voidabandon()Ends the span.default TraceContextcontext()static AssertingSpancontinueSpan(DocumentedSpan documentedSpan, Span span)default voidend()Ends the span.default AssertingSpanerror(Throwable throwable)Records an exception for this span.default AssertingSpanevent(String value)Sets an event on this span.default AssertingSpanevent(EventValue value)Annotates with an event viaEventValue.SpangetDelegate()DocumentedSpangetDocumentedSpan()default booleanisNoop()default booleanisStarted()default AssertingSpanname(String name)Sets a name on this span.static AssertingSpanof(DocumentedSpan documentedSpan, Span span)default SpanremoteIpAndPort(String ip, int port)Sets the remote url on the span.default AssertingSpanremoteServiceName(String remoteServiceName)Sets the remote service name for the span.default AssertingSpanstart()Starts this span.default AssertingSpantag(String key, String value)Sets a tag on this span.default AssertingSpantag(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
DocumentedSpanwith span configuration
-
isStarted
default boolean isStarted()
- Returns:
truewhen this span was started
-
tag
default AssertingSpan tag(String key, String value)
Description copied from interface:SpanSets a tag on this span.- Specified by:
tagin interfaceSpan- Specified by:
tagin 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:SpanSets an event on this span.- Specified by:
eventin interfaceSpan- Specified by:
eventin 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:SpanSets a name on this span.- Specified by:
namein interfaceSpan- Specified by:
namein interfaceSpanCustomizer- Parameters:
name- name to set on the span- Returns:
- this span
-
isNoop
default boolean isNoop()
-
context
default TraceContext context()
- Specified by:
contextin interfaceSpan- Returns:
TraceContextcorresponding to this span.
-
start
default AssertingSpan start()
Description copied from interface:SpanStarts this span.
-
error
default AssertingSpan error(Throwable throwable)
Description copied from interface:SpanRecords an exception for this span.
-
end
default void end()
Description copied from interface:SpanEnds the span. The span gets stopped and recorded if not noop.
-
abandon
default void abandon()
Description copied from interface:SpanEnds the span. The span gets stopped but does not get recorded.
-
remoteServiceName
default AssertingSpan remoteServiceName(String remoteServiceName)
Description copied from interface:SpanSets the remote service name for the span.- Specified by:
remoteServiceNamein interfaceSpan- Parameters:
remoteServiceName- remote service name- Returns:
- this span
-
remoteIpAndPort
default Span remoteIpAndPort(String ip, int port)
Description copied from interface:SpanSets the remote url on the span.- Specified by:
remoteIpAndPortin 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
-
-