Skip to content

WIP: 0.5.0 — upgrade to Dartastic 1.1.0-beta.5 + release tooling - #18

Draft
michaelbushe wants to merge 1 commit into
mainfrom
feat/0.5.0-upgrade-and-tooling
Draft

WIP: 0.5.0 — upgrade to Dartastic 1.1.0-beta.5 + release tooling#18
michaelbushe wants to merge 1 commit into
mainfrom
feat/0.5.0-upgrade-and-tooling

Conversation

@michaelbushe

Copy link
Copy Markdown
Member

Summary

Comprehensive 0.5.0 upgrade pass. Three buckets:

  1. Bump to current Dartastic — SDK `1.1.0-beta.5-wip`, API `1.0.0-beta.6`. Picks up late-binding global proxies, web compatibility, OTLP/HTTP-JSON, beta.6 semconv rename.
  2. Release tooling — port `tool/release.dart` and `tool/update_coverage_badge.sh` from the SDK. Adopt the `-wip` flow.
  3. README + example overhaul — typed-enum shorthand, async pattern fix, new "Client OpenTelemetry" section.

Breaking changes (consumers will need to migrate)

Old New Note
`HttpResource.requestMethod` `Http.requestMethod` beta.6 semconv rename; ~25 enums affected
`UrlResource.urlFull` `Url.urlFull` same
`UserSemantics.userId` `User.userId` enum rename; field name preserved
`UserSemantics.userRole` `User.userRoles` rename and plural (list-of-string per OTel spec)
`SessionViewSemantics.viewName` `RumSessionView.viewName` split — OTel-spec session keys live on `Session`; Datadog/Dynatrace-style RUM keys on `RumSessionView`
`UITracer.recordSpan` / `recordSpanAsync` `startActiveSpan` / `startActiveSpanAsync` removed from SDK in 0.8.3; was redundant
`UITracer.startSpanWithContext` `tracer.startSpan(name, context: ctx)` + `withSpanAsync` removed in SDK 1.1.0-beta.5 (see SDK#48)
`class UILogger implements Logger` `implements OTelLogger` SDK renamed `Logger` → `OTelLogger` to avoid `package:logging` clash

Six `Resource` enums kept the suffix to avoid Dart/Flutter/library type conflicts: `ErrorResource`, `ExceptionResource`, `FileResource`, `ProcessResource`, `ServerResource`, `EventResource`. Full migration table in CHANGELOG.

What landed (highlights)

Code

  • `lib/flutterrific_opentelemetry.dart` — re-export `show` clauses updated for the rename. Added `export 'src/util/otel_config.dart'` so consumers no longer need a deep `lib/src` import for `OTelConfig`.
  • `UITracer` / `UITracerProvider` — `timeProvider` getter/setter added (required by SDK 1.1.0-beta.2's pluggable clock). `recordSpan` / `recordSpanAsync` / `startSpanWithContext` overrides removed.
  • `UILogger` / `UILoggerCreate` — implement `OTelLogger`.
  • 7 redundant API-package imports dropped (SDK re-exports them).

Release tooling (new)

  • `tool/release.dart` — ported from `dartastic_opentelemetry/tool/release.dart`, adapted for Flutter. Strips `-wip`, dates the CHANGELOG section, runs `flutter analyze` + `flutter test`, tags `vX.Y.Z`, bumps to next `-wip`, `dart pub publish`es from the tagged tree, pushes + creates a GitHub release via `gh release create`.
  • `tool/update_coverage_badge.sh` — reads `coverage/lcov.info` and rewrites the README badge in place.

Docs

  • `README.md` — coverage badge (honest about current ~19% line coverage; ROADMAP has the plan to `>=85%` for stable). Quick Start examples use `OTel.attributesFromSemanticMap({...})` + `withSpanAsync` for proper Zone-based context propagation across `await`. New "Client OpenTelemetry" section comparing Flutterrific's current event/attribute shapes against the in-development OTel client semantic conventions.
  • `PUBLICATION_CHECKLIST.md` — rewritten around the release-script flow. Cross-references the SDK checklist.
  • `ROADMAP.md` — new "Path to 1.0" section with concrete 3-release coverage plan (pure-Dart 80% in 0.5.x, observer widget tests in 0.6.x, integration tests against Grafana LGTM in 0.7.x) plus per-signal spec-alignment windows.
  • `CHANGELOG.md` — migrated to Keep-a-Changelog format with a fresh `## [0.5.0-wip]` section.

Example fix

  • `example/lib/main.dart` — `_simulateNetworkRequest` now wraps the awaited work in `tracer.withSpanAsync(span, () async { ... })` so the span is active during the `await` (nested instrumentation that reads `Context.current.span` will see this span as its parent).

Pubspec

  • `version: 0.5.0-wip` (adopting the `-wip` flow).
  • Workspace dep override on the local SDK for the in-flight beta.5 work. Comes out before tagging.

Test plan

  • `flutter analyze` clean
  • `flutter test` — 30/30 pass
  • `dart analyze tool/release.dart` clean
  • Manual smoke test against `example/` on Android / iOS / web
  • Coverage push toward 0.5.x's 80% target on pure-Dart units (separate PR — out of scope here)
  • Land after SDK#48 merges and a beta.5 ships; remove the workspace dep override at that point

Status: WIP / draft

Paired with `dartastic_opentelemetry#48` (the SDK-side `startSpanWithContext` removal). This PR can land independently as long as the dep override stays pointing at the SDK branch, but for an actual pub.dev publish, the SDK beta.5 has to be out first.

🤖 Generated with Claude Code

Comprehensive upgrade pass that brings Flutterrific up to the current
Dartastic SDK (`1.1.0-beta.5-wip`) and API (`1.0.0-beta.6`) and lands
the release tooling Flutterrific was missing.

## Dartastic SDK / API upgrade

pubspec: `dartastic_opentelemetry: ^1.0.1-alpha → ^1.1.0-beta.4` and
`dartastic_opentelemetry_api: ^1.0.0-alpha → ^1.0.0-beta.6`.
Workspace dep override on the local SDK for the in-flight beta.5 work.

Picks up:
  - Late-binding global proxies on `OTel.tracer()` / `OTel.tracerProvider()` /
    `OTel.loggerProvider()` / `OTel.logger()`. Module-load capture
    (e.g. `final _tracer = OTel.tracer();`) now survives a later
    `OTel.initialize`. This is the foundation `FlutterOTel`'s
    observers + tracker singletons already assume.
  - Web compatibility for the SDK's main library — no `dart:io`
    import-time crashes on Flutter web / dart2js / dart2wasm.
  - Sub-millisecond span timing on web via the platform-aware
    `WebTimeProvider` default.
  - OTLP/HTTP-JSON wire format on every signal.
  - Beta.6 semconv rename: `HttpResource` → `Http`, `UrlResource` →
    `Url`, `UserSemantics` → `User`, etc. Six enums kept the
    `Resource` suffix to avoid Dart/Flutter/library type conflicts:
    `ErrorResource`, `ExceptionResource`, `FileResource`,
    `ProcessResource`, `ServerResource`, `EventResource`.
    `SessionViewSemantics` split — OTel-spec `Session.id` /
    `Session.previousId` vs Datadog/Dynatrace-style `RumSessionView`.

## Code changes

  - `lib/flutterrific_opentelemetry.dart`: re-export `show` clauses
    updated for the beta.6 rename. Docstring documents the migration
    table. Added `Url` (missing in original). Added
    `export 'src/util/otel_config.dart'` so consumers don't need a
    deep `lib/src` import for `OTelConfig`.
  - `lib/src/flutterrific_otel.dart`: two `SessionViewSemantics.viewName`
    use sites migrated to `RumSessionView.viewName`.
  - `lib/src/logs/ui_logger.dart` + `ui_logger_create.dart`:
    `class UILogger implements Logger` → `implements OTelLogger`
    (SDK renamed `Logger` → `OTelLogger` to avoid clashing with
    `package:logging`'s `Logger`). Delegate field + constructor param
    retyped.
  - `lib/src/trace/ui_tracer.dart`: deleted `recordSpan` and
    `recordSpanAsync` overrides (removed from SDK in 0.8.3 as
    redundant with `startActiveSpan` / `startActiveSpanAsync`). Added
    `timeProvider` getter required by SDK 1.1.0-beta.2. Deleted
    `startSpanWithContext` override (matches the SDK 1.1.0-beta.5
    removal — see `MindfulSoftwareLLC/dartastic_opentelemetry#48`).
  - `lib/src/trace/ui_tracer_provider.dart`: added `timeProvider`
    getter+setter.
  - Dropped 7 now-redundant `package:dartastic_opentelemetry_api/...`
    imports (the SDK package re-exports everything those files used).

## Release tooling (new)

  - `tool/release.dart` — port of the SDK's release script. Adapted
    for Flutter (`flutter pub` / `flutter analyze` / `flutter test`).
    Same `-wip` flow: strip `-wip` from pubspec.yaml, date the
    CHANGELOG section, run analyze/tests, tag `vX.Y.Z`, bump to the
    next `-wip`, `dart pub publish` from the tagged tree, push +
    `gh release create`.
  - `tool/update_coverage_badge.sh` — reads `coverage/lcov.info` and
    rewrites the README badge line in place. Color-codes by
    threshold.

## CHANGELOG / PUBLICATION_CHECKLIST / README / ROADMAP

  - `CHANGELOG.md`: migrated to Keep-a-Changelog format with a fresh
    `## [0.5.0-wip]` section. Documents every breaking change above.
  - `PUBLICATION_CHECKLIST.md`: rewritten around the `dart run
    tool/release.dart` flow. Coverage gate explicit (>=85% for
    stable). Flutter-specific platform matrix kept.
  - `README.md`: coverage badge added (honest about current ~19%
    line coverage). Quick Start examples migrated to the typed-enum
    shorthand (`OTel.attributesFromSemanticMap({Http.requestMethod: ...})`)
    plus `withSpanAsync` for proper Zone-based context propagation
    across `await`. New ~70-line "Client OpenTelemetry" section
    comparing Flutterrific's current event/attribute shapes against
    the in-development OTel client semantic conventions
    (`device.app.lifecycle`, `app.screen.click`, `browser.web_vital`,
    `user_agent.original`).
  - `ROADMAP.md`: new "Path to 1.0" section with concrete 3-release
    coverage plan (pure-Dart 80% in 0.5.x, observer widget tests in
    0.6.x, integration tests against Grafana LGTM in 0.7.x), plus the
    client-OTel spec-alignment migration windows.

## Example async fix

  - `example/lib/main.dart`: `_simulateNetworkRequest` now wraps the
    awaited work in `tracer.withSpanAsync(span, () async { ... })` so
    the span is active for the duration of the `await` — nested
    instrumentation that reads `Context.current.span` sees this span
    as its parent. Prior shape recorded timing fine but left the span
    inactive during the awaited work.

## Pubspec

  - `version: 0.5.0-wip` (adopting the `-wip` flow).
  - Added `pub_semver` + `pubspec_parse` dev deps for the release
    script.

## Validation

  - `flutter analyze` clean (only an info-level lint on `pubspec.lock`
    age in some envs; no errors / warnings).
  - `flutter test` — **30/30 pass**.
  - `dart analyze tool/release.dart` clean.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@benjaben

Copy link
Copy Markdown

@michaelbushe the other PR #19 updates this project to the latest beta. If this is merged in first then the other PR should still work, but if the other is merged in first there will be some real conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants