Skip to content

Commit

Permalink
feat(js): Add js tracing without performance docs (#7421)
Browse files Browse the repository at this point in the history
Co-authored-by: Liza Mock <[email protected]>
  • Loading branch information
AbhiPrasad and lizokm authored Jul 17, 2023
1 parent f1f4b6b commit 2d224d9
Show file tree
Hide file tree
Showing 7 changed files with 102 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
If you're using the current version of our JavaScript SDK and have enabled the `BrowserTracing` integration, distributed tracing will work out of the box. To get around possible [Browser CORs](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) issues, define your `tracePropagationTargets`.

```js
Sentry.init({
dsn: "__DSN__",
integrations: [new Sentry.BrowserTracing()],
tracePropagationTargets: [
"https://myproject.org",
"https://.*.otherservice.org/.*",
],
});
```

If you're using version `7.57.x` or below, you'll need to have our <PlatformLink to="/performance/">performance monitoring feature enabled</PlatformLink> in order for distributed tracing to work.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
If you're using the current version of our Next.js SDK, distributed tracing will work out of the box for the client, server, and edge runtimes.

For client-side you might have to define `tracePropagationTargets` to get around possible [Browser CORs](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) issues.

```js
// sentry.client.config.js
Sentry.init({
dsn: "__DSN__",
integrations: [new Sentry.BrowserTracing()],
tracePropagationTargets: [
"https://myproject.org",
"https://.*.otherservice.org/.*",
],
});
```

If you're using version `7.57.x` or below, you'll need to have our <PlatformLink to="/performance/">performance monitoring feature enabled</PlatformLink> in order for distributed tracing to work.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
If you're using the current version of our Remix SDK, distributed tracing will work out of the box for the client and server. To get around possible [Browser CORs](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) issues, you should define `tracePropagationTargets` for client-side.

```tsx
// entry.client.tsx
Sentry.init({
dsn: "__DSN__",
integrations: [new Sentry.BrowserTracing()],
tracePropagationTargets: [
"https://myproject.org",
"https://.*.otherservice.org/.*",
],
});
```

If you're using version `7.57.x` or below, you'll need to have our <PlatformLink to="/performance/">performance monitoring feature enabled</PlatformLink> in order for distributed tracing to work.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
If you're using the current version of our SvelteKit SDK, distributed tracing will work out of the box for the client and server runtimes. To get around possible [Browser CORs](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) issues, you should define `tracePropagationTargets` for client-side.

```js
// hooks.client.js
Sentry.init({
dsn: "__DSN__",
integrations: [new BrowserTracing()],
tracePropagationTargets: [
"https://myproject.org",
"https://.*.otherservice.org/.*",
],
});
```

If you're using version `7.57.x` or below, you'll need to have our <PlatformLink to="/performance/">performance monitoring feature enabled</PlatformLink> for distributed tracing to work.
22 changes: 22 additions & 0 deletions src/platform-includes/distributed-tracing/how-to-use/node.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
If you're using version `7.58.0` or above of our Node SDK and have the HTTP integration set up, distributed tracing will work out of the box.

```js
Sentry.init({
dsn: "___PUBLIC_DSN___",
integrations: [new Sentry.Integrations.Http({ tracing: true })],
});
```

If you're using express or an express-compatible framework, you'll also need to use Sentry middleware:

```js
const app = express();

// RequestHandler creates a separate execution context, so that all
// transactions/spans/breadcrumbs/tags are isolated across requests
app.use(Sentry.Handlers.requestHandler());
// TracingHandler creates a trace for every incoming request
app.use(Sentry.Handlers.tracingHandler());
```

If you're using version `7.57.x` or below, you'll need to have our <PlatformLink to="/performance/">performance monitoring feature enabled</PlatformLink> in order for distributed tracing to work.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
```javascript
Sentry.init({
dsn: "___PUBLIC_DSN___",
integrations: [new Sentry.BrowserTracing()],
tracePropagationTargets: [
"https://myproject.org",
"https://.*.otherservice.org/.*",
],
});
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
```javascript
Sentry.init({
dsn: "___PUBLIC_DSN___",
tracePropagationTargets: [
"https://myproject.org",
"https://.*.otherservice.org/.*",
],
});
```

1 comment on commit 2d224d9

@vercel
Copy link

@vercel vercel bot commented on 2d224d9 Jul 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

sentry-docs – ./

sentry-docs-git-master.sentry.dev
docs.sentry.io
sentry-docs.sentry.dev

Please sign in to comment.