Skip to content

Commit 652b90c

Browse files
feat(toolbar): Add setup instructions for the Sentry Toolbar using the react hook useSentryToolbar (#12845)
* feat(toolbar): Add setup instructions for the Dev Toolbar using the react hook useSentryToolbar * deeplink directly to the FAQ entries * rename to Sentry Toolbar * grammar fixes from code review * add redirects for page path changes * more grammar * Apply suggestions from code review Co-authored-by: Michelle Zhang <56095982+michellewzhang@users.noreply.github.com> * more renames * create a sub-heading for react-hook options --------- Co-authored-by: Michelle Zhang <56095982+michellewzhang@users.noreply.github.com>
1 parent e4027c4 commit 652b90c

14 files changed

+207
-123
lines changed

docs/product/dev-toolbar/faq.mdx

Lines changed: 0 additions & 16 deletions
This file was deleted.

docs/product/dev-toolbar/index.mdx

Lines changed: 0 additions & 46 deletions
This file was deleted.

docs/product/sentry-toolbar/faq.mdx

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
---
2+
title: FAQ
3+
sidebar_order: 30
4+
description: "Frequently asked questions about the Sentry Toolbar."
5+
---
6+
7+
<Expandable permalink title="In what environments should I enable the Toolbar?">
8+
9+
Since the Sentry Toolbar will be visible to users within your app, it's important to consider which environments should render it.
10+
11+
If your web application requires authentication to access:
12+
- In development and staging, always initialize the Sentry Toolbar.
13+
- In production, conditionally initialize the Sentry Toolbar when an employee is logged in.
14+
15+
If you web application does not require authenticaion:
16+
- In development and staging environments, initialize the Toolbar at all times.
17+
- In production environments, do not initialize the Toolbar.
18+
19+
Initializing the Sentry Toolbar allows all developers and testers to quickly go from the page they're looking at, back to Sentry for further debugging.
20+
In production it can make it easier for developers to reproduce issues, but it should not be initialized for all users of the site -- only when an employee/engineer/etc visits.
21+
22+
Once you decide where and when you want the Toolbar to appear, you'll write those conditions into your codebase. The specific implementation is something you'll need to write based on how your app works and how your team is set up.
23+
24+
</Expandable>
25+
26+
<Expandable permalink title="How can I conditionally initialize the Toolbar?">
27+
28+
Implementing the specific conditions for initializing the Toolbar will vary from app to app and whichever framework or template library is in use.
29+
30+
For example, the conditions to show the Toolbar in development and staging might look like this, if written in JavaScript:
31+
32+
```html {tabTitle:CDN}
33+
<script>
34+
const env = process.env.ENVIRONMENT || 'development';
35+
const isDev = env === 'development' || env === 'staging';
36+
37+
if (isDev) {
38+
window.SentryToolbar.init({ ... });
39+
}
40+
</script>
41+
```
42+
```javascript {tabTitle:React}
43+
const env = process.env.ENVIRONMENT || 'development';
44+
const isDev = env === 'development' || env === 'staging';
45+
46+
useSentryToolbar({
47+
enabled: isDev,
48+
initProps: {
49+
...
50+
},
51+
})
52+
```
53+
54+
</Expandable>
55+
56+
<Expandable permalink title="Are there plans to include the Toolbar in the JavaScript SDK?">
57+
58+
The [Sentry Toolbar](https://github.com/getsentry/sentry-toolbar) and the [JavaScript SDK](https://github.com/getsentry/sentry-javascript) are distinct features that we intentionally keep separated.
59+
60+
Some of the differences between the two include:
61+
- The Toolbar is a UI product focused on making it easier to find and take action on existing data, while the SDK functions as infrastructure to collect and send data to the server.
62+
- The Toolbar has a different set of [dependencies](https://github.com/getsentry/sentry-toolbar/blob/main/package.json) and uses different browser APIs that the JavaScript SDK does not use. For example: the Toolbar will interact with things like cookies and local storage. By keeping these pieces of code separate, it's easier to audit the [SDK code on GitHub](https://github.com/getsentry/sentry-javascript) to verify that it is not persisting information inside end-users' browsers.
63+
- The setup and deploy instruction are very different. The SDK is best deployed on staging and production environments, and can be configured easily with environment variables. The Sentry Toolbar requires special considerations to deploy it into production, usually by creating a condition so that it's only included for members of your own Sentry organization.
64+
65+
</Expandable>
66+

0 commit comments

Comments
 (0)