OTelFactory class abstract

The OTelFactory is the plugin mechanism for OpenTelemetry SDK's. The OpenTelemetry specifies that the API must work without any SDK installed. The API uses the OTelAPIFactory as a default. SDKs override this default by registering their own APIFactory

Implementers

Constructors

OTelFactory.new({required String apiEndpoint, required String apiServiceName, required String apiServiceVersion, required OTelFactoryCreationFunction factoryFactory})
Creates a new OTelFactory with the specified parameters.

Properties

apiEndpoint String
Sets the API endpoint for this factory.
no getter
apiServiceName String
Sets the service name for this factory.
no getter
apiServiceVersion String
Sets the service version for this factory.
no getter
factoryFactory OTelFactoryCreationFunction
Used to reproduce the concrete factory across process boundaries, i.e. isolates
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

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.
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.
attributeBool(String key, bool value) Attribute<bool>
Creates an AttributeValue for the given boolean.
attributeBoolList(String key, List<bool> value) Attribute<List<bool>>
Creates an AttributeValue for the given boolean.
attributeDouble(String key, double value) Attribute<double>
Creates an AttributeValue for the given double.
attributeDoubleList(String key, List<double> value) Attribute<List<double>>
Creates an AttributeValue for the given double.
attributeInt(String key, int value) Attribute<int>
Creates an AttributeValue for the given int.
attributeIntList(String key, List<int> value) Attribute<List<int>>
Creates an AttributeValue for the given int.
attributes([List<Attribute<Object>>? entries]) Attributes
Creates an Attributes collection.
attributesFromList(List<Attribute<Object>> attributeList) Attributes
Creates an Attributes from a list of values;
attributesFromMap(Map<String, Object> namedMap) Attributes
Creates an Attributes from 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() used
attributeString(String key, String value) Attribute<String>
Creates an AttributeValue for the given String.
attributeStringList(String key, List<String> value) Attribute<List<String>>
Creates an AttributeValue for the given String.
baggage([Map<String, BaggageEntry>? entries]) Baggage
Creates an Baggage with the given name and entries.
baggageEntry(String value, [String? metadata]) BaggageEntry
Creates an BaggageEntry with the given value and optional metadata.
baggageForMap(Map<String, String> keyValuePairs) Baggage
Creates an Baggage with the given keyValuePairs which are converted into BaggageEntrys without metadata.
context({Baggage? baggage}) Context
Creates a new Context with optional Baggage.
contextKey<T>(String name, Uint8List explicitId) 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.
createCounter(String name, {String? description, String? unit}) APICounter<num>
Creates a APICounter instrument with the given name
createGauge(String name, {String? description, String? unit}) APIGauge<num>
Creates a APIGauge instrument with the given name
createHistogram(String name, {String? description, String? unit, List<double>? boundaries}) APIHistogram<num>
Creates a APIHistogram instrument with the given name
createMeasurement<T extends num>(T value, [Attributes? attributes]) Measurement<T>
Creates a measurement with the given value and optional attributes.
createObservableCounter(String name, {String? description, String? unit, ObservableCallback<num>? callback}) APIObservableCounter<num>
Creates an APIObservableCounter instrument with the given name
createObservableGauge(String name, {String? description, String? unit, ObservableCallback<num>? callback}) APIObservableGauge<num>
Creates an APIObservableGauge instrument with the given name
createObservableUpDownCounter(String name, {String? description, String? unit, ObservableCallback<num>? callback}) APIObservableUpDownCounter<num>
Creates an APIObservableUpDownCounter instrument with the given name
createUpDownCounter(String name, {String? description, String? unit}) APIUpDownCounter<num>
Creates a APIUpDownCounter instrument with the given name
getMeterProviders() List<APIMeterProvider>
return an array combining the global default tracer provider and any additional named trace providers added.
getNamedMeterProvider(String name) APIMeterProvider?
This is intended to be used by subclasses in their override of meterProvider and in created named APIMeterProviders.
getNamedTracerProvider(String name) APITracerProvider?
This is intended to be used by subclasses in their override of tracerProvider and in created named APITracerProviders.
getTracerProviders() List<APITracerProvider>
return an array combining the global default tracer provider and any additional named trace providers added.
globalDefaultMeterProvider() APIMeterProvider
Returns the global default meter provider
globalDefaultTracerProvider() APITracerProvider
Returns the global default tracer provider
instrumentationScope({required String name, String version = '1.0.0', String? schemaUrl, Attributes? attributes}) InstrumentationScope
Creates a new InstrumentationScope.
meterProvider({required String endpoint, String serviceName, String serviceVersion}) APIMeterProvider
Creates a APIMeterProvider
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reset() → void
Resets the factory to its initial state.
serialize() Map<String, dynamic>
Serializes the factory configuration into a map, used to reproduce the factory across execution contexts (isolates)
spanContext({TraceId? traceId, SpanId? spanId, SpanId? parentSpanId, TraceFlags? traceFlags, TraceState? traceState, bool? isRemote = false}) SpanContext
Creates a span context. Random trace and span ids will be generated if not provided.
spanContextFromParent(SpanContext parent) SpanContext
Creates a SpanContext from a parent span context
spanContextInvalid() SpanContext
Creates an invalid SpanContext as required by the specification
spanEvent(String name, Attributes? attributes, DateTime? timestamp) SpanEvent
Creates a SpanEvent with the given name and attributes and timestamp
spanEventNow(String name, [Attributes? attributes]) SpanEvent
Creates a SpanEvent with the given name and attributes and a timestamp generated during the call
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
spanIdInvalid() SpanId
Creates an invalid SpanId
Creates a SpanLink with the given spanContext and attributes
toString() String
A string representation of this object.
inherited
traceFlags([int flags]) TraceFlags
Creates a new TraceFlags with the options flags
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
traceIdInvalid() TraceId
Creates an invalid TraceId
tracerProvider({required String endpoint, String serviceName, String serviceVersion}) APITracerProvider
Creates a APITracerProvider
traceState(Map<String, String>? entries) TraceState
Creates a new TraceState with the provided entries

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

otelFactory OTelFactory?
SDKs must replace this otelFactory with their own to get the SDK object created instead of the API default implementation
getter/setter pair

Static Methods

deserialize(Map<String, dynamic> data, OTelFactoryCreationFunction factoryFactory) OTelFactory
Deserializes the factory configuration from a map from serialize, used to reproduce the factory across execution contexts (isolates)

Constants

defaultEndpoint → const String
Default OTel endpoint url