Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(dev-toolbar): Dev Toolbar Docs #12117

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

feat(dev-toolbar): Dev Toolbar Docs #12117

wants to merge 2 commits into from

Conversation

c298lee
Copy link
Member

@c298lee c298lee commented Dec 12, 2024

Product docs for the dev toolbar

Fixes #12097

Copy link

vercel bot commented Dec 12, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sentry-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 12, 2024 10:15pm
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
changelog ⬜️ Ignored (Inspect) Visit Preview Dec 12, 2024 10:15pm
develop-docs ⬜️ Ignored (Inspect) Visit Preview Dec 12, 2024 10:15pm

Copy link

codecov bot commented Dec 12, 2024

Bundle Report

Changes will increase total bundle size by 1.8kB (0.01%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
sentry-docs-server-cjs 10.35MB 1.81kB (0.02%) ⬆️
sentry-docs-client-array-push 9.27MB 6 bytes (-0.0%) ⬇️

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

super nit but looks like there's a bit of a black border on the images

@@ -0,0 +1,50 @@
---
title: Dev Toolbar
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
title: Dev Toolbar
title: Developer Toolbar

should we use the full name for the title?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we want to use Dev Toolbar I think cc @jas-kas

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we settled on Dev Toolbar moving forward

---
title: Dev Toolbar
sidebar_order: 120
description: "Bring critical Sentry insights and tools directly into your web app for easier troubleshooting with the Dev Toolbar."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
description: "Bring critical Sentry insights and tools directly into your web app for easier troubleshooting with the Dev Toolbar."
description: "Bring critical Sentry insights and tools directly into your web app for easier troubleshooting with the Developer Toolbar."

docs/product/dev-toolbar/index.mdx Outdated Show resolved Hide resolved
docs/product/dev-toolbar/index.mdx Outdated Show resolved Hide resolved
docs/product/dev-toolbar/setup.mdx Outdated Show resolved Hide resolved
docs/product/dev-toolbar/setup.mdx Outdated Show resolved Hide resolved
docs/product/dev-toolbar/setup.mdx Outdated Show resolved Hide resolved


## Deploying To Production & Dev Environments
Since the Dev Toolbar is deployed onto specific pages, it's strongly recommended that you consider which environments your app is deployed to should have the toolbar available.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Since the Dev Toolbar is deployed onto specific pages, it's strongly recommended that you consider which environments your app is deployed to should have the toolbar available.
Since the Dev Toolbar is deployed onto specific pages, it's strongly recommended that you consider which environments the toolbar should apply to.

the wording is a bit confusing, don't 100% love my suggestion though

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. I tried to come up with another wording but couldn't find anything better than what you suggested.

docs/product/dev-toolbar/setup.mdx Outdated Show resolved Hide resolved
| ----- | ----- | ----- | ----- |
| `organizationSlug` | `string` | The organization that users should login to. For example \`acme\` | *Required Value* |
| `projectIdOrSlug` | `string \| number` | The project for which this website/webapp is associated. | *Required Value* |
| `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` |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you fix all these magic-quotes that got brought in from gdrive?

inside code snippets we should use ' and " instead of ”” and ‘’

and all quote marks should be consistent, i like ' for js strings.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't escape the backticks in any of the fields here, we're talking about some code thing, the backticks are markdown to make it look like code.

Suggested change
| `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` |
| `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` |

| `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` |
| `placement (optional)` | `‘right-edge’ \| ‘bottom-right-corner’` | Where to render the toolbar on the screen. | `”right-edge”` |
| `theme (optional)` | `‘system’ \| ‘dark’ \| ‘light’` | Whether to use dark or light mode. | `”system”` |
| `featureFlags (optional)` | `FeatureFlagAdapter \| undefined` | See [Implement FeatureFlagAdapter](/product/dev-toolbar/setup//#implement-feature-flag-adapter) above | `undefined` |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did "Implement FeatureFlagAdapter" go above?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jasmin and I think that it makes more sense since you need to set up the feature flags adapter before you run the init (at least if you inject). Open to moving it back down if you have a differing opinion tho!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flip it back.

the way you're manually injecting it is a development thing, users won't do that in real life. and even if they did, they'd need to do it every time they opened a new browser window.

It's not a scenario that's in the docs, or that should happen often. We should organize the docs to someone can follow from steps 1 to N top to bottom. When a question pops up then it should be answered in the next section. Flag adaopters are optional, so should be lower down.

</Alert>

You need to complete two steps to get the toolbar rendered on the page:
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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.
1. Add or dynamically inject `<script 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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code feels long enough to just be a small snippet instead of inline.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So are you saying that toolbar.min.js uses defer so is that why you removed it from the script tag?

Copy link
Member

@ryan953 ryan953 Dec 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed defer because I think the following inline script could be messed up by that. Haven't tested defer or async attribute, so removed it for now.


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.
```html
<script defer src="https://browser.sentry-cdn.com/sentry-toolbar/latest/toolbar.min.js"></script>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<script defer src="https://browser.sentry-cdn.com/sentry-toolbar/latest/toolbar.min.js"></script>
<script src="https://browser.sentry-cdn.com/sentry-toolbar/latest/toolbar.min.js"></script>

<head>...</head>
<body>
<script async src="https://browser.sentry-cdn.com/sentry-toolbar/latest/toolbar.min.js"></script>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<script async src="https://browser.sentry-cdn.com/sentry-toolbar/latest/toolbar.min.js"></script>
<script src="https://browser.sentry-cdn.com/sentry-toolbar/latest/toolbar.min.js"></script>

* this specific flag.
*/
urlTemplate?: undefined | ((name: string) => string | URL | undefined);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}
}

| `placement (optional)` | `'right-edge' \| 'bottom-right-corner'` | Where to render the toolbar on the screen. | `"right-edge"` |
| `theme (optional)` | `'system' \| 'dark' \| 'light'` | Whether to use dark or light mode. | `"system"` |
| `featureFlags (optional)` | `FeatureFlagAdapter \| undefined` | See [Implement FeatureFlagAdapter](/product/dev-toolbar/setup//#implement-feature-flag-adapter) above | `undefined` |
| `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"` |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| `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"` |
| `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"` |

Comment on lines +95 to +97
organizationSlug: ‘acme’,
projectIdOrSlug: ‘website’,
environment: ‘production’
Copy link
Member

@ryan953 ryan953 Dec 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

more quotes

Suggested change
organizationSlug: acme,
projectIdOrSlug: website,
environment: production
organizationSlug: 'acme',
projectIdOrSlug: 'website',
environment: 'production'

if i spotted these we should check everything again to make sure none others are still hanging around.

If it's a code related thing, then we should use backticks or regular quotes, but contractions like that's or it's can use the magic quotes because it's english language.

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.
![Dev Toolbar configure domains button](./img/configure-domain.png)

You'll need to add your domain URL to Allowed Origins on Sentry's Dev Toolbar settings page.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
You'll need to add your domain URL to Allowed Origins on Sentry's Dev Toolbar settings page.
You'll need to add your domain URL to Allowed Origins on Sentry's Settings > Project > Dev Toolbar page.

something like that, i just want to mention that it's a Project specific settings page so people can find it. If it wasn't project specific i'd also suggest that we deep link to that page, but because it's project specific idk if we can make the link.

You'll need to add your domain URL to Allowed Origins on Sentry's Dev Toolbar settings page.
![Sentry's Dev Toolbar Settings Page](./img/sentry-toolbar-settings.png)

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).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These links go to the bottom sections of the next page, which seems weird. Why not the top?

It looks like this, there is is a link "Next: Set Up"
SCR-20241212-omak

I feel like, we should link people to the top of the next page, and use the sentence here as a teaser for what sections are on that page...

Suggested change
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).
Learn more about [setting up the toolbar](/project/-dev-toolbar/setup/) including configuring a feature flag provider and including the toolbar in different environments.

maybe with all the links... but def the first link to the top of the page.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have a reason to believe people don't click on "Next Set Up >>" and that's why we are adding the link to this sentence? I think we shouldn't have any link because then I would be wondering if the link in the sentence takes me to the same place as the button.

Suggested change
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).
Learn more about setting up the toolbar including configuring a feature flag provider and including the toolbar in different environments on the next page.

Copy link
Contributor

@drguthals drguthals left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left comments throughout

@@ -0,0 +1,50 @@
---
title: Dev Toolbar
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we settled on Dev Toolbar moving forward

[GitHub](https://github.com/getsentry/sentry-toolbar/issues) if you have any feedback or concerns.
</Alert>

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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.
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.


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.

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should zoom in a bit on this screenshot and call out the Dev Toolbar, it's very hidden.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say if possible this could even be a gif instead, so that the idea is to emphasize that it shouldn't get in the way of you browsing your site, but when you hover over it opens up (or is it when you click?)


## Issues Panel

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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.
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.

I don't know if the details I added are correct, but we should definitely be zooming into the issues panel and calling out what the information is in that image. I can't read a thing and on the Sentry one I actually don't know what all of the information is referring to.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also aren't mentioning here that just clicking on the Issue title will take you to your Issue in Sentry, I think that is important to call out here.


## Feedback Panel

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).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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).
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.

}
```

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels like it needs to be above the interface but I can't think of how I would word it.

Comment on lines +90 to +99
The following fields can be passed into the `.init()` function.

For example, a minimal configuration looks like:
```javascript
window.SentryToolbar.init({
organizationSlug: ‘acme’,
projectIdOrSlug: ‘website’,
environment: ‘production’
});
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The following fields can be passed into the `.init()` function.
For example, a minimal configuration looks like:
```javascript
window.SentryToolbar.init({
organizationSlug: ‘acme’,
projectIdOrSlug: ‘website’,
environment: ‘production’
});
```
At minimum, you should be calling `.init()` with these three fiels:
```javascript
window.SentryToolbar.init({
organizationSlug: ‘acme’,
projectIdOrSlug: ‘website’,
environment: ‘production’
});

And you can include any additional fields from this list:

| `mountPoint (optional)` | `HTMLElement \| () => HTMLElement \| undefined` | Where to mount the toolbar in the DOM. | `document.body` |


## Deploying To Production & Dev Environments
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## Deploying To Production & Dev Environments
## Deploying To Dev, Staging, and Production Environments



## Deploying To Production & Dev Environments
Since the Dev Toolbar is deployed onto specific pages, it's strongly recommended that you consider which environments your app is deployed to should have the toolbar available.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. I tried to come up with another wording but couldn't find anything better than what you suggested.


## Conditionally Inserting Script Tag

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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm assuming we just haven't made this page yet?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[DevToolbar] Create new docs pages for the Toolbar
5 participants