Package io.dropwizard.metrics5
Class MetricName
java.lang.Object
io.dropwizard.metrics5.MetricName
- All Implemented Interfaces:
Comparable<MetricName>
A metric name with the ability to include semantic tags.
This replaces the previous style where metric names where strictly dot-separated strings.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionappend
(MetricName append) Build the MetricName that is this with another path and tags appended to it.static MetricName
Build a new metric name using the specific path components.int
static MetricName
empty()
Returns an empty metric name.boolean
getKey()
getTags()
Returns the tags, sorted by key.int
hashCode()
Build the MetricName that is this with another path appended to it.Same astagged(Map)
, but takes a variadic list of arguments.Add tags to a metric name and return the newly created MetricName.toString()
-
Constructor Details
-
MetricName
-
-
Method Details
-
empty
Returns an empty metric name.- Returns:
- an empty metric name.
-
getKey
-
getTags
Returns the tags, sorted by key.- Returns:
- the tags (immutable), sorted by key.
-
resolve
Build the MetricName that is this with another path appended to it. The new MetricName inherits the tags of this one.- Parameters:
parts
- The extra path elements to add to the new metric.- Returns:
- A new metric name relative to the original by the path specified in parts.
-
tagged
Add tags to a metric name and return the newly created MetricName.- Parameters:
add
- Tags to add.- Returns:
- A newly created metric name with the specified tags associated with it.
-
tagged
Same astagged(Map)
, but takes a variadic list of arguments.- Parameters:
pairs
- An even list of strings acting as key-value pairs.- Returns:
- A newly created metric name with the specified tags associated with it.
- See Also:
-
append
Build the MetricName that is this with another path and tags appended to it.Semantically equivalent to:
this.resolve(append.getKey()).tagged(append.getTags());
- Parameters:
append
- The extra name element to add to the new metric.- Returns:
- A new metric name with path appended to the original, and tags included from both names.
-
build
Build a new metric name using the specific path components.Equivalent to:
MetricName.empty().resolve(parts);
- Parameters:
parts
- Path of the new metric name.- Returns:
- A newly created metric name with the specified path.
-
toString
-
equals
-
hashCode
public int hashCode() -
compareTo
- Specified by:
compareTo
in interfaceComparable<MetricName>
-