Class DelegatingMetricData
java.lang.Object
io.opentelemetry.sdk.metrics.data.DelegatingMetricData
- All Implemented Interfaces:
MetricData
A
MetricData which delegates all methods to another MetricData. Extend this class
to modify the MetricData that will be exported, for example by creating a delegating
MetricExporter which wraps MetricData with a
custom implementation.
Example usage:
// class MetricDataWithCustomDescription extends DelegatingMetricData {
//
// private final String description;
//
// MetricDataWithCustomDescription(MetricData delegate) {
// super(delegate);
// this.description = delegate.getDescription() + " (custom)";
// }
//
// @Override
// public String getDescription() {
// return description;
// }
// }
- Since:
- 1.50.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns a boolean indicating whether the delegateMetricDatais equal to thisMetricData.Data<?>getData()Returns the data of the metric.Returns the description of the metric.io.opentelemetry.sdk.common.InstrumentationScopeInfoReturns the instrumentation library information associated with this metric data.getName()Returns the name of the metric.io.opentelemetry.sdk.resources.ResourceReturns the resource associated with this metric data.getType()Returns the type of the metric.getUnit()Returns the unit of the metric.inthashCode()Returns a hash code value for the delegateMetricData.toString()Returns a string representation of the delegateMetricData.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface io.opentelemetry.sdk.metrics.data.MetricData
getDoubleGaugeData, getDoubleSumData, getExponentialHistogramData, getHistogramData, getLongGaugeData, getLongSumData, getSummaryData, isEmpty
-
Constructor Details
-
DelegatingMetricData
-
-
Method Details
-
getResource
public io.opentelemetry.sdk.resources.Resource getResource()Returns the resource associated with this metric data.- Specified by:
getResourcein interfaceMetricData- Returns:
- the
Resourceinstance.
-
getInstrumentationScopeInfo
public io.opentelemetry.sdk.common.InstrumentationScopeInfo getInstrumentationScopeInfo()Returns the instrumentation library information associated with this metric data.- Specified by:
getInstrumentationScopeInfoin interfaceMetricData- Returns:
- the
InstrumentationScopeInfoinstance.
-
getName
Returns the name of the metric.- Specified by:
getNamein interfaceMetricData- Returns:
- the name of the metric.
-
getDescription
Returns the description of the metric.- Specified by:
getDescriptionin interfaceMetricData- Returns:
- the description of the metric.
-
getUnit
Returns the unit of the metric.- Specified by:
getUnitin interfaceMetricData- Returns:
- the unit of the metric.
-
getType
Returns the type of the metric.- Specified by:
getTypein interfaceMetricData- Returns:
- the type of the metric.
-
getData
Returns the data of the metric.- Specified by:
getDatain interfaceMetricData- Returns:
- the data of the metric.
- See Also:
-
equals
Returns a boolean indicating whether the delegateMetricDatais equal to thisMetricData.- Overrides:
equalsin classObject- Parameters:
o- the object to compare to.- Returns:
- a boolean indicating whether the delegate
MetricDatais equal to thisMetricData.
-
hashCode
public int hashCode()Returns a hash code value for the delegateMetricData.- Overrides:
hashCodein classObject- Returns:
- a hash code value for the delegate
MetricData.
-
toString
Returns a string representation of the delegateMetricData.
-