Skip to content

Commit c008bac

Browse files
committed
feat(solidjs): Update README with routing instrumentation instructions
1 parent fd345cd commit c008bac

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

packages/solidjs/README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,44 @@
77
# Official Sentry SDK for SolidJS
88

99
This SDK is work in progress, and should not be used before officially released.
10+
11+
# Solid Router
12+
13+
The Solid Router instrumentation uses the Solid Router library to create navigation spans to ensure you collect
14+
meaningful performance data about the health of your page loads and associated requests.
15+
16+
Add `Sentry.solidRouterBrowserTracingIntegration` instead of the regular `Sentry.browserTracingIntegration` and provide
17+
the hooks it needs to enable performance tracing:
18+
19+
`useBeforeLeave` from `@solidjs/router`
20+
`useLocation` from `@solidjs/router`
21+
22+
Make sure `Sentry.solidRouterBrowserTracingIntegration` is initialized by your `Sentry.init` call, before you wrap
23+
`Router`. Otherwise, the routing instrumentation may not work properly.
24+
25+
Wrap `Router`, `MemoryRouter` or `HashRouter` from `@solidjs/router` using `Sentry.withSentryRouterRouting`. This
26+
creates a higher order component, which will enable Sentry to reach your router context.
27+
28+
```js
29+
import * as Sentry from '@sentry/solidjs';
30+
import { Route, Router, useBeforeLeave, useLocation } from '@solidjs/router';
31+
32+
Sentry.init({
33+
dsn: '__PUBLIC_DSN__',
34+
integrations: [Sentry.solidRouterBrowserTracingIntegration({ useBeforeLeave, useLocation })],
35+
tracesSampleRate: 1.0, // Capture 100% of the transactions
36+
debug: true,
37+
});
38+
39+
const SentryRouter = Sentry.withSentryRouterRouting(Router);
40+
41+
render(
42+
() => (
43+
<SentryRouter>
44+
<Route path="/" component={App} />
45+
...
46+
</SentryRouter>
47+
),
48+
document.getElementById('root'),
49+
);
50+
```

0 commit comments

Comments
 (0)