Skip to content

Commit 0a3c284

Browse files
authored
Suggested edits for tracing tutorial (#11660)
* Make tech stack clearer earlier in text * Split long paragraph * Remove text that probably makes no sense if you are a first time user * Explain DSN in context of the screen a user is currently on * It is clearer in one sentence * Put instructions in corre t order * Move comment * Add new bullet point for importing instrument into server.js * Looks clearer as a diff * Depending on user preferences in their IDE, this might not be line 88, e.g. line length settings * Fix typo
1 parent 011830f commit 0a3c284

File tree

4 files changed

+19
-24
lines changed

4 files changed

+19
-24
lines changed

docs/product/sentry-basics/distributed-tracing/create-new-project.mdx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ sidebar_order: 2
44
description: "Learn how to create your Sentry projects, which will scope events to distinct pieces of your application landscape."
55
---
66

7-
This section walks you through how to create new projects in your Sentry account. You need to have a project set up in Sentry in order to capture errors and other events. In this walkthrough we'll be creating a frontend project in React as well as a separate backend project in Express/Node.
7+
In order to capture errors and other events, you need to have a project set up in Sentry. In this walkthrough we'll be creating a frontend project in React and a separate backend project in Express.
8+
89
Because you can create a Sentry _Project_ for each language or framework used in your application (for example, you might have separate projects for your API server and frontend client), a single application might have multiple projects associated with it. Once you've set up all the projects that correspond to different parts of your application in Sentry, you'll be able to scope events to a distinct application in your organization and assign responsibility to specific users and teams. For more information, see [best practices for creating projects](/organization/getting-started/#4-create-projects).
910

1011
## Create a Frontend Project
@@ -13,7 +14,7 @@ Follow the steps below to create a new Sentry project for a sample React applica
1314

1415
1. Log in to your [Sentry organization](https://sentry.io).
1516

16-
1. Select **Projects** from the left side navigation menu to display the list of all your projects.
17+
1. Select **Projects** from the left side navigation menu.
1718

1819
1. Click "Create Project" and configure it as appropriate for your application:
1920

@@ -26,11 +27,8 @@ Follow the steps below to create a new Sentry project for a sample React applica
2627
- **Name your project and assign it a team**: Name your project in the **Project name** field and assign a team by selecting one in the **Team** dropdown (or click **+** to create a new team).
2728

2829
- Click **Create Project**. This takes you to the quick Configure React SDK guide, which provides an overview of how to configure the SDK. This tutorial covers the SDK setup in more detail.
29-
30-
1. Copy the DSN key and keep it handy. Each project has a unique DSN (Data Source Name). The DSN tells the SDK where to send events, so events are associated with the right project. You'll need to paste the DSN key into your source code later so the errors generated in this tutorial go to your new project.
31-
32-
> You can also find a project's DSN anytime in **[Project] > Settings > Client Keys (DSN)**.
33-
30+
31+
- You'll notice that the Sentry React SDK setup code has come pre-populated with the project's unique DSN (Data Source Name). The DSN tells the SDK where to send events, so events are associated with the right project. You'll need to paste the DSN key into the SDK configuration code later in the tutorial. You can make a note of it now, or you can also find a project's DSN anytime in **[Project] > Settings > Client Keys (DSN)**
3432
1. Click **Take me to Issues** to go to your new project's **Issues** page.
3533

3634
### UI Walkthrough

docs/product/sentry-basics/distributed-tracing/generate-first-error.mdx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,15 @@ If you're using your own source code, skip this step. Instead, select your [plat
1616

1717
1. In the `tracing-tutorial-frontend` repo, open `src/App.js` and update the `onClick` handler by replacing the string passed to the `getProduct()` function from `nonfat-water` to `debug-sentry`.
1818

19-
```jsx {filename:App.js} {7}
19+
```jsx diff {filename:App.js} {7}
2020
<div className="btn-parent">
2121
<button className="btn" onClick={() => getProduct("clown-shoes")}>
2222
Clown Shoes
2323
</button>
2424
</div>
2525
<div className="btn-parent">
26-
<button className="btn" onClick={() => getProduct("debug-sentry")}>
26+
- <button className="btn" onClick={() => getProduct("nonfat-water")}>
27+
+ <button className="btn" onClick={() => getProduct("debug-sentry")}>
2728
Nonfat Water
2829
</button>
2930
</div>
@@ -41,9 +42,9 @@ app.get("/products/debug-sentry", (req, res) => {
4142

4243
1. Save the file.
4344

44-
1. Go back to the browser window and try clicking on the **Nonfat Water** button again, you will no longer see the expected product information. Instead, you'll see text saying something went wrong. If you look at line 88 of the `App.js` file in the `tracing-tutorial-frontend` repo, you'll see this is what the frontend displays when it's call to the backend doesn't return any data.
45+
1. Go back to the browser window and try clicking on the **Nonfat Water** button again, you will no longer see the expected product information. Instead, you'll see text saying something went wrong. If you look to the bottom of the `App.js` file in the `tracing-tutorial-frontend` repo, you'll see this is what the frontend displays when the call to the backend doesn't return any data.
4546

46-
1. Open the terminal window that's running the `tracing-tutorial-backend` server. Here, you'll see that a log letting you know that an error has occurred.
47+
1. Open the terminal window that's running the `tracing-tutorial-backend` server. Here, you'll see a log letting you know that an error has occurred.
4748

4849
```bash
4950
Sentry Error thrown!

docs/product/sentry-basics/distributed-tracing/index.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ sidebar_order: 1
44
description: "Follow this tutorial to set up Sentry error monitoring and distributed tracing for a sample fullstack JavaScript application. By the end, you'll be able to trigger an error and a trace and see it in Sentry.io"
55
---
66

7-
This step-by-step tutorial walks you through setting up Sentry in both a frontend and backend sample application. After completing this tutorial you'll be able to trace the source and impact of your issues across projects and platforms. As part of this tutorial, you will:
7+
This step-by-step tutorial walks you through setting up Sentry in both a frontend (React) and backend (Express) sample application. After completing this tutorial you'll be able to trace the source and impact of your issues across projects and platforms. As part of this tutorial, you will:
88

99
- Configure the Sentry SDK on a sample React and Node/Express app.
1010
- Trigger a sample front-end error that in turn triggers a sample back-end error.
1111
- Go to the [Traces](https://sentry.io/orgredirect/organizations/:orgslug/traces/) page in Sentry and see a detailed view of your entire trace.
1212

13-
This tutorial uses a [sample React application](https://github.com/getsentry/tracing-tutorial-frontend) on the frontend as well as a sample [Node/Express API](https://github.com/getsentry/tracing-tutorial-backend) on the backend. Some familiarity with JavaScript will help you follow along. If you'd prefer, you can also apply the same steps to your own project, assuming you're running React on the frontend and Node/Express on the backend.
13+
This tutorial uses a [sample React application](https://github.com/getsentry/tracing-tutorial-frontend) on the frontend as well as a sample [Express API](https://github.com/getsentry/tracing-tutorial-backend) on the backend. Some familiarity with JavaScript will help you follow along. If you'd prefer, you can also apply the same steps to your own project, assuming you're running React on the frontend and Express on the backend.
1414

1515
## Prerequisites
1616

docs/product/sentry-basics/distributed-tracing/initialize-sentry-sdk-backend.mdx

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,9 @@ The sample application is a basic backend application using Express and Node.
3232

3333
Sentry captures data by using a platform-specific SDK that you add to your application's runtime. To use the SDK, import and configure it in your source code. This demo project uses [Sentry's Node SDK](https://github.com/getsentry/sentry-javascript/tree/master/packages/node).
3434

35-
1. Install the Sentry Express SDK using NPM.
36-
37-
Make sure you're in the `tracing-tutorial-backend` project folder.
38-
{/* TODO: UPDATE NAME OF THIS REPO */}
35+
1. Navigate to the tracing-tutorial-backend` project folder and install the Sentry Express SDK using NPM.
3936

37+
{/* TODO: UPDATE NAME OF THIS REPO */}
4038

4139
```bash {tabTitle:npm}
4240
npm install --save @sentry/node @sentry/profiling-node
@@ -50,9 +48,7 @@ Sentry captures data by using a platform-specific SDK that you add to your appli
5048
pnpm add @sentry/node @sentry/profiling-node
5149
```
5250

53-
1. Import and initialize the SDK.
54-
55-
Create a file at the root level of your project and call it `instrument.js`
51+
1. Create a file at the root level of your project and call it `instrument.js`. Import and initialize the SDK using the following code:
5652

5753
```javascript {filename:instrument.js}
5854
const Sentry = require("@sentry/node");
@@ -64,8 +60,8 @@ Sentry captures data by using a platform-specific SDK that you add to your appli
6460
nodeProfilingIntegration(),
6561
],
6662
// Tracing
63+
// Capture 100% of the transactions
6764
tracesSampleRate: 1.0,
68-
// Capture 100% of the transactions
6965

7066
// Set sampling rate for profiling - this is relative to tracesSampleRate
7167
profilesSampleRate: 1.0,
@@ -87,11 +83,11 @@ Sentry captures data by using a platform-specific SDK that you add to your appli
8783

8884
1. Save the file.
8985

90-
The options set in `Sentry.init()` are called the SDK's configuration. The only required configuration option is the DSN. However, the SDK supports many other configuration options. Learn more in our [Configuration](/platforms/javascript/guides/react/configuration/) docs.
86+
The options set in `Sentry.init()` are called the SDK's configuration. The only required configuration option is the DSN. However, the SDK supports many other configuration options. Learn more in our [Configuration](/platforms/javascript/guides/react/configuration/) docs.
9187

92-
The configuration above enables Sentry's error monitoring feature, as well as its [Tracing](will add link later) and [Session Replay](/platforms/javascript/guides/react/session-replay) features.
88+
The configuration above enables Sentry's error monitoring feature, as well as its [Tracing](will add link later) and [Session Replay](/platforms/javascript/guides/react/session-replay) features.
9389

94-
Be sure to import `instrument.js` at the top of your `server.js` file. Then import `Sentry` and set up the error handler after all controllers and before any other middleware:
90+
1. Import `instrument.js` at the top of your `server.js` file. Then import `Sentry` and set up the error handler after all controllers and before any other middleware:
9591

9692
``` javascript {filename:server.js} {1-7, 26-36}
9793
// IMPORTANT: Make sure to import `instrument.js` at the top of your file.

0 commit comments

Comments
 (0)