otel_redux 0.2.0
otel_redux: ^0.2.0 copied to clipboard
OpenTelemetry instrumentation for `package:redux`. Provides a Middleware that emits a span per dispatched action.
otel_redux #
OpenTelemetry instrumentation for
package:redux. Plug a
middleware into your store and every dispatch shows up in your
trace.
import 'package:redux/redux.dart';
import 'package:otel_redux/otel_redux.dart';
final store = Store<AppState>(
appReducer,
initialState: AppState.initial(),
middleware: [otelReduxMiddleware<AppState>()],
);
store.dispatch(AddToCartAction(item: item));
// → span: `redux AddToCartAction`
Each dispatch opens an INTERNAL span with:
- name:
redux <action runtime type> state.system = reduxstate.operation = dispatchstate.action.name = <runtime type>
Spans inherit the surrounding active span as parent, so a
dispatch inside a Tracer.startActiveSpan('user_flow', ...)
nests naturally.
Suppression: runWithoutReduxInstrumentation and async variant.
License #
Apache 2.0