otel_go_router 0.2.0
otel_go_router: ^0.2.0 copied to clipboard
OpenTelemetry instrumentation for `package:go_router`. A NavigatorObserver that emits a span per route transition with navigation.* attributes - the anchor for user-journey traces.
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.2.0 - 2026-08-10 #
Changed #
GoRouterSemanticsnow declares everynavigation.*key it emits locally — the upstreamNavigationSemanticsenum is not part of any publisheddartastic_opentelemetry_apirelease, so the package depends only on published API surface while keeping the emitted keys byte-identical to the intended semconv.- README: documented wiring per go_router's route API — observers
must also be attached to each
ShellRoute/StatefulShellBranchnavigator (a root-only observer is blind to in-shell navigation), andStatefulShellRoutebranch switches fire noNavigatorObserverat all (emit from thegoBranchcall site, or useotel_auto_routefor tab-aware observation). - README made vendor-neutral (no backend product names).
- Dependency floors raised to
dartastic_opentelemetry ^1.1.0-beta.12anddartastic_opentelemetry_api ^1.0.0-rc.1. The previous floors declared compatibility with API versions that predate the semconv enums this package uses and could not actually resolve-and-compile. repositoryURL corrected to the canonicalDartasticorg casing so pub.dev repository verification succeeds.
Added #
OTelGoRouterObserver— aNavigatorObserverthat emits one short span per navigation transition (didPush/didPop/didReplace/didRemove). Carries the package-localGoRouterSemanticsattribute keys (navigation.action,navigation.route.path,navigation.previous_route_path) plus anavigation.is_initial_routeflag for cold-start detection. Thesenavigation.*keys are SIG-proposal candidates, not registry semconv — see the enum's docs.- Targets
go_router: ^17.0.0. Works with any router that drives a FlutterNavigator— the observer is the standardNavigatorObserverAPI. spanNameBuilderconstructor option for callers using non-go_router routers that need URL-pattern substitution (with go_router,Route.settings.nameis already the matched pattern, so the default builder produces low-cardinality span names for free).recordArgumentsflag (off by default) for capturingRoute.settings.arguments.toString();argumentAttributeMaxLengthfor clipping.- 6 widget tests with an in-memory exporter covering initial-route push, subsequent push + previous_route_path, pop, go(), custom span name builder, and the clipped-arguments path.
- Runnable Flutter example (
example/) driving route transitions against any local OTLP-compatible backend.