Docs

Flutter instrumentation and tracing

Screen transactions, Talaria.wrapHttpClient, and W3C traceparent from talaria_flutter into a Serverpod API.

talaria_flutterinstrumentationtracingspanshttp

Turn Tracing on in Project settings. Span APIs match the Dart SDK. Successful transactions follow the traces sample rate. Error transactions are always sent. HTTP uses W3C traceparent.

dart
await TalariaFlutter.init(TalariaOptions(
  dsn: 'https://ingest.newtalaria.com',
  apiKey: const String.fromEnvironment('TALARIA_API_KEY'),
  release: const String.fromEnvironment('APP_RELEASE'),
));

Screen transactions

TalariaNavigatorObserver and TalariaFlutter.setScreen start a short INTERNAL transaction and finish it on the next idle frame (10 second cap). Use them for page-load timing. Start your own transaction for a multi-step user action. A shell route does not stay open to parent later HTTP calls.

Application HTTP

dart
import 'package:http/http.dart' as http;

final httpClient = Talaria.wrapHttpClient(http.Client());

Do not wrap Talaria's ingest client. There is no talaria_dio package. Wrap Dio with a CLIENT span and traceparent injection yourself when you need it, and skip Talaria ingest URLs.

Manual spans

dart
final span = Talaria.startTransaction('checkout');
try {
  await submit();
  span.setStatus(SpanStatus.ok);
} catch (error, stackTrace) {
  span.markError(message: error.toString());
  await Talaria.captureException(error, stackTrace: stackTrace);
  rethrow;
} finally {
  span.finish();
}

Continue into Serverpod

When this app calls a Serverpod API that runs talaria_serverpod, outbound traceparent becomes the parent of the Relic SERVER span. The waterfall crosses the process boundary.

Error events from Flutter hooks attach traceId and spanId when a screen or HTTP span is in scope, so Issues can open the trace.

Flavors and dart-define

bash
flutter run \
  --dart-define=TALARIA_API_KEY=tal_live_… \
  --dart-define=APP_RELEASE=1.4.2+42

The API key decides the environment. Give each flavor its own key so those issues stay separate. Set release from the build number or commit SHA.