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
which is augmented by global tags (if available). 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. Global tags can be set by passing
the list of tags in an environment variable MP_METRICS_TAGS. Tag values set
through `MP_METRICS_TAGS` MUST escape equal symbols `=` and commas `,` with a backslash `\`
For example, the following can be used to set the global tags:
export MP_METRICS_TAGS=app=shop,tier=integration,special=deli\=ver\,y
| Modifier and Type | Field and Description |
|---|---|
static String |
APPLICATION_NAME_TAG |
static String |
APPLICATION_NAME_VARIABLE |
static String |
GLOBAL_TAGS_VARIABLE |
| 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. |
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.
|
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 static final String GLOBAL_TAGS_VARIABLE
public static final String APPLICATION_NAME_VARIABLE
public static final String APPLICATION_NAME_TAG
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 int compareTo(MetricID other)
compareTo in interface Comparable<MetricID>other - the other MetricIDCopyright © 2019. All rights reserved.