Interface DocumentedSpan
-
public interface DocumentedSpan
In order to describe your spans via e.g. enums instead of Strings you can use this interface that returns all the characteristics of a span. In Spring Cloud Sleuth we analyze the sources and reuse this information to build a table of known spans, their names, tags and events. We can generate documentation for all created spans but certain requirements need to be met - spans are grouped within an enum - the enum implements theDocumentedSpan
interface - if the span containsTagKey
orEventValue
then those need to be declared as nested enums - thegetTagKeys()
andgetEvents()
need to call the nested enum'svalues()
method to retrieve the array of allowed keys / events- Since:
- 3.1.0
- Author:
- Marcin Grzejszczak
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default EventValue[]
getEvents()
String
getName()
default TagKey[]
getTagKeys()
default String
prefix()
Returns required prefix to be there for events and tags.default AssertingSpan
wrap(Span span)
Asserts on tags, names and allowed events.default AssertingSpanBuilder
wrap(Span.Builder span)
Asserts on tags, names and allowed events.default AssertingSpanCustomizer
wrap(SpanCustomizer span)
Asserts on tags, names and allowed events.
-
-
-
Method Detail
-
getName
String getName()
- Returns:
- span name
-
getTagKeys
default TagKey[] getTagKeys()
- Returns:
- allowed tag keys
-
getEvents
default EventValue[] getEvents()
- Returns:
- allowed events
-
prefix
default String prefix()
Returns required prefix to be there for events and tags. Examplefoo.
would require the tags and events to have a {code foo} prefix like this for tags:foo.bar=true
andfoo.started
for events.- Returns:
- required prefix
-
wrap
default AssertingSpan wrap(Span span)
Asserts on tags, names and allowed events.- Parameters:
span
- to wrap- Returns:
- wrapped span
-
wrap
default AssertingSpanCustomizer wrap(SpanCustomizer span)
Asserts on tags, names and allowed events.- Parameters:
span
- to wrap- Returns:
- wrapped span
-
wrap
default AssertingSpanBuilder wrap(Span.Builder span)
Asserts on tags, names and allowed events.- Parameters:
span
- builder to wrap- Returns:
- wrapped span
-
-