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 interfaceSpan.BuilderIn some cases (e.g.static classSpan.KindType of span.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidabandon()Ends the span.TraceContextcontext()voidend()Ends the span.Spanerror(Throwable throwable)Records an exception for this span.Spanevent(String value)Sets an event on this span.booleanisNoop()Spanname(String name)Sets a name on this span.default SpanremoteIpAndPort(String ip, int port)Sets the remote url on the span.default SpanremoteServiceName(String remoteServiceName)Sets the remote service name for the span.Spanstart()Starts this span.Spantag(String key, String value)Sets a tag on this span.
-
-
-
Method Detail
-
isNoop
boolean isNoop()
- Returns:
truewhen 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:
TraceContextcorresponding 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:
namein 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:
eventin 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:
tagin 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
-
-