You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/platforms/javascript/common/enriching-events/transaction-name/index.mdx
+6-9Lines changed: 6 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,8 +8,7 @@ notSupported:
8
8
- javascript.nextjs
9
9
---
10
10
11
-
The Sentry SDK sets a "transaction name" which is used to annotate error events with their point of failure.
12
-
Furthermore, if you use <PlatformLinkto="/tracing/">Tracing</PlatformLink>, Sentry refers to the root spans of your application as a "transaction" and groups traces based on the root span's "transaction" name.
11
+
The Sentry SDK uses an _error transaction name_ to mark where something went wrong in an error event. If you use <PlatformLinkto="/tracing/">Tracing</PlatformLink>, Sentry uses the name of your root span as the _root span transaction name_, which will group traces around that name.
13
12
14
13
This means that there are in fact two transaction names:
15
14
@@ -20,11 +19,11 @@ Both are used to annotate and group error and trace events respectively and are
20
19
21
20
<PlatformCategorySectionsupported={['browser']}>
22
21
23
-
You need to add `browserTracingIntegration` when initializing the SDK to automatically set a transaction name.
22
+
To automatically set transaction names, add `browserTracingIntegration` when initializing the SDK.
24
23
25
24
</PlatformCategorySection>
26
25
27
-
Because automatically-determined names are a good grouping mechanism, unless you have a special use-case, **you won't need to set or override transaction names manually.**
26
+
Because automatically-determined names are a good grouping mechanism, unless you have a special use-case, **you won't need to set or override transaction names manually.**
28
27
29
28
## What's a "Good" Transaction Name?
30
29
@@ -35,7 +34,7 @@ For example:
35
34
-`UserListView`
36
35
-`myapp.tasks.renew_all_subscriptions`
37
36
38
-
A good transaction name shouldn't have too many variables (such as user IDs), but should still be unique enough to help you easily identify the piece of code you care about.
37
+
A good transaction name shouldn't have too many variables (such as user IDs), but should still be unique enough to help you easily identify the piece of code you care about.
39
38
For example, instead of naming a transaction`'GET /api/users/123/details'`, name it `'GET /api/users/:id/details'`.
40
39
This will group all errors and traces for requests to the same route.
41
40
@@ -50,7 +49,7 @@ In a web app, you can set it when navigating to a new route, like in an SPA rout
50
49
51
50
## Setting the Error Transaction Name
52
51
53
-
There are several ways to set the transaction name for error events sent to Sentry.
52
+
There are several ways to set the transaction name for error events sent to Sentry. This name will show up as the location of the issue next to the issue title.
54
53
55
54
### Setting the Name on the Scope
56
55
@@ -117,15 +116,13 @@ Sentry.init({
117
116
```
118
117
119
118
<Note>
120
-
Only do this if you can't set the root span name earlier using other options.
119
+
Only do this if you can't set the root span name earlier using other options.
121
120
</Note>
122
121
123
122
## Further Information
124
123
125
-
126
124
You might wonder why there are two separate transaction names and why they're set independently. This is mainly due to Sentry's history and evolution. The error transaction name existed before Sentry offered tracing, and it was used solely to group error events. When tracing was introduced, the root span in a span tree was also called a "transaction," with its own name.
127
125
128
126
In later iterations, Sentry shifted focus in the UI from "transactions" to "spans" and "traces," but the older concepts remain in parts of the UI. The SDKs adapted their APIs, moving away from transaction-based designs. For example, the `setTransactionName` API on the `Scope` refers to error transaction names, not spans. Similarly, a span name doesn’t automatically apply to error events, keeping the two concepts [separate](https://github.com/getsentry/sentry-javascript/issues/10846).
129
127
130
-
131
128
As Sentry continues to evolve, the ambiguity between these terms is expected to decrease as the product moves away from associating "transactions" with tracing and spans.
0 commit comments