Package io.opentelemetry.sdk.internal
Class ComponentRegistry<V>
- java.lang.Object
-
- io.opentelemetry.sdk.internal.ComponentRegistry<V>
-
- Type Parameters:
V- the type of the registered value.
public final class ComponentRegistry<V> extends java.lang.ObjectComponent (tracer, meter, etc) registry class for all the provider classes (TracerProvider, MeterProvider, etc.).Components are identified by name, version, and schema. Name is required, but version and schema are optional. Therefore, we have 4 possible scenarios for component keys:
- Only name is provided, represented by
componentByName - Name and version are provided, represented by
componentByNameAndVersion - Name and schema are provided, represented by
componentByNameAndSchema - Name, version and schema are provided, represented by
componentByNameVersionAndSchema
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 java.util.Set<V>allComponentsprivate java.util.Map<java.lang.String,V>componentByNameprivate java.util.Map<java.lang.String,java.util.Map<java.lang.String,V>>componentByNameAndSchemaprivate java.util.Map<java.lang.String,java.util.Map<java.lang.String,V>>componentByNameAndVersionprivate java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.Map<java.lang.String,V>>>componentByNameVersionAndSchemaprivate java.util.function.Function<InstrumentationScopeInfo,V>factoryprivate java.lang.Objectlock
-
Constructor Summary
Constructors Constructor Description ComponentRegistry(java.util.function.Function<InstrumentationScopeInfo,V> factory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private VbuildComponent(InstrumentationScopeInfo instrumentationScopeInfo)Vget(java.lang.String name, java.lang.String version, java.lang.String schemaUrl, Attributes attributes)Returns the component associated with thename,version, andschemaUrl.java.util.Collection<V>getComponents()Returns aCollectionview of the registered components.
-
-
-
Field Detail
-
componentByName
private final java.util.Map<java.lang.String,V> componentByName
-
componentByNameAndVersion
private final java.util.Map<java.lang.String,java.util.Map<java.lang.String,V>> componentByNameAndVersion
-
componentByNameAndSchema
private final java.util.Map<java.lang.String,java.util.Map<java.lang.String,V>> componentByNameAndSchema
-
componentByNameVersionAndSchema
private final java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.Map<java.lang.String,V>>> componentByNameVersionAndSchema
-
lock
private final java.lang.Object lock
-
allComponents
private final java.util.Set<V> allComponents
-
factory
private final java.util.function.Function<InstrumentationScopeInfo,V> factory
-
-
Constructor Detail
-
ComponentRegistry
public ComponentRegistry(java.util.function.Function<InstrumentationScopeInfo,V> factory)
-
-
Method Detail
-
get
public V get(java.lang.String name, @Nullable java.lang.String version, @Nullable java.lang.String schemaUrl, Attributes attributes)
Returns the component associated with thename,version, andschemaUrl.Attributesare not part of component identity. Behavior is undefined when differentAttributesare provided wherename,version, andschemaUrlare identical.
-
buildComponent
private V buildComponent(InstrumentationScopeInfo instrumentationScopeInfo)
-
getComponents
public java.util.Collection<V> getComponents()
Returns aCollectionview of the registered components.- Returns:
- a
Collectionview of the registered components.
-
-