otel_command_it 0.2.0
otel_command_it: ^0.2.0 copied to clipboard
OpenTelemetry instrumentation for package:command_it (Thomas Burkhart's renamed flutter_command). Wraps each Command execution in a CLIENT-kind span with duration and failures.
Changelog #
0.2.0 - 2026-08-08 #
Changed #
- Semantic conventions aligned with the current OTel registry: spans
carry the registry
error.typekey on failures; command-specific keys (command.name,command.system,command.result) stay package-local because no registry convention for UI commands exists yet. No deprecated registry keys are emitted. - 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 #
Command.runTraced(param, spanName)— sync executor wrapped in a CLIENT-kind span. (Mirrorscommand_it9.x's renamedrunmethod; the oldexecuteis deprecated upstream.)Command.runAsyncTraced(param, spanName)— async executor wrapped in a span; awaits the future before closing.- Span shape:
command_it <name>withcommand.name,command.system=command_it,command.result=success/error. Errors geterror.type+recordException+Errorstatus, then rethrow. - Local
CommandItSemanticsenum (implementsOTelSemantic). - Zone-scoped suppression via
runWithoutCommandItInstrumentation()/Async(). - Six
flutter_testtests instrumenting realCommands and asserting span shape via the SDK'spackage:dartastic_opentelemetry/testing.dartsurface (no network).
Design notes #
command_itis the renamedflutter_command; the API is the same exceptexecute→runandexecuteWithFuture→runAsync. If you're on the legacy package, seeotel_flutter_command.- We instrument at the call site (extension methods on
Command) rather than via the package's global hooks for the same reasons documented inotel_flutter_command— the globalloggingHandlerfires only at end of execution (can't measure duration) and the per-commandresultsnotifier filters no-op updates by==(sync void commands emit no event at all). - The async-throw path needs either a local error handler or a
Command.globalExceptionHandlerregistered; otherwiserunAsyncrethrows synchronously and the future never completes. This is a property ofcommand_it9.x, not the wrapper.