Interface MetricData
- All Known Implementing Classes:
DelegatingMetricData
@Immutable
public interface MetricData
Metric data represents the aggregated measurements of an instrument.
- Since:
- 1.14.0
-
Method Summary
Modifier and TypeMethodDescriptionData<?>getData()Returns the unconstrained metric data.Returns the metric description.default GaugeData<DoublePointData>Returns thedoubleGaugeDataif type isMetricDataType.DOUBLE_GAUGE, otherwise a default empty data.default SumData<DoublePointData>default ExponentialHistogramDataReturns theExponentialHistogramDataif type isMetricDataType.EXPONENTIAL_HISTOGRAM, otherwise a default empty data.default HistogramDataReturns theHistogramDataif type isMetricDataType.HISTOGRAM, otherwise a default empty data.io.opentelemetry.sdk.common.InstrumentationScopeInfoReturns the metricInstrumentationScopeInfo.default GaugeData<LongPointData>default SumData<LongPointData>getName()Returns the metric name.io.opentelemetry.sdk.resources.ResourceReturns the metricResource.default SummaryDataReturns theSummaryDataif type isMetricDataType.SUMMARY, otherwise a default empty data.getType()Returns the type of this metric.getUnit()Returns the metric unit.default booleanisEmpty()Returnstrueif there are no points associated with this metric.
-
Method Details
-
getResource
io.opentelemetry.sdk.resources.Resource getResource()Returns the metricResource.The
Resourceis configured viaSdkMeterProviderBuilder.setResource(Resource). -
getInstrumentationScopeInfo
io.opentelemetry.sdk.common.InstrumentationScopeInfo getInstrumentationScopeInfo()Returns the metricInstrumentationScopeInfo.The
InstrumentationScopeInfois determined from the options used whenMeterBuilder.build()ing theMeter. -
getName
String getName()Returns the metric name.The metric name is typically the instrument name, but may be optionally overridden by a
View. -
getDescription
String getDescription()Returns the metric description.The metric name is typically the instrument description, but may be optionally overridden by a
View. -
getUnit
String getUnit()Returns the metric unit. -
getType
MetricDataType getType()Returns the type of this metric. -
getData
Data<?> getData()Returns the unconstrained metric data.Most will instead prefer to access the constrained metric data after first checking the
getType():// if (metricData.getType() == MetricDataType.LONG_SUM) { // SumData<LongPointData> sumData = metricData.getLongSumData(); // ... // Process long sum data // } -
isEmpty
default boolean isEmpty()Returnstrueif there are no points associated with this metric. -
getDoubleGaugeData
Returns thedoubleGaugeDataif type isMetricDataType.DOUBLE_GAUGE, otherwise a default empty data. -
getLongGaugeData
-
getDoubleSumData
-
getLongSumData
-
getSummaryData
Returns theSummaryDataif type isMetricDataType.SUMMARY, otherwise a default empty data. -
getHistogramData
Returns theHistogramDataif type isMetricDataType.HISTOGRAM, otherwise a default empty data. -
getExponentialHistogramData
Returns theExponentialHistogramDataif type isMetricDataType.EXPONENTIAL_HISTOGRAM, otherwise a default empty data.
-