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 the
DocumentedSpan
interface - if the span contains TagKey or EventValue then those need
to be declared as nested enums - the getTagKeys() and
getEvents() need to call the nested enum's values()
method to retrieve the array of allowed keys / events- Since:
- 3.1.0
- Author:
- Marcin Grzejszczak
-
Method Summary
Modifier and TypeMethodDescriptiondefault EventValue[]getName()default TagKey[]default Stringprefix()Returns required prefix to be there for events and tags.default AssertingSpanAsserts on tags, names and allowed events.default AssertingSpanBuilderwrap(Span.Builder span) Asserts on tags, names and allowed events.default AssertingSpanCustomizerwrap(SpanCustomizer span) Asserts on tags, names and allowed events.
-
Method Details
-
getName
String getName()- Returns:
- span name
-
getTagKeys
- Returns:
- allowed tag keys
-
getEvents
- Returns:
- allowed events
-
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=trueandfoo.startedfor events.- Returns:
- required prefix
-
wrap
Asserts on tags, names and allowed events.- Parameters:
span- to wrap- Returns:
- wrapped span
-
wrap
Asserts on tags, names and allowed events.- Parameters:
span- to wrap- Returns:
- wrapped span
-
wrap
Asserts on tags, names and allowed events.- Parameters:
span- builder to wrap- Returns:
- wrapped span
-