Package org.apache.kafka.common
Class MetricNameTemplate
- java.lang.Object
-
- org.apache.kafka.common.MetricNameTemplate
-
public class MetricNameTemplate extends Object
A template for a MetricName. It contains a name, group, and description, as well as all the tags that will be used to create the mBean name. Tag values are omitted from the template, but are filled in at runtime with their specified values. The order of the tags is maintained, if an ordered set is provided, so that the mBean names can be compared and sorted lexicographically.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
description()
Get the description of the metric.boolean
equals(Object o)
String
group()
Get the name of the group.int
hashCode()
String
name()
Get the name of the metric.Set<String>
tags()
Get the set of tag names for the metric.String
toString()
-
-
-
Constructor Detail
-
MetricNameTemplate
public MetricNameTemplate(String name, String group, String description, Set<String> tagsNames)
Create a new template. Note that the order of the tags will be preserved if the suppliedtagsNames
set has an order.- Parameters:
name
- the name of the metric; may not be nullgroup
- the name of the group; may not be nulldescription
- the description of the metric; may not be nulltagsNames
- the set of metric tag names, which can/should be a set that maintains order; may not be null
-
MetricNameTemplate
public MetricNameTemplate(String name, String group, String description, String... tagsNames)
Create a new template. Note that the order of the tags will be preserved.- Parameters:
name
- the name of the metric; may not be nullgroup
- the name of the group; may not be nulldescription
- the description of the metric; may not be nulltagsNames
- the names of the metric tags in the preferred order; none of the tag names should be null
-
-
Method Detail
-
name
public String name()
Get the name of the metric.- Returns:
- the metric name; never null
-
group
public String group()
Get the name of the group.- Returns:
- the group name; never null
-
description
public String description()
Get the description of the metric.- Returns:
- the metric description; never null
-
tags
public Set<String> tags()
Get the set of tag names for the metric.- Returns:
- the ordered set of tag names; never null but possibly empty
-
-