Class MetricImpl<T>
java.lang.Object
org.apache.solr.cluster.placement.impl.MetricImpl<T>
- All Implemented Interfaces:
Metric<T>
- Direct Known Subclasses:
NodeMetricImpl,ReplicaMetricImpl
Base class for
Metric implementations.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionConvert raw value.booleanReturn the internal name of a Solr metric associated with this attribute.Return the label key for Prometheus metrics filtering, if any.Return the label value for Prometheus metrics filtering, if any.getName()Return the short-hand name that identifies this attribute.inthashCode()booleanReturn true if this metric has label filtering.toString()
-
Field Details
-
IDENTITY_CONVERTER
Identity converter. It returns the raw value unchanged IFF the value's type can be cast to the generic type of this attribute, otherwise it returns null. -
MB_TO_GB_CONVERTER
Megabytes to gigabytes converter. Supports converting number or string representations of raw values expressed in megabytes. -
name
-
internalName
-
converter
-
labelKey
-
labelValue
-
-
Constructor Details
-
MetricImpl
Create a metric attribute.- Parameters:
name- short-hand name that identifies this attribute.internalName- internal name of a Solr metric.
-
MetricImpl
Create a metric attribute.- Parameters:
name- short-hand name that identifies this attribute.internalName- internal name of a Solr metric.converter- optional raw value converter. If null thenIDENTITY_CONVERTERwill be used.
-
MetricImpl
public MetricImpl(String name, String internalName, String labelKey, String labelValue, Function<Object, T> converter) Create a metric attribute with labels.- Parameters:
name- short-hand name that identifies this attribute.internalName- internal name of a Solr metric.labelKey- optional label key for Prometheus format labeled metrics.labelValue- optional label value for Prometheus format labeled metrics.converter- optional raw value converter. If null thenIDENTITY_CONVERTERwill be used.
-
-
Method Details
-
getName
Description copied from interface:MetricReturn the short-hand name that identifies this attribute. -
getInternalName
Description copied from interface:MetricReturn the internal name of a Solr metric associated with this attribute.- Specified by:
getInternalNamein interfaceMetric<T>
-
getLabelKey
Description copied from interface:MetricReturn the label key for Prometheus metrics filtering, if any.- Specified by:
getLabelKeyin interfaceMetric<T>- Returns:
- label key or null if no label filtering is needed
-
getLabelValue
Description copied from interface:MetricReturn the label value for Prometheus metrics filtering, if any.- Specified by:
getLabelValuein interfaceMetric<T>- Returns:
- label value or null if no label filtering is needed
-
hasLabels
public boolean hasLabels()Description copied from interface:MetricReturn true if this metric has label filtering. -
convert
Description copied from interface:MetricConvert raw value. This may involve changing raw value type or units. -
equals
-
hashCode
public int hashCode() -
toString
-