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 EmptyMetricData
INSTANCE
-
Constructor Summary
Constructors Modifier Constructor Description private
EmptyMetricData()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Data<?>
getData()
Returns the unconstrained metric data.java.lang.String
getDescription()
Returns the metric description.static MetricData
getInstance()
Get an empty instance of metric data.InstrumentationScopeInfo
getInstrumentationScopeInfo()
Returns the metricInstrumentationScopeInfo
.java.lang.String
getName()
Returns the metric name.Resource
getResource()
Returns the metricResource
.MetricDataType
getType()
Returns the type of this metric.java.lang.String
getUnit()
Returns the metric unit.boolean
isEmpty()
Returnstrue
if 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:MetricData
Returns the metricResource
.The
Resource
is configured viaSdkMeterProviderBuilder.setResource(Resource)
.- Specified by:
getResource
in interfaceMetricData
-
getInstrumentationScopeInfo
public InstrumentationScopeInfo getInstrumentationScopeInfo()
Description copied from interface:MetricData
Returns the metricInstrumentationScopeInfo
.The
InstrumentationScopeInfo
is determined from the options used whenMeterBuilder.build()
ing theMeter
.- Specified by:
getInstrumentationScopeInfo
in interfaceMetricData
-
getName
public java.lang.String getName()
Description copied from interface:MetricData
Returns the metric name.The metric name is typically the instrument name, but may be optionally overridden by a
View
.- Specified by:
getName
in interfaceMetricData
-
getDescription
public java.lang.String getDescription()
Description copied from interface:MetricData
Returns the metric description.The metric name is typically the instrument description, but may be optionally overridden by a
View
.- Specified by:
getDescription
in interfaceMetricData
-
getUnit
public java.lang.String getUnit()
Description copied from interface:MetricData
Returns the metric unit.- Specified by:
getUnit
in interfaceMetricData
-
getType
public MetricDataType getType()
Description copied from interface:MetricData
Returns the type of this metric.- Specified by:
getType
in interfaceMetricData
-
getData
public Data<?> getData()
Description copied from interface:MetricData
Returns 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:
getData
in interfaceMetricData
- See Also:
MetricData.getDoubleGaugeData()
,MetricData.getLongGaugeData()
,MetricData.getDoubleSumData()
,MetricData.getLongSumData()
,MetricData.getHistogramData()
,MetricData.getSummaryData()
-
isEmpty
public boolean isEmpty()
Description copied from interface:MetricData
Returnstrue
if there are no points associated with this metric.- Specified by:
isEmpty
in interfaceMetricData
-
-