Transaction Name for Dart
Learn how to set or override the transaction name to capture the user and gain critical pieces of information that construct a unique identity in Sentry using the Dart SDK.
This page only applies to transaction mode. In stream mode, there's no separate transaction name — set the span name when you create it with Sentry.startSpan('name', ...). See Streamed Spans for details.
The current transaction name is used to group transactions in our Sentry Dashboards product, as well as annotate error events with their point of failure.
The transaction name can reference the current web app route, or the current task being executed. For example:
GET /api/{version}/users/UserListViewmyapp.tasks.renew_all_subscriptions
Ideally, the transaction name does not contain variable values such as user IDs but has rather low cardinality while still uniquely identifying a piece of code you care about.
A lot of our framework integrations already set a transaction name, though you can set one yourself.
To override the name of the currently running transaction:
import 'package:sentry/sentry.dart';
Sentry.configureScope((scope) { scope.transaction = 'UserListView'; });
import 'package:sentry/sentry.dart';
Sentry.configureScope((scope) { scope.transaction = 'UserListView'; });
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").