OTelAPIFactory class

The factory used when no SDK is installed. The OpenTelemetry specification requires the API to work without an SDK installed All construction APIs use the factory, such as builders or 'from' helpers.

Inheritance

Constructors

OTelAPIFactory.new({required String apiEndpoint, required String apiServiceName, required String apiServiceVersion, OTelFactoryCreationFunction? factoryFactory = otelApiFactoryFactoryFunction})
Creates a new instance of OTelAPIFactory with the specified parameters.

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
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
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.
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 AttributeValue for the given boolean.
override
attributeBoolList(String key, List<bool> value) Attribute<List<bool>>
Creates an AttributeValue for the given boolean.
override
attributeDouble(String key, double value) Attribute<double>
Creates an AttributeValue for the given double.
override
attributeDoubleList(String key, List<double> value) Attribute<List<double>>
Creates an AttributeValue for the given double.
override
attributeInt(String key, int value) Attribute<int>
Creates an AttributeValue for the given int.
override
attributeIntList(String key, List<int> value) Attribute<List<int>>
Creates an AttributeValue for the given int.
override
attributes([List<Attribute<Object>>? entries]) Attributes
Creates an Attributes collection.
override
attributesFromList(List<Attribute<Object>> attributeList) Attributes
Creates an Attributes from a list of values;
override
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
override
attributeString(String key, String value) Attribute<String>
Creates an AttributeValue for the given String.
override
attributeStringList(String key, List<String> value) Attribute<List<String>>
Creates an AttributeValue for the given String.
override
baggage([Map<String, BaggageEntry>? entries]) Baggage
Creates an Baggage with the given name and entries.
override
baggageEntry(String value, [String? metadata]) BaggageEntry
Creates an BaggageEntry with the given value and optional metadata.
override
baggageForMap(Map<String, String> keyValuePairs) Baggage
Creates an Baggage with the given keyValuePairs which are converted into BaggageEntrys without metadata.
override
context({Baggage? baggage}) Context
Creates a new Context with optional Baggage.
override
contextKey<T>(String name, Uint8List id) 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.
override
createCounter(String name, {String? description, String? unit}) APICounter<num>
Creates a APICounter instrument with the given name
override
createGauge(String name, {String? description, String? unit}) APIGauge<num>
Creates a APIGauge instrument with the given name
override
createHistogram(String name, {String? description, String? unit, List<double>? boundaries}) APIHistogram<num>
Creates a APIHistogram instrument with the given name
override
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}) APIObservableCounter<num>
Creates an APIObservableCounter instrument with the given name
override
createObservableGauge(String name, {String? description, String? unit, ObservableCallback<num>? callback}) APIObservableGauge<num>
Creates an APIObservableGauge instrument with the given name
override
createObservableUpDownCounter(String name, {String? description, String? unit, ObservableCallback<num>? callback}) APIObservableUpDownCounter<num>
Creates an APIObservableUpDownCounter instrument with the given name
override
createUpDownCounter(String name, {String? description, String? unit}) APIUpDownCounter<num>
Creates a APIUpDownCounter instrument with the given name
override
getMeterProviders() List<APIMeterProvider>
return an array combining the global default tracer provider and any additional named trace providers added.
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
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.
override
meterProvider({required String endpoint, String serviceName = OTelAPI.defaultServiceName, String? serviceVersion = OTelAPI.defaultServiceVersion}) APIMeterProvider
Creates a APIMeterProvider
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reset() → void
Resets the factory to its initial state.
inherited
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.
override
spanContextFromParent(SpanContext parent) SpanContext
Creates a SpanContext from a parent span context
override
spanContextInvalid() SpanContext
Creates an invalid SpanContext as required by the specification
override
spanEvent(String name, [Attributes? attributes, DateTime? timestamp]) SpanEvent
Creates a SpanEvent with the given name and attributes and timestamp
override
spanEventNow(String name, [Attributes? attributes]) SpanEvent
Creates a SpanEvent with the given name and attributes and a timestamp generated during the call
override
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
override
spanIdInvalid([Uint8List? spanId]) SpanId
Creates an invalid SpanId
override
Creates a SpanLink with the given spanContext and attributes
override
toString() String
A string representation of this object.
inherited
traceFlags([int? flags]) TraceFlags
Creates a new TraceFlags with the options flags
override
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
override
traceIdInvalid() TraceId
Creates an invalid TraceId
override
tracerProvider({required String endpoint, String serviceName = OTelAPI.defaultServiceName, String? serviceVersion = OTelAPI.defaultServiceVersion}) APITracerProvider
Creates a APITracerProvider
override
traceState(Map<String, String>? entries) TraceState
Creates a new TraceState with the provided entries
override

Operators

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

Static Methods

attrsFromMap(Map<String, Object> namedMap) Attributes
Creates Attributes from a map of string keys to arbitrary values.