otel_provider 0.1.0-beta.1
otel_provider: ^0.1.0-beta.1 copied to clipboard
OpenTelemetry instrumentation for `package:provider`. A mixin on `ChangeNotifier` that emits short spans on every notifyListeners / dispose. Works with any ChangeNotifier — provider just happens to be [...]
Changelog #
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
0.1.0-beta.1 - 2026-05-16 #
Added #
OTelChangeNotifierMixin—mixin on ChangeNotifierthat emits one short span on everynotifyListeners()(gated byhasListeners) and ondispose(). Each span carriesnotifier.name(the runtime type) andnotifier.event.ValueNotifier<T>integration: classes that mix the OTel mixin in AND overrideotelRecordValues => truealso getnotifier.value(clipped viaotelValueMaxLength) andnotifier.value.typeon eachnotifyspan. Off by default because notifier values often carry user data.ProviderSemantics— typed attribute-key enum implementingOTelSemantic, package-local because OTel has no upstream convention for ChangeNotifier yet.- Tracer is resolved lazily on first emit and cached, so the
mixin can be applied to a class regardless of when
OTel.initialize()runs. - Works with both
package:providerconsumers and any other ChangeNotifier-using code (Flutter foundation provides the notifier mechanism;provideris just the most common consumer). - 5 widget tests cover:
notifyListenerswith a listener emits notify span,notifyListenerswith no listeners short-circuits,disposeemits disposed span,ValueNotifierwithrecordValues: truecaptures clipped value + type,ValueNotifierwithoutrecordValuesrecords neither. - Flutter example app with
ChangeNotifierProvider+ValueNotifier-based message model;flutter run -d chromeand click around to see the timeline in Grafana. - Uses
DOTel.initializefrom the start to demonstrate the Pro SDK's one-character switch.