Interface MetricData
- All Known Implementing Classes:
AutoValue_ImmutableMetricData
,EmptyMetricData
,ImmutableMetricData
@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 thedouble
GaugeData
if type isMetricDataType.DOUBLE_GAUGE
, otherwise a default empty data.default SumData
<DoublePointData> default ExponentialHistogramData
Returns theExponentialHistogramData
if type isMetricDataType.EXPONENTIAL_HISTOGRAM
, otherwise a default empty data.default HistogramData
Returns theHistogramData
if type isMetricDataType.HISTOGRAM
, otherwise a default empty data.Returns the metricInstrumentationScopeInfo
.default GaugeData
<LongPointData> default SumData
<LongPointData> getName()
Returns the metric name.Returns the metricResource
.default SummaryData
Returns theSummaryData
if type isMetricDataType.SUMMARY
, otherwise a default empty data.getType()
Returns the type of this metric.getUnit()
Returns the metric unit.default boolean
isEmpty()
Returnstrue
if there are no points associated with this metric.
-
Method Details
-
getResource
Resource getResource()Returns the metricResource
.The
Resource
is configured viaSdkMeterProviderBuilder.setResource(Resource)
. -
getInstrumentationScopeInfo
InstrumentationScopeInfo getInstrumentationScopeInfo()Returns the metricInstrumentationScopeInfo
.The
InstrumentationScopeInfo
is 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 // }
- See Also:
-
isEmpty
default boolean isEmpty()Returnstrue
if there are no points associated with this metric. -
getDoubleGaugeData
Returns thedouble
GaugeData
if type isMetricDataType.DOUBLE_GAUGE
, otherwise a default empty data. -
getLongGaugeData
-
getDoubleSumData
-
getLongSumData
-
getSummaryData
Returns theSummaryData
if type isMetricDataType.SUMMARY
, otherwise a default empty data. -
getHistogramData
Returns theHistogramData
if type isMetricDataType.HISTOGRAM
, otherwise a default empty data. -
getExponentialHistogramData
Returns theExponentialHistogramData
if type isMetricDataType.EXPONENTIAL_HISTOGRAM
, otherwise a default empty data.
-