Skip to content

Commit 69cdaa7

Browse files
author
Dora Chan
committed
rename tabs
1 parent 519d6ec commit 69cdaa7

File tree

24 files changed

+594
-624
lines changed

24 files changed

+594
-624
lines changed

__tests__/__snapshots__/documentation.js.snap

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -278,12 +278,12 @@ Array [
278278
"meta/ip-ranges/index.html",
279279
"meta/soc2/index.html",
280280
"meta/terms/index.html",
281-
"performance/discover/index.html",
282-
"performance/discover/query-builder/index.html",
283-
"performance/distributed-tracing/index.html",
284-
"performance/getting-started/index.html",
285-
"performance/performance-homepage/index.html",
286-
"performance/performance-metrics/index.html",
281+
"performance-monitoring/discover-queries/index.html",
282+
"performance-monitoring/discover-queries/query-builder/index.html",
283+
"performance-monitoring/distributed-tracing/index.html",
284+
"performance-monitoring/getting-started/index.html",
285+
"performance-monitoring/performance-homepage/index.html",
286+
"performance-monitoring/performance-metrics/index.html",
287287
"platforms/android/index.html",
288288
"platforms/android/migrate/index.html",
289289
"platforms/cocoa/dsym/index.html",

src/_data/documentation_categories.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
- title: Enriching Error Data
1010
slug: enriching-error-data
1111

12-
- title: Performance
13-
slug: performance
12+
- title: Performance Monitoring
13+
slug: performance-monitoring
1414

1515
- title: Workflow and Integrations
1616
slug: workflow

src/collections/_documentation/data-management/advanced-datascrubbing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ Select known parts of the schema using the following:
164164
* `$logentry` matches the `logentry` attribute of an event.
165165
* `$thread` matches a single thread instance in `{"threads": {"values": [...]}}`
166166
* `$breadcrumb` matches a single breadcrumb in `{"breadcrumbs": {"values": [...]}}`
167-
* `$span` matches a [trace span]({% link _documentation/performance/distributed-tracing.md %}#traces-transactions-and-spans)
167+
* `$span` matches a [trace span]({% link _documentation/performance-monitoring/distributed-tracing.md %}#traces-transactions-and-spans)
168168
* `$sdk` matches the SDK context in `{"sdk": ...}`
169169

170170
### Escaping Special Characters

src/collections/_documentation/enriching-error-data/additional-data.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Context includes additional diagnostic information attached to an event. By defa
2828

2929
## Predefined Data
3030

31-
The most common types of predefined data (where applicable) are level, [release]({%- link _documentation/workflow/releases/index.md -%}), [environment]({%- link _documentation/enriching-error-data/environments.md -%}), logger, [fingerprint]({%- link _documentation/data-management/event-grouping/index.md -%}), user, request, device, OS, runtime, app, browser, gpu, monitor, and [traces]({%- link _documentation/performance/distributed-tracing.md -%}).
31+
The most common types of predefined data (where applicable) are level, [release]({%- link _documentation/workflow/releases/index.md -%}), [environment]({%- link _documentation/enriching-error-data/environments.md -%}), logger, [fingerprint]({%- link _documentation/data-management/event-grouping/index.md -%}), user, request, device, OS, runtime, app, browser, gpu, monitor, and [traces]({%- link _documentation/performance-monitoring/distributed-tracing.md -%}).
3232

3333
To improve searchability, Sentry will turn the data or specific attributes on the data into tags. For example, `level` is available as a tag, and so is a user's email via the `user.email` tag. If Sentry is captures some predefined data but doesn't expose it as a tag, you can always set a [custom tag](#tags) for it.
3434

src/collections/_documentation/enriching-error-data/error-tracing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,6 @@ After you configure the variable in your SDK, the variable surfaces as a tag in
144144

145145
### Searching Request IDs in Sentry
146146

147-
If you also need several example cases to supplement a unique request ID, you can use Sentry's [Discover]({%- link _documentation/performance/discover/index.md -%}) functionality to search for all request ids you've seen on a specific URL.
147+
If you also need several example cases to supplement a unique request ID, you can use Sentry's [Discover]({%- link _documentation/performance-monitoring/discover-queries/index.md -%}) functionality to search for all request ids you've seen on a specific URL.
148148

149149
[{% asset tracing/tracing_with_discover.png alt="Image of the request_id grouped with other tags." %}]({% asset tracing/tracing_with_discover.png @path %})

src/collections/_documentation/guides/enrich-data/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ For instance, the Discover query below displays all the errors (total of 143 eve
6565

6666
![Discover Query]({% asset guides/enrich-data/004.png @path %})
6767

68-
For more information, see [Discover]({%- link _documentation/performance/discover/index.md -%}).
68+
For more information, see [Discover]({%- link _documentation/performance-monitoring/discover-queries/index.md -%}).
6969

7070
### Issue Ownership
7171

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
To get started with performance monitoring using Sentry's JavaScript SDK, first install the `@sentry/apm` package:
2+
3+
```bash
4+
npm install --save @sentry/apm
5+
```
6+
7+
Next, initialize the integration in your call to `Sentry.init`:
8+
9+
```jsx
10+
import * as Sentry from '@sentry/browser';
11+
import { Integrations as ApmIntegrations } from '@sentry/apm';
12+
Sentry.init({
13+
dsn: '"___PUBLIC_DSN___"',
14+
release: 'my-project-name@' + process.env.npm_package_version,
15+
integrations: [
16+
new ApmIntegrations.Tracing(),
17+
],
18+
tracesSampleRate: 0.25, // must be present and non-zero
19+
});
20+
```
21+
22+
Performance data is transmitted using a new event type called "transactions", which you can learn about in [Distributing Tracing]({%- link _documentation/performance-monitoring/distributed-tracing.md %}#traces-transactions-and-spans). **To sample transactions, you must set the `tracesSampleRate` configuration to a nonzero value.** The example configuration above will transmit 25% of captured transactions.
23+
24+
Learn more about sampling in [Using Your SDK to Filter Events]({%- link _documentation/error-reporting/configuration/filtering.md %}).
25+
26+
### JavaScript
27+
28+
To access our tracing features, you will need to install our Tracing package `@sentry/apm`:
29+
30+
```bash
31+
$ npm install @sentry/browser
32+
$ npm install @sentry/apm
33+
```
34+
35+
Alternatively, instead of npm packages, you can use our pre-built CDN bundle that combines both `@sentry/browser` and `@sentry/apm`:
36+
37+
```html
38+
<script src="https://browser.sentry-cdn.com/{% sdk_version sentry.javascript.browser %}/bundle.apm.min.js" crossorigin="anonymous"></script>
39+
```
40+
41+
#### Automatic Instrumentation
42+
43+
For `@sentry/browser`, we provide an integration called `Tracing` that does
44+
automatic instrumentation creating `pageload` and `navigation` transactions
45+
containing spans for XHR/fetch requests and Performance API entries such as
46+
marks, measures and resource timings.
47+
48+
The `Tracing` integration is specific to `@sentry/browser` and does not work
49+
with `@sentry/node`.
50+
51+
The `Tracing` integration resides in the `@sentry/apm` package. You can add it to your `Sentry.init` call:
52+
53+
```javascript
54+
import * as Sentry from '@sentry/browser';
55+
import { Integrations as ApmIntegrations } from '@sentry/apm';
56+
57+
Sentry.init({
58+
dsn: '___PUBLIC_DSN___',
59+
integrations: [
60+
new ApmIntegrations.Tracing(),
61+
],
62+
tracesSampleRate: 0.25,
63+
});
64+
```
65+
66+
*NOTE:* The `Tracing` integration is available then under `Sentry.Integrations.Tracing` when using the CDN bundle.
67+
68+
To send traces, you will need to set the `tracesSampleRate` to a nonzero value. The configuration above will capture 25% of your transactions.
69+
70+
You can pass many different options to the `Tracing` integration (as an object of the form `{optionName: value}`), but it comes with reasonable defaults out of the box.
71+
72+
For all possible options see [TypeDocs](https://getsentry.github.io/sentry-javascript/interfaces/apm.tracingoptions.html)
73+
74+
*tracingOrigins Option*
75+
76+
The default value of `tracingOrigins` is `['localhost', /^\//]`. The JavaScript SDK will attach the `sentry-trace` header to all outgoing XHR/fetch requests whose destination contains a string in the list or matches a regex in the list. If your frontend is making requests to a different domain, you will need to add it there in order to propagate the `sentry-trace` header to the backend services, which is required to link transactions together as part of a single trace.
77+
78+
*Example:*
79+
80+
- A frontend application is served from `example.com`
81+
- A backend service is served from `api.example.com`
82+
- The frontend application makes API calls to the backend
83+
- Therefore, the option needs to be configured like this: `new ApmIntegrations.Tracing({tracingOrigins: ['api.example.com']})`
84+
- Now outgoing XHR/fetch requests to `api.example.com` will get the `sentry-trace` header attached
85+
86+
*NOTE:* You need to make sure your web server CORS is configured to allow the `sentry-trace` header. The configuration might look like `"Access-Control-Allow-Headers: sentry-trace"`, but this depends a lot on your set up. If you do not whitelist the `sentry-trace` header, the request might be blocked.
87+
88+
#### Manual Instrumentation
89+
90+
To manually instrument certain regions of your code, you can create a transaction to capture them.
91+
This is valid for both JavaScript Browser and Node and works independent of the `Tracing` integration.
92+
93+
```javascript
94+
const transaction = Sentry.startTransaction({name: 'test-transaction'});
95+
const span = transaction.startChild({op: 'functionX'}); // This function returns a Span
96+
// functionCallX
97+
span.finish(); // Remember that only finished spans will be sent with the transaction
98+
transaction.finish(); // Finishing the transaction will send it to Sentry
99+
```
100+
101+
Here is a different example. If you want to create a transaction for a user interaction on you page, you need to do the following:
102+
103+
```javascript
104+
// Let's say this function is invoked when a user clicks on the checkout button of your shop
105+
shopCheckout() {
106+
// This will create a new Transaction for you
107+
const transaction = Sentry.startTransaction('shopCheckout');
108+
109+
// Assume this function makes an xhr/fetch call
110+
const result = validateShoppingCartOnServer();
111+
112+
const span = transaction.startChild({
113+
data: {
114+
result
115+
},
116+
op: 'task',
117+
description: `processing shopping cart result`,
118+
});
119+
processAndValidateShoppingCart(result);
120+
span.finish();
121+
122+
transaction.finish();
123+
}
124+
```
125+
126+
This example will send a transaction `shopCheckout` to Sentry, the transaction will contain a `task` span that measures how long `processAndValidateShoppingCart` took. Finally, the call to `transaction.finish()` will finish the transaction and send it to Sentry.
127+
128+
#### Adding Additional Spans to the Transaction
129+
130+
The next example contains the implementation of the hypothetical `processItem ` function called from the code snippet in the previous section. Our SDK can determine if there is currently an open transaction and add to it all newly created spans as child operations. Keep in mind that each individual span needs to be manually finished; otherwise, that span will not show up in the transaction.
131+
132+
```javascript
133+
function processItem(item, transaction) {
134+
const span = transaction.startChild({
135+
op: "http",
136+
description: "GET /"
137+
})
138+
139+
return new Promise((resolve, reject) => {
140+
http.get(`/items/${item.id}`, (response) => {
141+
response.on('data', () => {});
142+
response.on('end', () => {
143+
span.setTag("http.status_code", response.statusCode);
144+
span.setData("http.foobarsessionid", getFoobarSessionid(response));
145+
span.finish();
146+
resolve(response);
147+
});
148+
});
149+
});
150+
}
151+
```
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
### Node.js
2+
3+
To access our tracing features, you will need to install our Tracing integration:
4+
5+
```bash
6+
$ npm install @sentry/node
7+
$ npm install @sentry/apm
8+
```
9+
10+
#### Sending Traces
11+
12+
To send traces, set the `tracesSampleRate` to a nonzero value. The following configuration will capture 25% of all your transactions:
13+
14+
```javascript
15+
const Sentry = require("@sentry/node");
16+
17+
// This is required since it patches functions on the hub
18+
const Apm = require("@sentry/apm");
19+
20+
Sentry.init({
21+
dsn: "___PUBLIC_DSN___",
22+
tracesSampleRate: 0.25
23+
});
24+
```
25+
26+
#### Automatic Instrumentation
27+
28+
It’s possible to add tracing to all popular frameworks; however, we provide pre-written handlers only for Express.
29+
30+
```javascript
31+
const Sentry = require("@sentry/node");
32+
const Apm = require("@sentry/apm");
33+
const express = require("express");
34+
const app = express();
35+
36+
Sentry.init({
37+
dsn: "___PUBLIC_DSN___",
38+
integrations: [
39+
// enable HTTP calls tracing
40+
new Sentry.Integrations.Http({ tracing: true }),
41+
// enable Express.js middleware tracing
42+
new Apm.Integrations.Express({ app })
43+
],
44+
tracesSampleRate: 0.25
45+
});
46+
47+
// RequestHandler creates a separate execution context using domains, so that every
48+
// transaction/span/breadcrumb is attached to its own Hub instance
49+
app.use(Sentry.Handlers.requestHandler());
50+
// TracingHandler creates a trace for every incoming request
51+
app.use(Sentry.Handlers.tracingHandler());
52+
53+
// the rest of your app
54+
55+
app.use(Sentry.Handlers.errorHandler());
56+
app.listen(3000);
57+
```
58+
59+
Spans are instrumented for the following operations within a transaction:
60+
61+
- HTTP requests made with `request`
62+
- `get` calls using native `http` and `https` modules
63+
- Middleware (Express.js only)
64+
65+
#### Manual Transactions
66+
67+
To manually instrument a certain region of your code, you can create a transaction to capture it.
68+
69+
The following example creates a transaction for a part of the code that contains an expensive operation (for example, `processItem`), and sends the result to Sentry:
70+
71+
```javascript
72+
app.use(function processItems(req, res, next) {
73+
const item = getFromQueue();
74+
const transaction = Sentry.startTransaction({
75+
op: "task",
76+
name: item.getTransaction()
77+
})
78+
79+
// processItem may create more spans internally (see next examples)
80+
processItem(item, transaction).then(() => {
81+
transaction.finish();
82+
next();
83+
})
84+
});
85+
```
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
To get started with performance monitoring using Sentry's Python SDK, first install the `@sentry/apm` package:
2+
3+
```
4+
import sentry_sdk
5+
```
6+
7+
Next, initialize the integration in your call to `Sentry.init`:
8+
9+
```
10+
sentry_sdk.init(
11+
"___PUBLIC_DSN___",
12+
traces_sample_rate = 0.25
13+
)
14+
```
15+
16+
Performance data is transmitted using a new event type called "transactions", which you can learn about in [Distributing Tracing]({%- link _documentation/performance-monitoring/distributed-tracing.md %}#traces-transactions-and-spans). **To sample transactions, you must set the `tracesSampleRate` configuration to a nonzero value.** The example configuration above will transmit 25% of captured traces.
17+
18+
Learn more about sampling in [Using Your SDK to Filter Events]({%- link _documentation/error-reporting/configuration/filtering.md %}).
19+
20+
### Python
21+
22+
To send traces, set the `traces_sample_rate` to a nonzero value. The following configuration will capture 25% of your transactions:
23+
24+
```python
25+
import sentry_sdk
26+
27+
sentry_sdk.init(
28+
"___PUBLIC_DSN___",
29+
traces_sample_rate = 0.25
30+
)
31+
```
32+
33+
#### Automatic Instrumentation
34+
35+
Many integrations for popular frameworks automatically capture transactions. If you already have any of the following frameworks set up for Sentry error reporting, you will start to see traces immediately:
36+
37+
- All WSGI-based web frameworks (Django, Flask, Pyramid, Falcon, Bottle)
38+
- Celery
39+
- AIOHTTP web apps
40+
- Redis Queue (RQ)
41+
42+
Spans are instrumented for the following operations within a transaction:
43+
44+
- Database queries that use SQLAlchemy or the Django ORM
45+
- HTTP requests made with `requests` or the `stdlib`
46+
- Spawned subprocesses
47+
- Redis operations
48+
49+
If you want to enable all relevant transactions automatically, you can use this alternative configuration (currently in alpha):
50+
51+
```python
52+
import sentry_sdk
53+
54+
sentry_sdk.init(
55+
"___PUBLIC_DSN___",
56+
_experiments={"auto_enabling_integrations": True}
57+
)
58+
```
59+
60+
#### Manual Instrumentation
61+
62+
To manually instrument certain regions of your code, you can create a transaction to capture them.
63+
64+
The following example creates a transaction for a scope that contains an expensive operation (for example, `process_item`), and sends the result to Sentry:
65+
66+
```python
67+
import sentry_sdk
68+
69+
while True:
70+
item = get_from_queue()
71+
72+
with sentry_sdk.start_span(op="task", transaction=item.get_transaction()):
73+
# process_item may create more spans internally (see next examples)
74+
process_item(item)
75+
```
76+
77+
#### Adding More Spans to the Transaction
78+
79+
The next example contains the implementation of the hypothetical `process_item` function called from the code snippet in the previous section. Our SDK can determine if there is currently an open transaction and add all newly created spans as child operations to that transaction. Keep in mind that each individual span also needs to be manually finished; otherwise, spans will not show up in the transaction.
80+
81+
You can choose the value of `op` and `description`.
82+
83+
```python
84+
import sentry_sdk
85+
86+
def process_item(item):
87+
88+
# omitted code...
89+
with sentry_sdk.start_span(op="http", description="GET /") as span:
90+
response = my_custom_http_library.request("GET", "/")
91+
span.set_tag("http.status_code", response.status_code)
92+
span.set_data("http.foobarsessionid", get_foobar_sessionid())
93+
```

0 commit comments

Comments
 (0)