otel_shared_preferences 0.1.0 copy "otel_shared_preferences: ^0.1.0" to clipboard
otel_shared_preferences: ^0.1.0 copied to clipboard

OpenTelemetry instrumentation for `package:shared_preferences`. Extension methods on SharedPreferences that wrap write/remove/clear calls with key-value-store spans.

otel_shared_preferences #

OpenTelemetry instrumentation for package:shared_preferences.

final prefs = await SharedPreferences.getInstance();
await prefs.tracedSetString('user.id', 'alice');
await prefs.tracedSetBool('darkMode', true);
await prefs.tracedRemove('temp');
await prefs.tracedClear();

Each call emits a CLIENT span:

  • name: shared_prefs setString user.id
  • storage.system = shared_preferences
  • storage.operation = setString
  • storage.key = user.id

Reads (getString, getInt, …) are synchronous and not wrapped — wrapping every read would generate a lot of low-value spans. Open an issue if you have a use case that needs read spans.

Suppression: runWithoutSharedPreferencesInstrumentationAsync.

License #

Apache 2.0

0
likes
160
points
66
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

OpenTelemetry instrumentation for `package:shared_preferences`. Extension methods on SharedPreferences that wrap write/remove/clear calls with key-value-store spans.

Homepage
Repository (GitHub)
View/report issues

License

Apache-2.0 (license)

Dependencies

dartastic_opentelemetry, dartastic_opentelemetry_api, flutter, shared_preferences

More

Packages that depend on otel_shared_preferences