Package org.apache.cassandra.metrics
Class CassandraMetricsRegistry.MetricName
java.lang.Object
org.apache.cassandra.metrics.CassandraMetricsRegistry.MetricName
- All Implemented Interfaces:
Comparable<CassandraMetricsRegistry.MetricName>
- Enclosing class:
- CassandraMetricsRegistry
public static class CassandraMetricsRegistry.MetricName
extends Object
implements Comparable<CassandraMetricsRegistry.MetricName>
A value class encapsulating a metric's owning class and name.
-
Constructor Summary
ConstructorsConstructorDescriptionMetricName(Class<?> klass, String name) Creates a newCassandraMetricsRegistry.MetricNamewithout a scope.MetricName(Class<?> klass, String name, String scope) Creates a newCassandraMetricsRegistry.MetricNamewithout a scope.MetricName(String group, String type, String name) Creates a newCassandraMetricsRegistry.MetricNamewithout a scope.MetricName(String group, String type, String name, String scope) Creates a newCassandraMetricsRegistry.MetricNamewithout a scope.Creates a newCassandraMetricsRegistry.MetricNamewithout a scope. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringchooseGroup(String group, Class<?> klass) If the group is empty, use the package name of the given class.static StringchooseName(String name, Method method) If name is empty, use the name of the given method.static StringchooseType(String type, Class<?> klass) If the type is empty, use the simple name of the given class.intbooleangetGroup()Returns the group to which theMetricbelongs.Returns the MBean name for theMetricidentified by this metric name.getName()Returns the name of theMetric.getScope()Returns the scope of theMetric.getType()Returns the type to which theMetricbelongs.inthashCode()booleanhasScope()Returnstrueif theMetrichas a scope,falseotherwise.toString()
-
Constructor Details
-
MetricName
Creates a newCassandraMetricsRegistry.MetricNamewithout a scope.- Parameters:
klass- theClassto which theMetricbelongsname- the name of theMetric
-
MetricName
Creates a newCassandraMetricsRegistry.MetricNamewithout a scope.- Parameters:
group- the group to which theMetricbelongstype- the type to which theMetricbelongsname- the name of theMetric
-
MetricName
Creates a newCassandraMetricsRegistry.MetricNamewithout a scope.- Parameters:
klass- theClassto which theMetricbelongsname- the name of theMetricscope- the scope of theMetric
-
MetricName
Creates a newCassandraMetricsRegistry.MetricNamewithout a scope.- Parameters:
group- the group to which theMetricbelongstype- the type to which theMetricbelongsname- the name of theMetricscope- the scope of theMetric
-
MetricName
Creates a newCassandraMetricsRegistry.MetricNamewithout a scope.- Parameters:
group- the group to which theMetricbelongstype- the type to which theMetricbelongsname- the name of theMetricscope- the scope of theMetricmBeanName- the 'ObjectName', represented as a string, to use when registering the MBean.
-
-
Method Details
-
getGroup
Returns the group to which theMetricbelongs. For class-based metrics, this will be the package name of theClassto which theMetricbelongs.- Returns:
- the group to which the
Metricbelongs
-
getType
Returns the type to which theMetricbelongs. For class-based metrics, this will be the simple class name of theClassto which theMetricbelongs.- Returns:
- the type to which the
Metricbelongs
-
getName
Returns the name of theMetric.- Returns:
- the name of the
Metric
-
getMetricName
-
getScope
Returns the scope of theMetric.- Returns:
- the scope of the
Metric
-
hasScope
public boolean hasScope()Returnstrueif theMetrichas a scope,falseotherwise.- Returns:
trueif theMetrichas a scope
-
getMBeanName
Returns the MBean name for theMetricidentified by this metric name.- Returns:
- the MBean name
-
equals
-
hashCode
public int hashCode() -
toString
-
compareTo
- Specified by:
compareToin interfaceComparable<CassandraMetricsRegistry.MetricName>
-
chooseGroup
If the group is empty, use the package name of the given class. Otherwise use group- Parameters:
group- The group to use by defaultklass- The class being tracked- Returns:
- a group for the metric
-
chooseType
If the type is empty, use the simple name of the given class. Otherwise use type- Parameters:
type- The type to use by defaultklass- The class being tracked- Returns:
- a type for the metric
-
chooseName
If name is empty, use the name of the given method. Otherwise use name- Parameters:
name- The name to use by defaultmethod- The method being tracked- Returns:
- a name for the metric
-