Package io.micrometer.core.instrument
Class Meter.Id
- java.lang.Object
-
- io.micrometer.core.instrument.Meter.Id
-
- Enclosing interface:
- Meter
public static class Meter.Id extends java.lang.ObjectA meter is uniquely identified by its combination of name and tags.
-
-
Constructor Summary
Constructors Constructor Description Id(java.lang.String name, Tags tags, java.lang.String baseUnit, java.lang.String description, Meter.Type type)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)java.lang.StringgetBaseUnit()java.lang.StringgetConventionName(NamingConvention namingConvention)java.util.List<Tag>getConventionTags(NamingConvention namingConvention)Tags that are sorted by key and formattedjava.lang.StringgetDescription()java.lang.StringgetName()java.lang.StringgetTag(java.lang.String key)java.util.List<Tag>getTags()java.lang.Iterable<Tag>getTagsAsIterable()Meter.TypegetType()The type is used by different registry implementations to structure the exposition of metrics to different backends.inthashCode()Meter.IdreplaceTags(java.lang.Iterable<Tag> tags)Generate a new id replacing all tags with new ones.Meter.IdsyntheticAssociation()For internal use.java.lang.StringtoString()Meter.IdwithBaseUnit(java.lang.String newBaseUnit)Generate a new id with a different base unit.Meter.IdwithName(java.lang.String newName)Generate a new id with a different name.Meter.IdwithTag(Statistic statistic)Generate a new id with an additional tag with a tag key of "statistic".Meter.IdwithTag(Tag tag)Generate a new id with an additional tag.Meter.IdwithTags(java.lang.Iterable<Tag> tags)Generate a new id with an additional tag.
-
-
-
Constructor Detail
-
Id
public Id(java.lang.String name, Tags tags, @Nullable java.lang.String baseUnit, @Nullable java.lang.String description, Meter.Type type)
-
-
Method Detail
-
withName
public Meter.Id withName(java.lang.String newName)
Generate a new id with a different name.- Parameters:
newName- The new name.- Returns:
- A new id with the provided name. The source id remains unchanged.
-
withTag
public Meter.Id withTag(Tag tag)
Generate a new id with an additional tag. If the key of the provided tag already exists, this overwrites the tag value.- Parameters:
tag- The tag to add.- Returns:
- A new id with the provided tag added. The source id remains unchanged.
-
withTags
public Meter.Id withTags(java.lang.Iterable<Tag> tags)
Generate a new id with an additional tag. If the key of the provided tag already exists, this overwrites the tag value.- Parameters:
tags- The tag to add.- Returns:
- A new id with the provided tags added. The source id remains unchanged.
- Since:
- 1.1.0
-
replaceTags
public Meter.Id replaceTags(java.lang.Iterable<Tag> tags)
Generate a new id replacing all tags with new ones.- Parameters:
tags- The tag to add.- Returns:
- A new id with the only the provided tags. The source id remains unchanged.
- Since:
- 1.1.0
-
withTag
public Meter.Id withTag(Statistic statistic)
Generate a new id with an additional tag with a tag key of "statistic". If the "statistic" tag already exists, this overwrites the tag value.- Parameters:
statistic- The statistic tag to add.- Returns:
- A new id with the provided tag. The source id remains unchanged.
-
withBaseUnit
public Meter.Id withBaseUnit(@Nullable java.lang.String newBaseUnit)
Generate a new id with a different base unit.- Parameters:
newBaseUnit- The base unit of the new id.- Returns:
- A new id with the provided base unit.
-
getName
public java.lang.String getName()
- Returns:
- The name of this meter.
-
getTags
public java.util.List<Tag> getTags()
- Returns:
- A set of dimensions that allows you to break down the name.
-
getTagsAsIterable
public java.lang.Iterable<Tag> getTagsAsIterable()
-
getTag
@Nullable public java.lang.String getTag(java.lang.String key)
- Parameters:
key- The tag key to attempt to match.- Returns:
- A matching tag value, or
nullif no tag with the provided key exists on this id.
-
getBaseUnit
@Nullable public java.lang.String getBaseUnit()
- Returns:
- The base unit of measurement for this meter.
-
getConventionName
public java.lang.String getConventionName(NamingConvention namingConvention)
- Parameters:
namingConvention- The naming convention used to normalize the id's name.- Returns:
- A name that has been stylized to a particular monitoring system's expectations.
-
getConventionTags
public java.util.List<Tag> getConventionTags(NamingConvention namingConvention)
Tags that are sorted by key and formatted- Parameters:
namingConvention- The naming convention used to normalize the id's name.- Returns:
- A list of tags that have been stylized to a particular monitoring system's expectations.
-
getDescription
@Nullable public java.lang.String getDescription()
- Returns:
- A description of the meter's purpose. This description text is published to monitoring systems that support description text.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(@Nullable java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
getType
public Meter.Type getType()
The type is used by different registry implementations to structure the exposition of metrics to different backends.- Returns:
- The meter's type.
-
syntheticAssociation
@Incubating(since="1.1.0") @Nullable public Meter.Id syntheticAssociation()
For internal use. Indicates that this Id is tied to a meter that is a derivative of another metric. For example, percentiles and histogram gauges generated byHistogramGaugesare derivatives of aTimerorDistributionSummary.This method may be removed in future minor or major releases if we find a way to mark derivatives in a private way that does not have other API compatibility consequences.
- Returns:
- The meter id of a meter for which this metric is a synthetic derivative.
-
-