-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
feat(perf): Update onPostBuild step to generate performance on-boarding docs #4888
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
Changes from all commits
5473b1a
4339971
23aefa5
2b7ef92
aa9e5ff
3f064fb
cf172f4
25d77df
b150efe
d1cbe5f
206e6ad
4d28f3a
8a3dd75
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
name: JavaScript | ||
doc_link: https://docs.sentry.io/platforms/javascript/performance/ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure if this is correct. The enable tracing snippet on the performance page is slightly different. This identical snippet is found at: This applies to all of these files. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @imatwawana I plan to use the Although the content is slightly different here, I wanted to provide the complete setup instructions without assuming the user has installed any dependencies beforehand. |
||
support_level: production | ||
type: language | ||
--- | ||
|
||
#### Install | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a specific reason we're using heading level 4 here? Is there a reason it isn't level 2? This applies to all of these files. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @imatwawana This was intentional so that we have the "right" header sizing that fits well with the inserted checkboxes: |
||
|
||
Install our JavaScript browser SDK using either `yarn` or `npm`: | ||
|
||
```bash | ||
# Using yarn | ||
yarn add @sentry/browser @sentry/tracing | ||
|
||
# Using npm | ||
npm install --save @sentry/browser @sentry/tracing | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--- | ||
name: JavaScript | ||
doc_link: https://docs.sentry.io/platforms/javascript/performance/ | ||
support_level: production | ||
type: language | ||
--- | ||
|
||
#### Configure | ||
|
||
Configuration should happen as early as possible in your application's lifecycle. | ||
|
||
Once this is done, Sentry's JavaScript SDK captures all unhandled exceptions and transactions. | ||
|
||
```javascript | ||
import * as Sentry from "@sentry/browser"; | ||
import { BrowserTracing } from "@sentry/tracing"; | ||
|
||
Sentry.init({ | ||
dsn: "___PUBLIC_DSN___", | ||
integrations: [new BrowserTracing()], | ||
|
||
// Set tracesSampleRate to 1.0 to capture 100% | ||
// of transactions for performance monitoring. | ||
// We recommend adjusting this value in production | ||
tracesSampleRate: 1.0, | ||
}); | ||
``` | ||
|
||
We recommend adjusting the value of `tracesSampleRate` in production. Learn more about configuring sampling in our [full documentation](/platforms/javascript/configuration/sampling/). |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
name: JavaScript | ||
doc_link: https://docs.sentry.io/platforms/javascript/performance/ | ||
support_level: production | ||
type: language | ||
--- | ||
|
||
#### Verify | ||
|
||
Verify that performance monitoring is working correctly with our [automatic instrumentation](/platforms/javascript/performance/instrumentation/automatic-instrumentation/) by simply using your JavaScript application. | ||
|
||
You have the option to manually construct a transaction using [custom instrumentation](/platforms/javascript/performance/instrumentation/custom-instrumentation/): | ||
|
||
```javascript | ||
const transaction = Sentry.startTransaction({ name: "test-transaction" }); | ||
const span = transaction.startChild({ op: "functionX" }); // This function returns a Span | ||
// exampleFunctionCall(); | ||
span.finish(); // Remember that only finished spans will be sent with the transaction | ||
transaction.finish(); // Finishing the transaction will send it to Sentry | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
name: React | ||
doc_link: https://docs.sentry.io/platforms/javascript/guides/react/performance/ | ||
support_level: production | ||
type: framework | ||
--- | ||
|
||
#### Install | ||
|
||
Install our JavaScript browser SDK using either `yarn` or `npm`: | ||
|
||
```bash | ||
# Using yarn | ||
yarn add @sentry/react @sentry/tracing | ||
|
||
# Using npm | ||
npm install --save @sentry/react @sentry/tracing | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
name: React | ||
doc_link: https://docs.sentry.io/platforms/javascript/guides/react/performance/ | ||
support_level: production | ||
type: framework | ||
--- | ||
|
||
#### Configure | ||
|
||
Next, import and initialize the Sentry module as early as possible, before initializing React: | ||
|
||
```javascript | ||
import React from "react"; | ||
import ReactDOM from "react-dom"; | ||
import * as Sentry from "@sentry/react"; | ||
import { BrowserTracing } from "@sentry/tracing"; | ||
import App from "./App"; | ||
|
||
Sentry.init({ | ||
dsn: "___PUBLIC_DSN___", | ||
integrations: [new BrowserTracing()], | ||
|
||
// Set tracesSampleRate to 1.0 to capture 100% | ||
// of transactions for performance monitoring. | ||
// We recommend adjusting this value in production | ||
tracesSampleRate: 1.0, | ||
}); | ||
|
||
ReactDOM.render(<App />, document.getElementById("root")); | ||
|
||
// Can also use with React Concurrent Mode | ||
// ReactDOM.createRoot(document.getElementById('root')).render(<App />); | ||
``` | ||
|
||
We recommend adjusting the value of `tracesSampleRate` in production. Learn more about configuring sampling in our [full documentation](/platforms/javascript/guides/react/configuration/sampling/). |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--- | ||
name: React | ||
doc_link: https://docs.sentry.io/platforms/javascript/guides/react/performance/ | ||
support_level: production | ||
type: framework | ||
--- | ||
|
||
#### Verify | ||
|
||
Verify that performance monitoring is working correctly with our [automatic instrumentation](/platforms/javascript/guides/react/performance/instrumentation/automatic-instrumentation/) by simply using your React application. | ||
|
||
You have the option to manually construct a transaction using [custom instrumentation](/platforms/javascript/guides/react/performance/instrumentation/custom-instrumentation/): | ||
|
||
```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 | ||
``` | ||
|
||
In addition, `@sentry/react` exports a `withProfiler` higher order component that can be used to capture React-related spans for specific React components: | ||
|
||
```javascript | ||
import * as Sentry from "@sentry/react"; | ||
|
||
function App(props) { | ||
// ... | ||
|
||
return <div />; | ||
} | ||
|
||
export default Sentry.withProfiler(App); | ||
``` |
Uh oh!
There was an error while loading. Please reload this page.