OTelSDKFactory class
Factory implementation for creating OpenTelemetry SDK objects.
The OTelSDKFactory extends the API factory to provide implementations of SDK-specific objects and override API object creation to use SDK implementations. This factory is the primary entry point for creating OpenTelemetry objects in the SDK.
The OpenTelemetry specification requires the API to work without an SDK installed. When the SDK is installed, this factory replaces the API's factory to provide concrete implementations instead of no-op implementations.
- Inheritance
-
- Object
- OTelFactory
- OTelAPIFactory
- OTelSDKFactory
Constructors
- OTelSDKFactory({required String apiEndpoint, required String apiServiceName, required String apiServiceVersion, OTelFactoryCreationFunction? factoryFactory = otelSDKFactoryFactoryFunction})
- Creates a new OTelSDKFactory with the specified configuration.
Properties
- apiEndpoint ← String
-
Sets the API endpoint for this factory.
no getterinherited
- apiServiceName ← String
-
Sets the service name for this factory.
no getterinherited
- apiServiceVersion ← String
-
Sets the service version for this factory.
no getterinherited
- defaultErrorHandler → OTelErrorHandler
-
The default error handler used whenever no user errorHandler is
installed: OTelErrorHandling.defaultErrorHandler, which logs
through OTelLog and never throws.
no setterinherited
- errorHandler ↔ OTelErrorHandler?
-
The user-installed global error handler, or
nullwhen none is installed.getter/setter pairinherited - factoryFactory → OTelFactoryCreationFunction
-
Used to reproduce the concrete factory
across process boundaries, i.e. isolates
finalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- isAPIFactory → bool
-
The pure API factory is the spec-mandated no-op used when no SDK is
installed; SDK initialization may replace it.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- textMapPropagator ↔ TextMapPropagator
-
The global TextMapPropagator.
getter/setter pairinherited
Methods
-
addLogProvider(
String name, {String? endpoint, String? serviceName, String? serviceVersion}) → APILoggerProvider -
Creates a new LogProvider referenced by
name. If name is null, this returns the global default APILoggerProvider, if not it returns a LogProvider for the name. If the LogProvider does not exist, it is created.inherited -
addMeterProvider(
String name, {String? endpoint, String? serviceName, String? serviceVersion}) → APIMeterProvider -
Creates a new MeterProvider referenced by
name. If name is null, this returns the global default APIMeterProvider, if not it returns a MeterProvider for the name. If the MeterProvider does not exist, it is created.inherited -
addTracerProvider(
String name, {String? endpoint, String? serviceName, String? serviceVersion}) → APITracerProvider -
Creates a new TracerProvider referenced by
name. If name is null, this returns the global default APITracerProvider, if not it returns a TracerProvider for the name. If the TracerProvider does not exist, it is created.inherited -
attributeBool(
String key, bool value) → Attribute< bool> -
Creates an
AttributeValuefor the given boolean.inherited -
attributeBoolList(
String key, List< bool> value) → Attribute<List< bool> > -
Creates an
AttributeValuefor the given boolean.inherited -
attributeDouble(
String key, double value) → Attribute< double> -
Creates an
AttributeValuefor the given double.inherited -
attributeDoubleList(
String key, List< double> value) → Attribute<List< double> > -
Creates an
AttributeValuefor the given double.inherited -
attributeInt(
String key, int value) → Attribute< int> -
Creates an
AttributeValuefor the given int.inherited -
attributeIntList(
String key, List< int> value) → Attribute<List< int> > -
Creates an
AttributeValuefor the given int.inherited -
attributes(
[List< Attribute< ? entries]) → AttributesObject> > -
Creates an
Attributescollection.inherited -
attributesFromList(
List< Attribute< attributeList) → AttributesObject> > -
Creates an
Attributesfrom a list of values;inherited -
attributesFromMap(
Map< String, Object> namedMap) → Attributes -
Creates an
Attributesfrom a named set of key value pairs; Values that are, String, bool, int, double, List<String>, List<bool>, List<int> or List<double> are used directly, DateTime is converted to the UTC formatted String, other values have their toString() usedinherited -
attributeString(
String key, String value) → Attribute< String> -
Creates an
AttributeValuefor the given String.inherited -
attributeStringList(
String key, List< String> value) → Attribute<List< String> > -
Creates an
AttributeValuefor the given String.inherited -
baggage(
[Map< String, BaggageEntry> ? entries]) → Baggage -
Creates an
Baggagewith the givennameandentries.inherited -
baggageEntry(
String value, [String? metadata]) → BaggageEntry -
Creates an
BaggageEntrywith the givenvalueand optionalmetadata.inherited -
baggageForMap(
Map< String, String> keyValuePairs) → Baggage -
Creates an
Baggagewith the givenkeyValuePairswhich are converted intoBaggageEntrys without metadata.inherited -
compositePropagator<
C, V> (List< TextMapPropagator< propagators) → TextMapPropagator<C, V> >C, V> -
Creates a TextMapPropagator that delegates to
propagators, injecting in list order and extracting in reverse order.inherited -
context(
{Baggage? baggage}) → Context -
Creates a new
Contextwith optional Baggage.inherited -
contextKey<
T> (String name, Uint8List id, {bool isTransferable = false}) → ContextKey< T> -
Generates a ContextKey. Context keys are always unique, even if they
have the same name, per spec. The name is used for debugging only.
inherited
-
createCounter(
String name, {String? description, String? unit, InstrumentAdvisory? advisory}) → APICounter< num> -
Creates a APICounter instrument with the given name
inherited
-
createGauge(
String name, {String? description, String? unit, InstrumentAdvisory? advisory}) → APIGauge< num> -
Creates a APIGauge instrument with the given name
inherited
-
createHistogram(
String name, {String? description, String? unit, List< double> ? boundaries, InstrumentAdvisory? advisory}) → APIHistogram<num> -
Creates a APIHistogram instrument with the given name
inherited
-
createMeasurement<
T extends num> (T value, [Attributes? attributes]) → Measurement< T> -
Creates a measurement with the given value and optional attributes.
inherited
-
createObservableCounter(
String name, {String? description, String? unit, ObservableCallback< num> ? callback, List<ObservableCallback< callbacks = const [], InstrumentAdvisory? advisory}) → APIObservableCounter<num> >num> -
Creates an APIObservableCounter instrument with the given name
inherited
-
createObservableGauge(
String name, {String? description, String? unit, ObservableCallback< num> ? callback, List<ObservableCallback< callbacks = const [], InstrumentAdvisory? advisory}) → APIObservableGauge<num> >num> -
Creates an APIObservableGauge instrument with the given name
inherited
-
createObservableUpDownCounter(
String name, {String? description, String? unit, ObservableCallback< num> ? callback, List<ObservableCallback< callbacks = const [], InstrumentAdvisory? advisory}) → APIObservableUpDownCounter<num> >num> -
Creates an APIObservableUpDownCounter instrument with the given name
inherited
-
createUpDownCounter(
String name, {String? description, String? unit, InstrumentAdvisory? advisory}) → APIUpDownCounter< num> -
Creates a APIUpDownCounter instrument with the given name
inherited
-
getLoggerProviders(
) → List< APILoggerProvider> -
return an array combining the global default logger provider and any
additional named logger providers added.
inherited
-
getMeterProviders(
) → List< APIMeterProvider> -
return an array combining the global default tracer provider and any
additional named trace providers added.
inherited
-
getNamedLogProvider(
String name) → APILoggerProvider? -
This is intended to be used by subclasses in their override
of loggerProvider and in created named APILoggerProviders.
inherited
-
getNamedMeterProvider(
String name) → APIMeterProvider? -
This is intended to be used by subclasses in their override
of meterProvider and in created named APIMeterProviders.
inherited
-
getNamedTracerProvider(
String name) → APITracerProvider? -
This is intended to be used by subclasses in their override
of tracerProvider and in created named APITracerProviders.
inherited
-
getTracerProviders(
) → List< APITracerProvider> -
return an array combining the global default tracer provider and any
additional named trace providers added.
inherited
-
globalDefaultLogProvider(
) → APILoggerProvider -
Returns the global default log provider
inherited
-
globalDefaultMeterProvider(
) → APIMeterProvider -
Returns the global default meter provider
inherited
-
globalDefaultTracerProvider(
) → APITracerProvider -
Returns the global default tracer provider
inherited
-
instrumentationScope(
{required String name, String version = '1.0.0', String? schemaUrl, Attributes? attributes}) → InstrumentationScope -
Creates a new InstrumentationScope.
inherited
-
loggerProvider(
{required String endpoint, String serviceName = '@dart/opentelemetry_api', String? serviceVersion, Resource? resource}) → APILoggerProvider -
Creates a LoggerProvider with the specified configuration.
override
-
meterProvider(
{required String endpoint, String serviceName = '@dart/opentelemetry_api', String? serviceVersion, Resource? resource}) → APIMeterProvider -
Creates a MeterProvider with the specified configuration.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
reset(
) → void -
inherited
-
resource(
Attributes attributes, [String? schemaUrl]) → Resource - Creates a new Resource with the specified attributes and schema URL.
-
resourceEmpty(
) → Resource - Creates an empty resource with no attributes.
-
serialize(
) → Map< String, dynamic> -
Serializes the factory configuration into a map, used to
reproduce the factory across execution contexts (isolates)
inherited
-
spanContext(
{TraceId? traceId, SpanId? spanId, SpanId? parentSpanId, TraceFlags? traceFlags, TraceState? traceState, bool? isRemote}) → SpanContext -
Creates a span context. Random trace and span ids
will be generated if not provided.
inherited
-
spanContextFromParent(
SpanContext parent) → SpanContext -
Creates a SpanContext from a parent span context
inherited
-
spanContextInvalid(
) → SpanContext -
Creates an invalid SpanContext as required by the specification
inherited
-
spanEvent(
String name, [Attributes? attributes, DateTime? timestamp]) → SpanEvent -
Creates a SpanEvent with the given
nameandattributesandtimestampinherited -
spanEventNow(
String name, [Attributes? attributes]) → SpanEvent -
Creates a SpanEvent with the given
nameandattributesand a timestamp generated during the callinherited -
spanId(
[Uint8List? spanId]) → SpanId -
Creates a new SpanId either randomly or with the given bytes,
If provided trace bytes must have a length of 16 bytes
inherited
-
spanIdInvalid(
[Uint8List? spanId]) → SpanId -
Creates an invalid SpanId
inherited
-
spanLink(
SpanContext spanContext, {Attributes? attributes}) → SpanLink -
Creates a SpanLink with the given
spanContextandattributesinherited -
toString(
) → String -
A string representation of this object.
inherited
-
traceFlags(
[int? flags]) → TraceFlags -
Creates a new TraceFlags with the options flags
inherited
-
traceId(
[Uint8List? traceIdBytes]) → TraceId -
Creates a new TraceId either randomly or with the given bytes,
If provided trace bytes must have a length of 16 bytes
inherited
-
traceIdInvalid(
) → TraceId -
Creates an invalid TraceId
inherited
-
tracerProvider(
{required String endpoint, String serviceName = '@dart/opentelemetry_api', String? serviceVersion, Resource? resource}) → APITracerProvider -
Creates a TracerProvider with the specified configuration.
override
-
traceState(
Map< String, String> ? entries) → TraceState -
Creates a new TraceState with the provided
entriesinherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited