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 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. Example foo. would require the tags and events to have a {code foo} prefix like this for tags: foo.bar=true and foo.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 AssertingSpanBuilder wrap​(Span.Builder span)
        Asserts on tags, names and allowed events.
        Parameters:
        span - builder to wrap
        Returns:
        wrapped span