otel_shared_preferences 0.1.0
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_preferencesstorage.operation = setStringstorage.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