Interface MeterDocumentation
- All Known Implementing Classes:
NettyMeters
public interface MeterDocumentation
In order to describe your metrics via e.g. enums instead of Strings you can use this
interface that returns all the characteristics of a metric.
We can generate documentation for all created metrics but certain requirements need to
be met
- Metrics are grouped within an enum - the enum implements the
MeterDocumentationinterface - If the span contains
KeyNamethen those need to be declared as nested enums - The
getKeyNames()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.10.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final io.micrometer.common.docs.KeyName[]Empty key names. -
Method Summary
Modifier and TypeMethodDescriptiondefault io.micrometer.common.docs.KeyName[]Additional key names.default @Nullable StringBase unit.default io.micrometer.common.docs.KeyName[]Allowed key names.getName()Metric name.default StringBuilds a name from provided vars.default StringReturns required prefix to be there for tags.getType()Type of this metric.default @Nullable Enum<?> Override this when custom metric should be documented instead of the default one.
-
Field Details
-
EMPTY
static final io.micrometer.common.docs.KeyName[] EMPTYEmpty key names.
-
-
Method Details
-
getName
String getName()Metric name.- Returns:
- metric name
-
getBaseUnit
Base unit.- Returns:
- base unit
-
getType
Meter.Type getType()Type of this metric.- Returns:
- meter type
-
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
-
getKeyNames
default io.micrometer.common.docs.KeyName[] getKeyNames()Allowed key names.- Returns:
- allowed key names - if set will override any key names coming from
overridesDefaultMetricFrom()
-
getAdditionalKeyNames
default io.micrometer.common.docs.KeyName[] getAdditionalKeyNames()Additional key names.- Returns:
- additional key names - if set will append any key names coming from
overridesDefaultMetricFrom()
-
overridesDefaultMetricFrom
Override this when custom metric should be documented instead of the default one. Requires the Observation module on the classpath.- Returns:
MeterDocumentationfor which you don't want to create a default metric 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
-