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: packages/gatsby/README.md
+26-6Lines changed: 26 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -40,7 +40,7 @@ To automatically capture the `release` value on Vercel you will need to register
40
40
41
41
## Sentry Performance
42
42
43
-
To enable Tracing support, supply either `tracesSampleRate` or `tracesSampler` to the options and make sure you have installed the `@sentry/tracing` package. This will also turn on the `BrowserTracing` integration for automatic instrumentation of the browser.
43
+
To enable tracing, supply either `tracesSampleRate` or `tracesSampler` to the options and make sure you have installed the `@sentry/tracing` package. This will also turn on the `BrowserTracing` integration for automatic instrumentation of pageloads and navigations.
44
44
45
45
```javascript
46
46
{
@@ -49,11 +49,31 @@ To enable Tracing support, supply either `tracesSampleRate` or `tracesSampler` t
49
49
{
50
50
resolve:"@sentry/gatsby",
51
51
options: {
52
-
dsn:process.env.SENTRY_DSN, // this is the default
52
+
dsn:process.env.SENTRY_DSN, // this is the default
53
+
54
+
// A rate of 1 means all traces will be sent, so it's good for testing.
55
+
// In production, you'll likely want to either choose a lower rate or use `tracesSampler` instead (see below).
56
+
tracesSampleRate:1,
53
57
54
-
// A rate of 1 means all traces will be sent, so it's good for testing.
55
-
// In production, you'll likely want to either choose a lower rate or use `tracesSampler` instead.
56
-
tracesSampleRate:1,
58
+
// Alternatively:
59
+
tracesSampler:sampleContext=> {
60
+
// Examine provided context data (along with anything in the global namespace) to decide the sample rate
61
+
// for this transaction.
62
+
// Can return 0 to drop the transaction entirely.
63
+
64
+
if ("...") {
65
+
return0.5// These are important - take a big sample
66
+
}
67
+
elseif ("...") {
68
+
return0.01// These are less important or happen much more frequently - only take 1% of them
69
+
}
70
+
elseif ("...") {
71
+
return0// These aren't something worth tracking - drop all transactions like this
72
+
}
73
+
else {
74
+
return0.1// Default sample rate
75
+
}
76
+
}
57
77
}
58
78
},
59
79
// ...
@@ -71,7 +91,7 @@ If you want to supply options to the `BrowserTracing` integration, use the `brow
71
91
resolve:"@sentry/gatsby",
72
92
options: {
73
93
dsn:process.env.SENTRY_DSN, // this is the default
74
-
tracesSampleRate:1, //this is just to test, you should lower this in production
94
+
tracesSampleRate:1, //or tracesSampler (see above)
0 commit comments