Skip to content

Commit e1f7980

Browse files
committed
address most PR comments
1 parent b00fd13 commit e1f7980

File tree

2 files changed

+49
-45
lines changed

2 files changed

+49
-45
lines changed

docs/product/dev-toolbar/index.mdx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,44 +9,44 @@ description: "Bring critical Sentry insights and tools directly into your web ap
99
[GitHub](https://github.com/getsentry/sentry-toolbar/issues) if you have any feedback or concerns.
1010
</Alert>
1111

12-
Developers spend a lot of time troubleshooting their web apps on local, staging, and production environments. The Sentry Dev Toolbar pulls data from [sentry.io](http://sentry.io) and surfaces relevant actionable issues to you when you have the most context for understanding it: as you browse your own site. The Dev Toolbar is a floating widget in your web app, offering meaningful Sentry insights for the specific page being viewed through three different **page-aware** panels: Issues, Feedback, and Feature Flags.
12+
Developers spend a lot of time troubleshooting their web apps on local, staging, and production environments. The Sentry Dev Toolbar pulls data from [sentry.io](http://sentry.io) and surfaces relevant, actionable issues to you when you have the most context for understanding it: as you browse your own site. The Dev Toolbar is a floating widget in your web app, offering meaningful Sentry insights for the specific page being viewed through three different **page-aware** panels: Issues, Feedback, and Feature Flags.
1313

1414
![Collapsed Dev Toolbar in context of a website](./img/toolbar-collapsed.png)
1515

1616
## Issues Panel
1717

18-
The issues panel shows you your highest priority frontend [issues](https://docs.sentry.io/product/issues/) for the page you are currently viewing. From the Dev Toolbar, you can quickly jump into specific issues in Sentry to get more detailed information and take action (for example, assign to a team member or mark as resolved). With the issues panel, you can browse the pages that are most important to your business and understand the top issues impacting your user base.
18+
The issues panel shows you your highest priority frontend [issues](https://docs.sentry.io/product/issues/) for the page you are currently viewing. From the Dev Toolbar, you can quickly jump into specific issues in Sentry to get more detailed information (e.g. Sentry project, issue title, and description, and when the issue was first and last seen) and take action (e.g. assign to a team member or mark as resolved). With the issues panel, you can browse the pages that are most important to your business and understand the top issues impacting your user base.
1919

2020
![Dev Toolbar with the Issues Panel open](./img/issues-panel.png)
2121

2222
## Feedback Panel
2323

24-
The feedback panel shows you the most recent user feedback messages for the page you are on, so you can more easily contextualize user feedback. The feedback can include misleading UX, broken links, typos, and so on, covering more bugs and suboptimal experiences than code-thrown errors. The feedback panel works by pulling feedback messages from [Sentry’s User Feedback Widget](https://docs.sentry.io/product/user-feedback/#user-feedback-widget).
24+
The feedback panel shows you the most recent user feedback messages for the page you are on, so you can more easily contextualize user feedback. The feedback often describes suboptimal experiences that are not strictly code-thrown errors, such as misleading UX, broken links, and typos. The feedback panel works by pulling feedback messages from [Sentry’s User Feedback Widget](https://docs.sentry.io/product/user-feedback/#user-feedback-widget). Just like with the Issues panel, clicking on a particular user feedback will take you to the full detailed User Feedback page within Sentry.
2525

2626
![Dev Toolbar with the Feedback Panel open](./img/feedback-panel.png)
2727

2828
## Feature Flags Panel
2929

30-
Feature flags are a powerful tool that allow you to control the visibility of features in your app, enabling you to ship, test, and experiment with confidence. The feature flag panel allows you to quickly view and override feature flags locally that your team has enabled for your web application. You can override any feature flag to be `true` or `false` for your browser session, so you can verify its behavior and observe the impact it might have on errors. Learn more about how to [configure the feature flag panel](/product/dev-toolbar/setup/#implement-feature-flag-adapter).
30+
Feature flags are a powerful tool that allow you to control the visibility of features in your app, enabling you to ship, test, and experiment with confidence. The feature flag panel allows you to quickly view and override feature flags locally. You can override any feature flag to be `true` or `false` for your browser session, so you can verify its behavior and observe the impact it might have on errors. Learn more about how to [configure the feature flag panel](/product/dev-toolbar/setup/#implement-feature-flag-adapter).
3131

32-
[Learn more](/product/explore/feature-flags/) about what data Sentry can track related to your feature flagging system.
32+
<Note>
33+
[Learn more](/product/explore/feature-flags/) about what data Sentry can track related to your feature flagging system.
34+
</Note>
3335

3436
![Dev Toolbar with the Feature Flags Panel open](./img/feature-flags-panel.png)
3537

3638
## Login Flow
3739

38-
After setting up the Dev Toolbar you’ll see a “Login to Sentry” button floating in the center of the page. Your team will need to click this button and login to Sentry before they can access any information from your Sentry organization.
40+
After setting up the Dev Toolbar you’ll see a “Login to Sentry” button floating in the center of the page. To access any information from your Sentry organization you have to click this button and login to sentry.
3941
![Dev Toolbar login button](./img/login-button.png)
4042

41-
After clicking the button, you should see a pop up for logging in to Sentry.
43+
After clicking the button, you will see a pop up for logging in to Sentry.
4244
![Sentry log in pop up](./img/login-popup.png)
4345

4446
If it's your first time setting up the Dev Toolbar, there will be a button with a link to Sentry's Dev Toolbar settings page to configure your domain.
4547
![Dev Toolbar configure domains button](./img/configure-domain.png)
4648

47-
You'll need to add your domain URL to Allowed Origins on Sentry's Dev Toolbar settings page.
49+
You'll need to add your domain URL to Allowed Origins in Sentry on the Settings > Project > Dev Toolbar page.
4850
![Sentry's Dev Toolbar Settings Page](./img/sentry-toolbar-settings.png)
4951

50-
Learn more about [deploying the toolbar to different environments](/product/dev-toolbar/setup/#deploying-to-production--dev-environments), and [conditionally inserting the toolbar script tag](/product/dev-toolbar/setup/#conditionally-inserting-script-tag).
51-
52-
### [Set Up](/product/dev-toolbar/setup)
52+
Learn more about setting up the toolbar, including configuring a feature flag provider and integrating the toolbar in different environments, on the next page.

docs/product/dev-toolbar/setup.mdx

Lines changed: 38 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,18 @@ description: "Get started with Sentry's Dev Toolbar, bringing critical Sentry in
1616
</Alert>
1717

1818
You need to complete two steps to get the toolbar rendered on the page:
19-
1. Add or dynamically inject `<script defer src="https://browser.sentry-cdn.com/sentry-toolbar/latest/toolbar.min.js"></script>` into your web app. This script uses the `defer` attribute so that it does not block document parsing. The script tag can be inserted at the bottom of the page so it doesn’t block other critical Javascript.
19+
1. Add or dynamically inject the following script into your web app:
20+
```html
21+
<script src="https://browser.sentry-cdn.com/sentry-toolbar/latest/toolbar.min.js"></script>
22+
```
23+
It is recommended that you add the script tag at the bottom of the page so it doesn’t block other critical JavaScript.
2024
2. Call `window.SentryToolbar.init(initConfig)` to set up a toolbar instance on each page where you want to see the Dev Toolbar.
2125
```html
2226
<html>
2327
<head>...</head>
2428
<body>
2529
26-
<script async src="https://browser.sentry-cdn.com/sentry-toolbar/latest/toolbar.min.js"></script>
30+
<script src="https://browser.sentry-cdn.com/sentry-toolbar/latest/toolbar.min.js"></script>
2731
<script>
2832
window.SentryToolbar.init({ … });
2933
</script>
@@ -35,7 +39,7 @@ You need to complete two steps to get the toolbar rendered on the page:
3539

3640
If you have called `SentryToolbar.init({...})` to render the toolbar, but now want to manually remove or unmount it from the page, you can call the cleanup function that is returned from `init()`. This will unmount all the injected HTML and CSS. Login credentials will not be removed, so you can re-insert the toolbar and still be authenticated.
3741
```html
38-
<script defer src="https://browser.sentry-cdn.com/sentry-toolbar/latest/toolbar.min.js"></script>
42+
<script src="https://browser.sentry-cdn.com/sentry-toolbar/latest/toolbar.min.js"></script>
3943
<script>
4044
const unmountToolbar = window.SentryToolbar.init({ … });
4145
@@ -44,13 +48,39 @@ If you have called `SentryToolbar.init({...})` to render the toolbar, but now wa
4448
</script>
4549
```
4650

51+
## Init Configuration Fields
52+
53+
The following fields can be passed into the `.init()` function.
54+
55+
At minimum, you should be calling `.init()` with these three fields:
56+
```javascript
57+
window.SentryToolbar.init({
58+
organizationSlug: 'acme',
59+
projectIdOrSlug: 'website',
60+
environment: 'production'
61+
});
62+
```
63+
64+
| Field Name | Type | Description | Default Value |
65+
| ----- | ----- | ----- | ----- |
66+
| `organizationSlug` | `string` | The organization that users should login to. For example \'acme\' | *Required Value* |
67+
| `projectIdOrSlug` | `string \| number` | The project for which this website/webapp is associated. | *Required Value* |
68+
| `environment (optional)` | `string \| string[] \| undefined` | The environment of this deployment. Used to narrow search results in the Toolbar UI. Set to `undefined` or `""` or `\[\]` if you want to see results from all environments. | `undefined` |
69+
| `placement (optional)` | `'right-edge' \| 'bottom-right-corner'` | Where to render the toolbar on the screen. | `'right-edge'` |
70+
| `theme (optional)` | `'system' \| 'dark' \| 'light'` | Whether to use dark or light mode. | `'system'` |
71+
| `featureFlags (optional)` | `FeatureFlagAdapter \| undefined` | See [Implement FeatureFlagAdapter](/product/dev-toolbar/setup//#implement-feature-flag-adapter) below | `undefined` |
72+
| `sentryOrigin (optional)` | `string \| undefined` | The origin where Sentry can be found. Used for loading the connection to Sentry, and generating links to the website. For example: `'https://acme.sentry.io'` | `'https://sentry.io'` |
73+
| `domId (optional)` | `string \| undefined` | The `id` given to the \<div\> that is created to contain the toolbar html. | `'sentry-toolbar'` |
74+
| `debug (optional)` | `string \| undefined` | A comma separated string of debug targets to enable. Example: `'logging,state'`. If the list contains 'all' or 'true' then all targets will be enabled. Valid targets: `'logging' 'login-success' 'settings' 'state'` | `undefined` |
75+
| `mountPoint (optional)` | `HTMLElement \| () => HTMLElement \| undefined` | Where to mount the toolbar in the DOM. | `document.body` |
76+
4777
## Implement Feature Flag Adapter
4878

49-
In order to integrate your Feature Flagging platform with the Dev Toolbar, you will need an Adapter that can read flag data from your provider, and also store and retrieve a list of overrides to apply to your local browser session.
79+
In order to integrate your Feature Flagging platform with the Dev Toolbar, you will need an adapter that can read flag data from your provider, and also store and retrieve a list of overrides to apply to your local browser session.
5080

5181
We plan to create adapters for OpenFeature and LaunchDarkly soon!
5282

53-
The interface you need to implement for an Adapter is:
83+
The adapter interface is:
5484
```javascript
5585
type FlagValue = boolean | string | number | undefined;
5686
type FlagMap = Record<string, FlagValue>;
@@ -80,39 +110,13 @@ interface FeatureFlagAdapter {
80110
* this specific flag.
81111
*/
82112
urlTemplate?: undefined | ((name: string) => string | URL | undefined);
83-
}
113+
}
84114
```
85115

86116
[MockFeatureFlagIntegration.tsx](https://github.com/getsentry/sentry-toolbar/blob/301c31d561a81e3fd8ffc9532aad3a60af685916/src/env/demo/MockFeatureFlagIntegration.tsx) is an example adapter to use as a reference.
87117

88-
## Init Configuration Fields
89-
90-
The following fields can be passed into the `.init()` function.
91-
92-
For example, a minimal configuration looks like:
93-
```javascript
94-
window.SentryToolbar.init({
95-
organizationSlug: ‘acme’,
96-
projectIdOrSlug: ‘website’,
97-
environment: ‘production’
98-
});
99-
```
100-
101-
| Field Name | Type | Description | Default Value |
102-
| ----- | ----- | ----- | ----- |
103-
| `organizationSlug` | `string` | The organization that users should login to. For example \'acme\' | *Required Value* |
104-
| `projectIdOrSlug` | `string \| number` | The project for which this website/webapp is associated. | *Required Value* |
105-
| `environment (optional)` | `string \| string[] \| undefined` | The environment of this deployment. Used to narrow search results in the Toolbar UI. Set to `undefined` or `""` or `\[\]` if you want to see results from all environments. | `undefined` |
106-
| `placement (optional)` | `'right-edge' \| 'bottom-right-corner'` | Where to render the toolbar on the screen. | `'right-edge'` |
107-
| `theme (optional)` | `'system' \| 'dark' \| 'light'` | Whether to use dark or light mode. | `'system'` |
108-
| `featureFlags (optional)` | `FeatureFlagAdapter \| undefined` | See [Implement FeatureFlagAdapter](/product/dev-toolbar/setup//#implement-feature-flag-adapter) above | `undefined` |
109-
| `sentryOrigin (optional)` | `string \| undefined` | The origin where Sentry can be found. Used for loading the connection to Sentry, and generating links to the website. For example: `'[https://acme.sentry.io]'` | `'https://sentry.io'` |
110-
| `domId (optional)` | `string \| undefined` | The `id` given to the \<div\> that is created to contain the toolbar html. | `'sentry-toolbar'` |
111-
| `debug (optional)` | `string \| undefined` | A comma separated string of debug targets to enable. Example: `'logging,state'`. If the list contains 'all' or 'true' then all targets will be enabled. Valid targets: `'logging' 'login-success' 'settings' 'state'` | `undefined` |
112-
| `mountPoint (optional)` | `HTMLElement \| () => HTMLElement \| undefined` | Where to mount the toolbar in the DOM. | `document.body` |
113-
114118

115-
## Deploying To Production & Dev Environments
119+
## Deploying To Dev, Staging, and Production Environments
116120
Since the Dev Toolbar is deployed onto specific pages, it's strongly recommended that you consider which environments the toolbar should apply to.
117121

118122
In dev and staging environments, you might want to *unconditionally* include the toolbar so that all developers and testers can use it and quickly go from the page they're looking at back to Sentry for further debugging.
@@ -140,5 +144,5 @@ If the toolbar `<script>` is accidentally included on your site, and `SentryTool
140144

141145
## Conditionally Inserting Script Tag
142146

143-
It's possible to dynamically insert the script tag inside a single-page app, prior to calling `SentryToolbar.init()`, so that it’s only visible to authorized users. See [`docs/conditional-script.md`](http://conditional-script.md) for example code. This will help reduce network traffic for your users because they do not have the credentials needed to login.
147+
It's possible to dynamically insert the script tag inside a single-page app, prior to calling `SentryToolbar.init()`, so that it’s only visible to authorized users. See [`docs/conditional-script.md`](https://github.com/getsentry/sentry-toolbar/blob/main/docs/conditional-script.md) for example code. This will help reduce network traffic for your users because they do not have the credentials needed to login.
144148
This example code will be eventually implemented as an NPM package, but for now it can be done manually.

0 commit comments

Comments
 (0)