Skip to content

feat(perf-docs): reorganize and regenerate screenshots #1782

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

Merged
merged 37 commits into from
Jun 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
519d6ec
replaced screenshots
Jun 23, 2020
69cdaa7
rename tabs
Jun 24, 2020
241e62b
cleaning up copy
Jun 24, 2020
58e33cb
update snapshot
Jun 24, 2020
527244f
updating metric terminology
Jun 24, 2020
00feff3
more links
Jun 24, 2020
17cc79d
fix broken link
Jun 24, 2020
af10e71
Merge branch 'master' into feat/perf-screenshots-navigation
dcramer Jun 24, 2020
9de7cc3
readded before navigation option
Jun 24, 2020
627baf9
summary cleanup
Jun 24, 2020
63f7952
Merge branch 'master' into feat/perf-screenshots-navigation
dcramer Jun 24, 2020
12581a8
added summary details
Jun 24, 2020
d363bbb
fix merge problem
Jun 24, 2020
5f3a2a6
cleaned up event detail docs
Jun 24, 2020
a4b555e
info alerts
Jun 24, 2020
c08bedc
fix event detail
Jun 24, 2020
f6efa1e
change sidebar title and remove weird merge
Jun 24, 2020
52a57aa
updating span detail section
Jun 24, 2020
e2497db
cleaned up language and punctuation in setup
Jun 25, 2020
d3dae76
updated language and punctuation in perf index
Jun 25, 2020
95fffdd
small edits to metrics
Jun 25, 2020
e29e731
fix snapshot
dashed Jun 25, 2020
4153562
updating formatting in js
Jun 25, 2020
68b3480
Merge branch 'feat/perf-screenshots-navigation' of github.com:getsent…
Jun 25, 2020
2707d5e
updated wording and headings in Node
Jun 25, 2020
08efded
updated python setup page
Jun 25, 2020
9cc4729
updated Vue page
Jun 25, 2020
bc46760
updated transaction summary page
Jun 25, 2020
7f0ed6a
updated discover queries page
Jun 25, 2020
f99429a
update query builder
Jun 25, 2020
c134741
updated event detail page
Jun 25, 2020
d10bd3e
changed headers in JS
Jun 25, 2020
c90b9a6
updated headers in Node
Jun 25, 2020
c0426ca
updated python headers
Jun 25, 2020
066959f
updated vue page
Jun 25, 2020
32df6a5
took test phrase out
Jun 25, 2020
b452bbc
removed unnecessary sent
Jun 25, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions __tests__/__snapshots__/documentation.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -276,12 +276,14 @@ Array [
"meta/ip-ranges/index.html",
"meta/soc2/index.html",
"meta/terms/index.html",
"performance/discover/index.html",
"performance/discover/query-builder/index.html",
"performance/distributed-tracing/index.html",
"performance/getting-started/index.html",
"performance/performance-homepage/index.html",
"performance/performance-metrics/index.html",
"performance-monitoring/discover-queries/index.html",
"performance-monitoring/discover-queries/query-builder/index.html",
"performance-monitoring/distributed-tracing/index.html",
"performance-monitoring/performance/event-detail/index.html",
"performance-monitoring/performance/index.html",
"performance-monitoring/performance/metrics/index.html",
"performance-monitoring/performance/transaction-summary/index.html",
"performance-monitoring/setup/index.html",
"platforms/android/index.html",
"platforms/android/migrate/index.html",
"platforms/cocoa/dsym/index.html",
Expand Down
Binary file modified src/_assets/img/discover/discover-facet-map.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/_assets/img/discover/discover-table-cell.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file removed src/_assets/img/performance/discover-span.png
Binary file not shown.
Binary file removed src/_assets/img/performance/perf-detail.png
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/_assets/img/performance/perf-homepage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/_assets/img/performance/perf-summary.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file removed src/_assets/img/performance/span-detail-view.png
Binary file not shown.
Binary file added src/_assets/img/performance/span-details.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
4 changes: 2 additions & 2 deletions src/_data/documentation_categories.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
- title: Enriching Error Data
slug: enriching-error-data

- title: Performance
slug: performance
- title: Performance Monitoring
slug: performance-monitoring

- title: Workflow and Integrations
slug: workflow
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ Select known parts of the schema using the following:
* `$logentry` matches the `logentry` attribute of an event.
* `$thread` matches a single thread instance in `{"threads": {"values": [...]}}`
* `$breadcrumb` matches a single breadcrumb in `{"breadcrumbs": {"values": [...]}}`
* `$span` matches a [trace span](/performance/distributed-tracing/#traces-transactions-and-spans)
* `$span` matches a [trace span](/performance-monitoring/distributed-tracing/#traces-transactions-and-spans)
* `$sdk` matches the SDK context in `{"sdk": ...}`

### Escaping Special Characters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Context includes additional diagnostic information attached to an event. By defa

## Predefined Data

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

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.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,6 @@ After you configure the variable in your SDK, the variable surfaces as a tag in

### Searching Request IDs in Sentry

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

[{% asset tracing/tracing_with_discover.png alt="Image of the request_id grouped with other tags." %}]({% asset tracing/tracing_with_discover.png @path %})
2 changes: 1 addition & 1 deletion src/collections/_documentation/guides/enrich-data/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ For instance, the Discover query below displays all the errors (total of 143 eve

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

For more information, see [Discover](/performance/discover/).
For more information, see [Discover](/performance-monitoring/discover-queries/).

### Issue Ownership

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
To get started with performance monitoring using Sentry's JavaScript SDK, first install the `@sentry/apm` package:

```bash
npm install --save @sentry/apm
```

Next, initialize the integration in your call to `Sentry.init`:

```jsx
import * as Sentry from '@sentry/browser';
import { Integrations as ApmIntegrations } from '@sentry/apm';
Sentry.init({
dsn: '"___PUBLIC_DSN___"',
release: 'my-project-name@' + process.env.npm_package_version,
integrations: [
new ApmIntegrations.Tracing(),
],
tracesSampleRate: 0.25, // must be present and non-zero
});
```

Performance data is transmitted using a new event type called "transactions," which you can learn about in [Distributed Tracing](/performance-monitoring/distributed-tracing/#traces-transactions-and-spans). **To capture transactions, you must install the performance package and configure your SDK to set the `tracesSampleRate` configuration to a nonzero value.** The example configuration above will transmit 25% of captured transactions.

Learn more about sampling in [Using Your SDK to Filter Events](/error-reporting/configuration/filtering/).

**JavaScript**

To access our tracing features, you will need to install our Tracing package `@sentry/apm`:

```bash
$ npm install @sentry/browser
$ npm install @sentry/apm
```

Alternatively, instead of npm packages, you can use our pre-built CDN bundle that combines both `@sentry/browser` and `@sentry/apm`:

```html
<script src="https://browser.sentry-cdn.com/{% sdk_version sentry.javascript.browser %}/bundle.apm.min.js" crossorigin="anonymous"></script>
```

**Automatic Instrumentation**

For `@sentry/browser`, we provide an integration called `Tracing` that does
automatic instrumentation creating `pageload` and `navigation` transactions
containing spans for XHR/fetch requests and Performance API entries such as
marks, measures, and resource timings.

The `Tracing` integration is specific to `@sentry/browser` and does not work
with `@sentry/node`.

The `Tracing` integration resides in the `@sentry/apm` package. You can add it to your `Sentry.init` call:

```javascript
import * as Sentry from '@sentry/browser';
import { Integrations as ApmIntegrations } from '@sentry/apm';

Sentry.init({
dsn: '___PUBLIC_DSN___',
integrations: [
new ApmIntegrations.Tracing(),
],
tracesSampleRate: 0.25,
});
```

*NOTE:* The `Tracing` integration is available under `Sentry.Integrations.Tracing` when using the CDN bundle.

To send traces, you will need to set the `tracesSampleRate` to a nonzero value. The configuration above will capture 25% of your transactions.

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.

For all possible options, see [TypeDocs](https://getsentry.github.io/sentry-javascript/interfaces/apm.tracingoptions.html).

**tracingOrigins Option**

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 to propagate the `sentry-trace` header to the backend services, which is required to link transactions together as part of a single trace.

*Example:*

- A frontend application is served from `example.com`
- A backend service is served from `api.example.com`
- The frontend application makes API calls to the backend
- Therefore, the option needs to be configured like this: `new ApmIntegrations.Tracing({tracingOrigins: ['api.example.com']})`
- Now outgoing XHR/fetch requests to `api.example.com` will get the `sentry-trace` header attached

*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 setup. If you do not whitelist the `sentry-trace` header, the request might be blocked.

**beforeNavigation Option**s

{% version_added 5.18.0 %}

For `pageload` and `navigation` transactions, the `Tracing` integration uses the browser's `window.location` API to generate a transaction name. To customize the name of the `pageload` and `navigation` transactions, you can supply a `beforeNavigation` option to the `Tracing` integration. This option allows you to pass in a function that takes in the location at the time of navigation and returns a new transaction name.

`beforeNavigation` is useful if you would like to leverage the routes from a custom routing library like `React Router` or if you want to reduce the cardinality of particular transactions.

```javascript
import * as Sentry from '@sentry/browser';
import { Integrations as ApmIntegrations } from '@sentry/apm';
Sentry.init({
dsn: '___PUBLIC_DSN___',
integrations: [
new ApmIntegrations.Tracing({
beforeNavigate: (location) => {
// The normalizeTransactionName function uses the given URL to
// generate a new transaction name.
return normalizeTransactionName(location.href);
},
}),
],
tracesSampleRate: 0.25,
});
```

**Manual Instrumentation**

To manually instrument certain regions of your code, you can create a transaction to capture them.
This is valid for both JavaScript Browser and Node and works independently of the `Tracing` integration.

```javascript
const transaction = Sentry.startTransaction({name: 'test-transaction'});
const span = transaction.startChild({op: 'functionX'}); // This function returns a Span
// functionCallX
span.finish(); // Remember that only finished spans will be sent with the transaction
transaction.finish(); // Finishing the transaction will send it to Sentry
```

Here is a different example. If you want to create a transaction for a user interaction on your page, you need to do the following:

```javascript
// Let's say this function is invoked when a user clicks on the checkout button of your shop
shopCheckout() {
// This will create a new Transaction for you
const transaction = Sentry.startTransaction('shopCheckout');

// Assume this function makes an xhr/fetch call
const result = validateShoppingCartOnServer();

const span = transaction.startChild({
data: {
result
},
op: 'task',
description: `processing shopping cart result`,
});
processAndValidateShoppingCart(result);
span.finish();

transaction.finish();
}
```

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.

**Adding Additional Spans to the Transaction**

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.

```javascript
function processItem(item, transaction) {
const span = transaction.startChild({
op: "http",
description: "GET /"
})

return new Promise((resolve, reject) => {
http.get(`/items/${item.id}`, (response) => {
response.on('data', () => {});
response.on('end', () => {
span.setTag("http.status_code", response.statusCode);
span.setData("http.foobarsessionid", getFoobarSessionid(response));
span.finish();
resolve(response);
});
});
});
}
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
To access our tracing features, you will need to install our Tracing integration.

**Node**

```bash
$ npm install @sentry/node
$ npm install @sentry/apm
```

**Sending Traces**

To send traces, set the `tracesSampleRate` to a nonzero value. The following configuration will capture 25% of all your transactions:

```javascript
const Sentry = require("@sentry/node");

// This is required since it patches functions on the hub
const Apm = require("@sentry/apm");

Sentry.init({
dsn: "___PUBLIC_DSN___",
tracesSampleRate: 0.25
});
```

**Automatic Instrumentation**

It’s possible to add tracing to all popular frameworks; however, we only provide pre-written handlers for Express.

```javascript
const Sentry = require("@sentry/node");
const Apm = require("@sentry/apm");
const express = require("express");
const app = express();

Sentry.init({
dsn: "___PUBLIC_DSN___",
integrations: [
// enable HTTP calls tracing
new Sentry.Integrations.Http({ tracing: true }),
// enable Express.js middleware tracing
new Apm.Integrations.Express({ app })
],
tracesSampleRate: 0.25
});

// RequestHandler creates a separate execution context using domains, so that every
// transaction/span/breadcrumb is attached to its own Hub instance
app.use(Sentry.Handlers.requestHandler());
// TracingHandler creates a trace for every incoming request
app.use(Sentry.Handlers.tracingHandler());

// the rest of your app

app.use(Sentry.Handlers.errorHandler());
app.listen(3000);
```

Spans are instrumented for the following operations within a transaction:

- HTTP requests made with `request`
- `get` calls using native `http` and `https` modules
- Middleware (Express.js only)

**Manual Instrumentation**

To manually instrument a specific region of your code, you can create a transaction to capture it.

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:

```javascript
app.use(function processItems(req, res, next) {
const item = getFromQueue();
const transaction = Sentry.startTransaction({
op: "task",
name: item.getTransaction()
})

// processItem may create more spans internally (see next examples)
processItem(item, transaction).then(() => {
transaction.finish();
next();
})
});
```
Loading