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 Objectprivate static final Loggerprivate final Map<MetricDescriptor, MetricStorage> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns aCollectionof the registeredMetricStorage.<I extends MetricStorage>
Iregister(I newStorage) Registers the metricnewStorageto this registry.voidReset the storage registry, clearing all storages.
-
Field Details
-
logger
-
lock
-
registry
-
-
Constructor Details
-
MetricStorageRegistry
public MetricStorageRegistry()
-
-
Method Details
-
getStorages
Returns aCollectionof the registeredMetricStorage. -
register
Registers the metricnewStorageto 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 incompatibleMetricDescriptorwas previously registered, logs a diagnostic warning and returns thenewStorage.- Parameters:
newStorage- the metric storage to use or discard.- Returns:
- the
newStorageif no compatible metric is already registered, otherwise the previously registered storage.
-
resetForTest
public void resetForTest()Reset the storage registry, clearing all storages.
-