Package io.micrometer.tracing.docs
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 Micrometer Tracing 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
- Metrics are grouped within an enum - the enum implements the
DocumentedSpaninterface - If the span contains
TagKeythen those need to be declared as nested enums - If the span contains
EventValuethen those need to be declared as nested enums - The
getTagKeys()need to call the nested enum'svalues()method to retrieve the array of allowed keys / events - The
getEvents()need to call the nested enum'svalues()method to retrieve the array of allowed keys / events - Javadocs around enums will be used as description
- Since:
- 1.0.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final io.micrometer.api.instrument.docs.TagKey[]Empty tag keys.static final EventValue[]Empty values. -
Method Summary
Modifier and TypeMethodDescriptiondefault io.micrometer.api.instrument.docs.TagKey[]Additional tag keys.default EventValue[]Allowed events.getName()Span name.default StringBuilds a name from provided vars.default StringReturns required prefix to be there for tags.default io.micrometer.api.instrument.docs.TagKey[]Allowed tag keys.default io.micrometer.api.instrument.docs.DocumentedObservationOverride this when custom span should be documented instead of the default one.
-
Field Details
-
EMPTY_TAGS
static final io.micrometer.api.instrument.docs.TagKey[] EMPTY_TAGSEmpty tag keys. -
EMPTY_VALUES
Empty values.
-
-
Method Details
-
getName
String getName()Span name.- Returns:
- metric name
-
getName
Builds a name from provided vars. Follows theString.format(String, Object...)patterns.- Parameters:
vars- variables to pass toString.format(String, Object...)- Returns:
- constructed name
-
getEvents
Allowed events.- Returns:
- allowed events
-
getTagKeys
default io.micrometer.api.instrument.docs.TagKey[] getTagKeys()Allowed tag keys.- Returns:
- allowed tag keys - if set will override any tag keys coming from
overridesDefaultSpanFrom()
-
getAdditionalTagKeys
default io.micrometer.api.instrument.docs.TagKey[] getAdditionalTagKeys()Additional tag keys.- Returns:
- additional tag keys - if set will append any tag keys coming from
overridesDefaultSpanFrom()
-
overridesDefaultSpanFrom
default io.micrometer.api.instrument.docs.DocumentedObservation overridesDefaultSpanFrom()Override this when custom span should be documented instead of the default one.- Returns:
DocumentedObservationfor which you don't want to create a default span documentation
-
getPrefix
Returns required prefix to be there for tags. For example,foo.would require the tags to have afoo.prefix like this:foo.bar=true.- Returns:
- required prefix
-