Package org.springframework.cloud.sleuth
Interface Span
-
- All Superinterfaces:
SpanCustomizer
- All Known Subinterfaces:
AssertingSpan
public interface Span extends SpanCustomizer
This API was heavily influenced by Brave. Parts of its documentation were taken directly from Brave. Span is a single unit of work that needs to be started and stopped. Contains timing information and events and tags.- Since:
- 3.0.0
- Author:
- OpenZipkin Brave Authors, Marcin Grzejszczak
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
Span.Builder
In some cases (e.g.static class
Span.Kind
Type of span.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
abandon()
Ends the span.TraceContext
context()
void
end()
Ends the span.Span
error(Throwable throwable)
Records an exception for this span.Span
event(String value)
Sets an event on this span.boolean
isNoop()
Span
name(String name)
Sets a name on this span.default Span
remoteIpAndPort(String ip, int port)
Sets the remote url on the span.default Span
remoteServiceName(String remoteServiceName)
Sets the remote service name for the span.Span
start()
Starts this span.Span
tag(String key, String value)
Sets a tag on this span.
-
-
-
Method Detail
-
isNoop
boolean isNoop()
- Returns:
true
when no recording is done and nothing is reported to an external system. However, this span should still be injected into outgoing requests. Use this flag to avoid performing expensive computation.
-
context
TraceContext context()
- Returns:
TraceContext
corresponding to this span.
-
start
Span start()
Starts this span.- Returns:
- this span
-
name
Span name(String name)
Sets a name on this span.- Specified by:
name
in interfaceSpanCustomizer
- Parameters:
name
- name to set on the span- Returns:
- this span
-
event
Span event(String value)
Sets an event on this span.- Specified by:
event
in interfaceSpanCustomizer
- Parameters:
value
- event name to set on the span- Returns:
- this span
-
tag
Span tag(String key, String value)
Sets a tag on this span.- Specified by:
tag
in interfaceSpanCustomizer
- Parameters:
key
- tag keyvalue
- tag value- Returns:
- this span
-
error
Span error(Throwable throwable)
Records an exception for this span.- Parameters:
throwable
- to record- Returns:
- this span
-
end
void end()
Ends the span. The span gets stopped and recorded if not noop.
-
abandon
void abandon()
Ends the span. The span gets stopped but does not get recorded.
-
remoteServiceName
default Span remoteServiceName(String remoteServiceName)
Sets the remote service name for the span.- Parameters:
remoteServiceName
- remote service name- Returns:
- this span
- Since:
- 3.0.3
-
-