Class MetricStorageRegistry
java.lang.Object
io.opentelemetry.sdk.metrics.internal.state.MetricStorageRegistry
Responsible for storing metrics by
MetricDescriptor
and returning access to input
pipeline for instrument measurements.
Each descriptor in the registry results in an exported metric stream. Under normal
circumstances each descriptor shares a unique MetricDescriptor.getName()
. When multiple
descriptors share the same name, but have some difference in identifying fields, an identity
conflict has occurred. The registry detects identity conflicts on register(MetricStorage)
and logs diagnostic information when they occur. See MetricDescriptor.equals(Object)
for definition of identity equality.
This class is internal and is hence not for public use. Its APIs are unstable and can change at any time.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Object
private static final Logger
private final Map
<MetricDescriptor, MetricStorage> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns aCollection
of the registeredMetricStorage
.<I extends MetricStorage>
Iregister
(I newStorage) Registers the metricnewStorage
to this registry.void
Reset the storage registry, clearing all storages.
-
Field Details
-
logger
-
lock
-
registry
-
-
Constructor Details
-
MetricStorageRegistry
public MetricStorageRegistry()
-
-
Method Details
-
getStorages
Returns aCollection
of the registeredMetricStorage
. -
register
Registers the metricnewStorage
to this registry. If a metric with compatible identity was previously registered, returns the previously registered storage. If a metric with the same name (case-insensitive) but incompatibleMetricDescriptor
was previously registered, logs a diagnostic warning and returns thenewStorage
.- Parameters:
newStorage
- the metric storage to use or discard.- Returns:
- the
newStorage
if no compatible metric is already registered, otherwise the previously registered storage.
-
resetForTest
public void resetForTest()Reset the storage registry, clearing all storages.
-