Package org.apache.cassandra.metrics
Class CassandraMetricsRegistry.MetricName
- java.lang.Object
-
- org.apache.cassandra.metrics.CassandraMetricsRegistry.MetricName
-
- All Implemented Interfaces:
java.lang.Comparable<CassandraMetricsRegistry.MetricName>
- Enclosing class:
- CassandraMetricsRegistry
public static class CassandraMetricsRegistry.MetricName extends java.lang.Object implements java.lang.Comparable<CassandraMetricsRegistry.MetricName>
A value class encapsulating a metric's owning class and name.
-
-
Constructor Summary
Constructors Constructor Description MetricName(java.lang.Class<?> klass, java.lang.String name)Creates a newCassandraMetricsRegistry.MetricNamewithout a scope.MetricName(java.lang.Class<?> klass, java.lang.String name, java.lang.String scope)Creates a newCassandraMetricsRegistry.MetricNamewithout a scope.MetricName(java.lang.String group, java.lang.String type, java.lang.String name)Creates a newCassandraMetricsRegistry.MetricNamewithout a scope.MetricName(java.lang.String group, java.lang.String type, java.lang.String name, java.lang.String scope)Creates a newCassandraMetricsRegistry.MetricNamewithout a scope.MetricName(java.lang.String group, java.lang.String type, java.lang.String name, java.lang.String scope, java.lang.String mBeanName)Creates a newCassandraMetricsRegistry.MetricNamewithout a scope.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.lang.StringchooseGroup(java.lang.String group, java.lang.Class<?> klass)If the group is empty, use the package name of the given class.static java.lang.StringchooseName(java.lang.String name, java.lang.reflect.Method method)If name is empty, use the name of the given method.static java.lang.StringchooseType(java.lang.String type, java.lang.Class<?> klass)If the type is empty, use the simple name of the given class.intcompareTo(CassandraMetricsRegistry.MetricName o)booleanequals(java.lang.Object o)java.lang.StringgetGroup()Returns the group to which theMetricbelongs.javax.management.ObjectNamegetMBeanName()Returns the MBean name for theMetricidentified by this metric name.java.lang.StringgetMetricName()java.lang.StringgetName()Returns the name of theMetric.java.lang.StringgetScope()Returns the scope of theMetric.java.lang.StringgetType()Returns the type to which theMetricbelongs.inthashCode()booleanhasScope()Returnstrueif theMetrichas a scope,falseotherwise.java.lang.StringtoString()
-
-
-
Constructor Detail
-
MetricName
public MetricName(java.lang.Class<?> klass, java.lang.String name)Creates a newCassandraMetricsRegistry.MetricNamewithout a scope.- Parameters:
klass- theClassto which theMetricbelongsname- the name of theMetric
-
MetricName
public MetricName(java.lang.String group, java.lang.String type, java.lang.String name)Creates a newCassandraMetricsRegistry.MetricNamewithout a scope.- Parameters:
group- the group to which theMetricbelongstype- the type to which theMetricbelongsname- the name of theMetric
-
MetricName
public MetricName(java.lang.Class<?> klass, java.lang.String name, java.lang.String scope)Creates a newCassandraMetricsRegistry.MetricNamewithout a scope.- Parameters:
klass- theClassto which theMetricbelongsname- the name of theMetricscope- the scope of theMetric
-
MetricName
public MetricName(java.lang.String group, java.lang.String type, java.lang.String name, java.lang.String scope)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
public MetricName(java.lang.String group, java.lang.String type, java.lang.String name, java.lang.String scope, java.lang.String mBeanName)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 Detail
-
getGroup
public java.lang.String 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
public java.lang.String 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
public java.lang.String getName()
Returns the name of theMetric.- Returns:
- the name of the
Metric
-
getMetricName
public java.lang.String getMetricName()
-
getScope
public java.lang.String 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
public javax.management.ObjectName getMBeanName()
Returns the MBean name for theMetricidentified by this metric name.- Returns:
- the MBean name
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
compareTo
public int compareTo(CassandraMetricsRegistry.MetricName o)
- Specified by:
compareToin interfacejava.lang.Comparable<CassandraMetricsRegistry.MetricName>
-
chooseGroup
public static java.lang.String chooseGroup(java.lang.String group, java.lang.Class<?> klass)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
public static java.lang.String chooseType(java.lang.String type, java.lang.Class<?> klass)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
public static java.lang.String chooseName(java.lang.String name, java.lang.reflect.Method method)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
-
-