-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Global Getting Started #2336
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
Global Getting Started #2336
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
ab0bf08
Update JS index page and JS includes
PeloWriter 51fba7f
Create common page for Getting Started
PeloWriter b7d94dd
Add Angular includes and remove Angular getting ststarted index page
PeloWriter 5851d76
Update src/platforms/common/usage/index.mdx
PeloWriter ee98e1d
fix: Dont error in GuideGrid when using a guide itself
dcramer d4632af
create test content, apply code review comments
PeloWriter 0d602ef
update angular includes
PeloWriter b5be374
merge with master
PeloWriter 9300fe3
move content into troubleshooting
PeloWriter 560580a
Update src/includes/getting-started-config/javascript.angular.mdx
PeloWriter bf5e9b2
fix heading
PeloWriter 857d112
Create tabs to allow selection of errors or errors and performance
PeloWriter b0173d3
Add sample rate configuration note
PeloWriter 5a4f573
update configuration of sample rate
PeloWriter ca38199
Remove tab idea as the design won't scale
PeloWriter 1bffcb5
fix: Angular verify
HazAT afa5a53
edits to clarify
PeloWriter 0fce367
merge with master
PeloWriter 9042cb4
edits to enable next step page display
PeloWriter 15ace52
edits from review
PeloWriter 0312f99
Update src/includes/getting-started-config/javascript.angular.mdx
PeloWriter 0a4021d
merge with master
PeloWriter File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<GuideGrid /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Using a framework? Take a look at our specific guides to get started. | ||
|
||
<GuideGrid platform="javascript" /> |
107 changes: 107 additions & 0 deletions
107
src/includes/getting-started-config/javascript.angular.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
This snippet includes automatic instrumentation to [monitor the performance](/platforms/javascript/performance/) of your application, which registers and configures the Tracing integration, including custom Angular routing instrumentation. | ||
|
||
**Note:** To reduce the volume of performance data captured, or disable it entirely, change `tracesSampleRate` to a value between 0 and 1 in production. | ||
|
||
```javascript | ||
import { enableProdMode } from "@angular/core"; | ||
import { platformBrowserDynamic } from "@angular/platform-browser-dynamic"; | ||
import * as Sentry from "@sentry/angular"; | ||
import { Integrations } from "@sentry/tracing"; | ||
import { AppModule } from "./app/app.module"; | ||
|
||
Sentry.init({ | ||
dsn: "___PUBLIC_DSN___" , | ||
integrations: [ | ||
new Integrations.BrowserTracing({ | ||
tracingOrigins: ["localhost", "https://yourserver.io/api"], | ||
routingInstrumentation: Sentry.routingInstrumentation, | ||
}), | ||
], | ||
tracesSampleRate: 1.0, // We recommend adjusting this in production | ||
}); | ||
|
||
|
||
platformBrowserDynamic() | ||
.bootstrapModule(AppModule) | ||
.then(success => console.log(`Bootstrap success`)) | ||
.catch(err => console.error(err)); | ||
``` | ||
|
||
You can also configure `@sentry/angular` to catch any Angular-specific exceptions reported through the [@angular/core/ErrorHandler](https://angular.io/api/core/ErrorHandler) provider. | ||
|
||
`@sentry/angular` exports a Trace Service, Directive, and Decorators that leverages the `@sentry/tracing`, Sentry's Tracing integration, to add Angular-related spans to transactions. The service itself tracks route changes and durations, where directive and decorators are tracking component initializations. | ||
|
||
### Automatically Send Errors with `ErrorHandler` | ||
|
||
`@sentry/angular` exports a function to instantiate an `ErrorHandler` provider that will automatically send JavaScript errors captured by the Angular's error handler. | ||
|
||
```javascript | ||
import { NgModule, ErrorHandler } from "@angular/core"; | ||
import * as Sentry from "@sentry/angular"; | ||
|
||
@NgModule({ | ||
// ... | ||
providers: [ | ||
{ | ||
provide: ErrorHandler, | ||
useValue: Sentry.createErrorHandler({ | ||
showDialog: true, | ||
}), | ||
}, | ||
], | ||
// ... | ||
}) | ||
export class AppModule {} | ||
``` | ||
|
||
You can configure the behavior of `createErrorHandler`. For more details see the `ErrorHandlerOptions` interface in [our repository](https://github.com/getsentry/sentry-javascript/blob/master/packages/angular/src/errorhandler.ts). | ||
|
||
### Register `TraceService` | ||
|
||
In Angular's DI system, register `TraceService` as a provider with a `Router` as its dependency: | ||
|
||
```javascript | ||
import { NgModule } from "@angular/core"; | ||
import { Router } from "@angular/router"; | ||
import * as Sentry from "@sentry/angular"; | ||
|
||
@NgModule({ | ||
// ... | ||
providers: [ | ||
{ | ||
provide: Sentry.TraceService, | ||
deps: [Router], | ||
}, | ||
], | ||
// ... | ||
}) | ||
export class AppModule {} | ||
``` | ||
Then, either require the `TraceService` from inside `AppModule` or use `APP_INITIALIZER` to force instantiate Tracing. | ||
```javascript | ||
@NgModule({ | ||
// ... | ||
}) | ||
export class AppModule { | ||
constructor(trace: Sentry.TraceService) {} | ||
} | ||
``` | ||
|
||
or | ||
|
||
```javascript | ||
import { APP_INITIALIZER } from "@angular/core"; | ||
@NgModule({ | ||
// ... | ||
providers: [ | ||
{ | ||
provide: APP_INITIALIZER, | ||
useFactory: () => () => {}, | ||
deps: [Sentry.TraceService], | ||
multi: true, | ||
}, | ||
], | ||
// ... | ||
}) | ||
export class AppModule {} | ||
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,22 @@ | ||
You should `init` the Sentry Browser SDK as soon as possible during your page load: | ||
This snippet: | ||
- Uses `process.env.npm_package_version` to configure the version of your application. Learn more about [releases](/product/releases/) and how they are used with [source maps](/platforms/javascript/sourcemaps/). | ||
- Instruments your SDK to [monitor the performance](/platforms/javascript/performance/) of browser applications. | ||
|
||
```javascript {tabTitle:ESM} | ||
import * as Sentry from "@sentry/browser"; | ||
<Note> | ||
<markdown> | ||
|
||
Sentry.init({ | ||
dsn: "___PUBLIC_DSN___", | ||
}); | ||
``` | ||
To reduce the volume of performance data captured, or disable it entirely, change `tracesSampleRate` to a value between 0 and 1 in production. | ||
|
||
</markdown> | ||
</Note> | ||
|
||
```javascript {tabTitle:CDN} | ||
```javascript {tabTitle: ESM} | ||
import * as Sentry from "@sentry/browser"; | ||
import { Integrations } from "@sentry/tracing"; | ||
Sentry.init({ | ||
dsn: "___PUBLIC_DSN___", | ||
release: "my-project-name@" + process.env.npm_package_version, // To set your release version | ||
integrations: [new Integrations.BrowserTracing()], | ||
tracesSampleRate: 1.0, // We recommend adjusting this in production | ||
}); | ||
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
```bash {tabTitle:npm} | ||
npm install --save @sentry/angular | ||
``` | ||
|
||
```bash {tabTitle:Yarn} | ||
yarn add @sentry/angular | ||
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,14 @@ | ||
Add the `@sentry/browser` dependency: | ||
|
||
```bash {tabTitle: ESM} | ||
# Using yarn | ||
$ yarn add @sentry/browser | ||
|
||
$ yarn add @sentry/browser @sentry/tracing | ||
# Using npm | ||
$ npm install @sentry/browser | ||
$ npm install --save @sentry/browser @sentry/tracing | ||
``` | ||
|
||
```html {tabTitle: CDN} | ||
<script | ||
src="https://browser.sentry-cdn.com/{{ packages.version('sentry.javascript.browser') }}/bundle.min.js" | ||
integrity="sha384-{{ packages.checksum('sentry.javascript.browser', 'bundle.min.js', 'sha384-base64') }}" | ||
crossorigin="anonymous" | ||
></script> | ||
``` | ||
<Note> | ||
<markdown> | ||
|
||
We also support alternate [installation methods](/platforms/javascript/install/). | ||
|
||
</markdown> | ||
</Note> |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,3 @@ | ||
One way to verify your setup is by intentionally causing an error that breaks your application. | ||
|
||
Calling an undefined function will throw an exception: | ||
|
||
```js | ||
```javascript | ||
myUndefinedFunction(); | ||
``` | ||
|
||
You can verify the function caused an error by checking your browser console. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
On this page, we get you up and running with Sentry's SDK, so that it will automatically report errors and exceptions in your application. | ||
|
||
<Note> | ||
<markdown> | ||
|
||
If you don't already have an account and Sentry project established, head over to [sentry.io](https://sentry.io/signup/), then return to this page. | ||
|
||
</markdown> | ||
</Note> | ||
|
||
<PlatformContent includePath="framework-list" /> | ||
|
||
## Install | ||
|
||
Sentry captures data by using an SDK within your application’s runtime: | ||
|
||
<PlatformContent includePath="getting-started-install" /> | ||
|
||
## Initialize | ||
|
||
`init` Sentry as soon as possible in your app. Once this is done, the Sentry SDK captures all unhandled exceptions. | ||
|
||
<PlatformContent includePath="getting-started-config" /> | ||
|
||
<Note><markdown> | ||
|
||
We'll automatically assign you a Data Source Name (DSN), which looks like a standard URL. It's required by Sentry and configures the protocol, public key, server address, and project identifier. If you forget it, view _Settings -> Projects -> Client Keys (DSN)_ in sentry.io. | ||
|
||
</markdown></Note> | ||
|
||
## Verify | ||
|
||
This snippet includes an intentional error, so you can test that everything is working as soon as you set it up: | ||
|
||
<PlatformContent includePath="getting-started-verify" /> | ||
|
||
To view and resolve the recorded error, log into [sentry.io](https://sentry.io) and open your project. Clicking on the error's title will open a page where you can see detailed information and mark it as resolved. | ||
|
||
<PageGrid header="Next Steps" nextSteps /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
--- | ||
title: Installation Methods | ||
sidebar_order: 1 | ||
description: "Review our alternate installation methods." | ||
--- | ||
|
||
<PageGrid /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
--- | ||
title: Integrations | ||
sidebar_order: 200 | ||
description: "Learn more about how integrations extend the functionality of our SDK to cover common libraries and environments automatically." | ||
--- | ||
|
||
<PageGrid /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
title: Angular | ||
categories: | ||
- browser | ||
redirect_from: | ||
- /clients/javascript/integrations/angular2/ | ||
- /clients/javascript/integrations/angularjs/ | ||
- /platforms/javascript/angular/ |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.