Class EmptyMetricData
- java.lang.Object
-
- io.opentelemetry.sdk.metrics.internal.aggregator.EmptyMetricData
-
- All Implemented Interfaces:
MetricData
public final class EmptyMetricData extends java.lang.Object implements MetricData
This class is internal and is hence not for public use. Its APIs are unstable and can change at any time.
-
-
Field Summary
Fields Modifier and Type Field Description private static EmptyMetricDataINSTANCE
-
Constructor Summary
Constructors Modifier Constructor Description privateEmptyMetricData()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Data<?>getData()Returns the unconstrained metric data.java.lang.StringgetDescription()Returns the metric description.static MetricDatagetInstance()Get an empty instance of metric data.InstrumentationScopeInfogetInstrumentationScopeInfo()Returns the metricInstrumentationScopeInfo.java.lang.StringgetName()Returns the metric name.ResourcegetResource()Returns the metricResource.MetricDataTypegetType()Returns the type of this metric.java.lang.StringgetUnit()Returns the metric unit.booleanisEmpty()Returnstrueif there are no points associated with this metric.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.opentelemetry.sdk.metrics.data.MetricData
getDoubleGaugeData, getDoubleSumData, getExponentialHistogramData, getHistogramData, getLongGaugeData, getLongSumData, getSummaryData
-
-
-
-
Field Detail
-
INSTANCE
private static final EmptyMetricData INSTANCE
-
-
Method Detail
-
getInstance
public static MetricData getInstance()
Get an empty instance of metric data. Empty metric data should not be used except as an indication that recordings were dropped viaAggregation.drop().- Returns:
- an empty MetricData.
-
getResource
public Resource getResource()
Description copied from interface:MetricDataReturns the metricResource.The
Resourceis configured viaSdkMeterProviderBuilder.setResource(Resource).- Specified by:
getResourcein interfaceMetricData
-
getInstrumentationScopeInfo
public InstrumentationScopeInfo getInstrumentationScopeInfo()
Description copied from interface:MetricDataReturns the metricInstrumentationScopeInfo.The
InstrumentationScopeInfois determined from the options used whenMeterBuilder.build()ing theMeter.- Specified by:
getInstrumentationScopeInfoin interfaceMetricData
-
getName
public java.lang.String getName()
Description copied from interface:MetricDataReturns the metric name.The metric name is typically the instrument name, but may be optionally overridden by a
View.- Specified by:
getNamein interfaceMetricData
-
getDescription
public java.lang.String getDescription()
Description copied from interface:MetricDataReturns the metric description.The metric name is typically the instrument description, but may be optionally overridden by a
View.- Specified by:
getDescriptionin interfaceMetricData
-
getUnit
public java.lang.String getUnit()
Description copied from interface:MetricDataReturns the metric unit.- Specified by:
getUnitin interfaceMetricData
-
getType
public MetricDataType getType()
Description copied from interface:MetricDataReturns the type of this metric.- Specified by:
getTypein interfaceMetricData
-
getData
public Data<?> getData()
Description copied from interface:MetricDataReturns the unconstrained metric data.Most will instead prefer to access the constrained metric data after first checking the
MetricData.getType():// if (metricData.getType() == MetricDataType.LONG_SUM) { // SumData<LongPointData> sumData = metricData.getLongSumData(); // ... // Process long sum data // }- Specified by:
getDatain interfaceMetricData- See Also:
MetricData.getDoubleGaugeData(),MetricData.getLongGaugeData(),MetricData.getDoubleSumData(),MetricData.getLongSumData(),MetricData.getHistogramData(),MetricData.getSummaryData()
-
isEmpty
public boolean isEmpty()
Description copied from interface:MetricDataReturnstrueif there are no points associated with this metric.- Specified by:
isEmptyin interfaceMetricData
-
-