public class MetricID extends Object implements Comparable<MetricID>
Metric and Metadata that are registered in the MetricRegistry
The MetricID contains:
Name: (Required) The name of the metric.Tags: (Optional) The tags (represented by Tag objects) of the metric. The tag name must match the
regex `[a-zA-Z_][a-zA-Z0-9_]*` (Ascii alphabet, numbers and underscore). The tag value may contain any UTF-8 encoded
character.| Constructor and Description |
|---|
MetricID(String name)
Constructs a MetricID with the given metric name and no tags.
|
MetricID(String name,
Tag... tags)
Constructs a MetricID with the given metric name and
Tags. |
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(MetricID other)
Compares two MetricID objects through the following steps:
Compares the names of the two MetricIDs lexicographically. If the names are equal: Compare the number of tags. If the tag lengths are equal: Compare the Tags (sorted by the Tag's key value) a) Compare the Tag names/keys lexicographically b) If keys are equal, compare the Tag values lexicographically |
boolean |
equals(Object o) |
String |
getName()
Returns the Metric name associated with this MetricID
|
Map<String,String> |
getTags()
Returns the underlying map containing the tags.
|
Tag[] |
getTagsAsArray()
Gets the list of tags as an array of
Tag objects. |
List<Tag> |
getTagsAsList()
Gets the list of tags as a list of
Tag objects |
String |
getTagsAsString()
Gets the list of tags as a single String in the format 'key="value",key2="value2",...'
|
int |
hashCode() |
String |
toString() |
public MetricID(String name)
name - the name of the metricpublic String getName()
public Map<String,String> getTags()
Map of tagspublic String getTagsAsString()
public List<Tag> getTagsAsList()
Tag objectspublic Tag[] getTagsAsArray()
Tag objects.public int compareTo(MetricID other)
compareTo in interface Comparable<MetricID>other - the other MetricIDCopyright © 2017 – 2021 Eclipse Foundation. All rights reserved.
Use is subject to license terms.