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
Tag s. |
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. |
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 © 2020. All rights reserved.