public class MetricName extends Object implements Comparable<MetricName>
| Modifier and Type | Field and Description |
|---|---|
static MetricName |
EMPTY |
static Map<String,String> |
EMPTY_TAGS |
static String |
SEPARATOR |
| Constructor and Description |
|---|
MetricName() |
MetricName(String key) |
MetricName(String key,
Map<String,String> tags) |
MetricName(String key,
Map<String,String> tags,
MetricLevel level) |
MetricName(String key,
MetricLevel level) |
| Modifier and Type | Method and Description |
|---|---|
static MetricName |
build(String... parts)
Build a new metric name using the specific path components.
|
int |
compareTo(MetricName o) |
boolean |
equals(Object obj) |
String |
getKey() |
MetricLevel |
getMetricLevel()
Return the level of this metric
The level indicates the importance of the metric
|
Map<String,String> |
getTags() |
int |
hashCode() |
static MetricName |
join(MetricName... parts)
Join the specified set of metric names.
|
MetricName |
level(MetricLevel level)
Metric level can be changed during runtime
|
MetricName |
resolve(String p) |
MetricName |
resolve(String p,
boolean inheritTags)
Build the MetricName that is this with another path appended to it.
|
MetricName |
tag(Map<String,String> add)
Add tags to a metric name and return the newly created MetricName.
|
MetricName |
tag(String... pairs)
Same as
tag(Map), but takes a variadic list
of arguments. |
String |
toString() |
public static final String SEPARATOR
public static final MetricName EMPTY
public MetricName()
public MetricName(String key)
public MetricName(String key, MetricLevel level)
public MetricName(String key, Map<String,String> tags, MetricLevel level)
public String getKey()
public MetricLevel getMetricLevel()
public MetricName level(MetricLevel level)
level - the level to setpublic MetricName resolve(String p)
#resolve(String, boolean)}public MetricName resolve(String p, boolean inheritTags)
p - The extra path element to add to the new metric.inheritTags - if true, tags will be inheritedpublic MetricName tag(Map<String,String> add)
add - Tags to add.public MetricName tag(String... pairs)
tag(Map), but takes a variadic list
of arguments.pairs - An even list of strings acting as key-value pairs.tag(Map)public static MetricName join(MetricName... parts)
parts - Multiple metric names to join using the separator.public static MetricName build(String... parts)
parts - Path of the new metric name.public int compareTo(MetricName o)
compareTo in interface Comparable<MetricName>Copyright © 2011–2019 The Apache Software Foundation. All rights reserved.