Skip to content
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

feat(js): Add js tracing without performance docs #7421

Merged
merged 4 commits into from
Jul 17, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
If you use the current version of our JavaScript SDK, distributed tracing just works out of the box if you've enabled the `BrowserTracing` integration. You also should define `tracePropagationTargets` to get around possible [Browser CORs](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) issues.
AbhiPrasad marked this conversation as resolved.
Show resolved Hide resolved

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

If you however use version `7.57.x` or below, you need to have our <PlatformLink to="/performance/">performance monitoring feature enabled</PlatformLink> for distributed tracing to work.
AbhiPrasad marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
If you use the current version of our Next.js SDK, distributed tracing just works out of the box for the client, server and edge runtimes.
AbhiPrasad marked this conversation as resolved.
Show resolved Hide resolved

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 BrowserTracing()],
tracePropagationTargets: [
"https://myproject.org",
"https://.*.otherservice.org/.*",
],
});
```

If you however use version `7.57.x` or below, you need to have our <PlatformLink to="/performance/">performance monitoring feature enabled</PlatformLink> for distributed tracing to work.
AbhiPrasad marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
If you use the current version of our Remix SDK, distributed tracing just works out of the box for the client and server

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.

AbhiPrasad marked this conversation as resolved.
Show resolved Hide resolved
```tsx
// entry.client.tsx
Sentry.init({
dsn: "__DSN__",
integrations: [new BrowserTracing()],
tracePropagationTargets: [
"https://myproject.org",
"https://.*.otherservice.org/.*",
],
});
```

If you however use version `7.57.x` or below, you need to have our <PlatformLink to="/performance/">performance monitoring feature enabled</PlatformLink> for distributed tracing to work.
AbhiPrasad marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
If you use the current version of our SvelteKit SDK, distributed tracing just works out of the box for the client and server 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.
AbhiPrasad marked this conversation as resolved.
Show resolved Hide resolved

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

If you however use version `7.57.x` or below, you need to have our <PlatformLink to="/performance/">performance monitoring feature enabled</PlatformLink> for distributed tracing to work.
AbhiPrasad marked this conversation as resolved.
Show resolved Hide resolved
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 use the version `7.58.0` or above of our Node SDK, distributed tracing just works out of the box if you've set up the HTTP integration.
AbhiPrasad marked this conversation as resolved.
Show resolved Hide resolved

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

If you're using express or an express-compatible framework, you also need to use the Sentry middleware:
AbhiPrasad marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
If you're using express or an express-compatible framework, you also need to use the Sentry middleware:
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 however use version `7.57.x` or below, you need to have our <PlatformLink to="/performance/">performance monitoring feature enabled</PlatformLink> for distributed tracing to work.
AbhiPrasad marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
```javascript
Sentry.init({
dsn: "___PUBLIC_DSN___",
integrations: [new 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/.*",
],
});
```