@@ -17,23 +17,15 @@ Depending on what type of SDK you are creating, you'll have to include different
17
17
18
18
As a rule of thumb, we should follow these two ideas:
19
19
20
- a . Whenever possible, instrumentation should work without (or with as little as possible) user configuration. b .
21
- Instrumentation should follow common patterns for a specific platform. No config is always preferred, but if config is
22
- unavoidable, it should feel reasonable to users of the given framework.
20
+ 1 . Whenever possible, instrumentation should work without (or with as little as possible) user configuration.
21
+ 2 . Instrumentation should follow common patterns for a specific platform. No config is always preferred, but if config
22
+ is unavoidable, it should feel as native as possible to users of the given framework.
23
23
24
24
## 1. Browser SDKs
25
25
26
26
A purely browser SDK generally should cover the following things:
27
27
28
- ### 1a. Routing Instrumentation
29
-
30
- While we have a default ` browserTracingIntegration ` , this has no access to a router, and is thus only based on URLs. We
31
- should strive to provide a custom ` browserTracingIntegration ` for SDKs that can leverage the router & routing
32
- information.
33
-
34
- Ideally, this means that we can emit pageload & navigation spans with parametrized route names instead of full URLs.
35
-
36
- ### 1b. Error Capturing
28
+ ### 1a. Error Monitoring
37
29
38
30
We have global error handlers out of the box. However, in many frameworks there are ways for users to capture errors
39
31
too, which may lead to them not bubble up to our global handlers. Generally, the goal is that all errors are captured by
@@ -42,25 +34,36 @@ Sentry.
42
34
Either we should use some hook (e.g. ` app.on('error') ` ) to capture exceptions, or provide composables (e.g. an error
43
35
boundary component in React) that users can use in their app to ensure all errors are captured by Sentry.
44
36
45
- ### 1c. OPTIONAL: Component Tracking
37
+ ### 1b. Performance Monitoring
46
38
47
- Optionally, we may also track the duration of component renders and similar things. These are stretch goals, though, and do not need to
48
- be part of an MVP.
39
+ #### Routing Instrumentation
49
40
50
- ## 2. Server SDKs
41
+ At a minimum, each browser SDK should have ** Routing Instrumentation ** .
51
42
52
- A purely server SDK generally should cover the following things:
43
+ While we have a default ` browserTracingIntegration ` , this has no access to a router, and is thus only based on URLs. We
44
+ should strive to provide a custom ` browserTracingIntegration ` for SDKs that can leverage the router & routing
45
+ information.
53
46
54
- ### 2a. ` http.server ` spans with route information
47
+ Ideally, this means that we can emit pageload & navigation spans with parametrized route names instead of full URLs.
55
48
56
- Most SDKs that build on top of ` @sentry/node ` should automatically have basic ` http.server ` spans emitted for incoming requests by the
57
- ` httpIntegration ` . However, these spans do not contain any routing information (e.g. a ` http.route ` attribute). A server
58
- SDK should make sure to add route information to these spans.
49
+ Some of the following concepts may be relevant to your SDK:
59
50
60
- If there are things that should be captured in spans that are not covered by ` httpIntegration ` , we may need to write our
61
- own instrumentation to capture ` http.server ` spans.
51
+ - ** Redirects** : If possible, we want to skip redirects. This means that if a user navigates to ` / ` , and this redirects
52
+ the user internally to ` /dashboard ` , we only want to capture a single ` / ` navigation/pageload.
53
+ - ** Route Params** : Routes should be parametrized, which means that instead of ` /users/123 ` we want to capture
54
+ ` /users/:id ` or simmilar.
55
+ - ** Query Params** : Query params should generally be removed from the route.
56
+
57
+ #### Component Tracking
62
58
63
- ### 2b. Error Capturing
59
+ Additionally, depending on the framework we may also have ** Component Tracking** . We may track the duration of component
60
+ renders and similar things. These are stretch goals, though, and do not need to be part of an MVP.
61
+
62
+ ## 2. Server SDKs
63
+
64
+ A purely server SDK generally should cover the following things:
65
+
66
+ ### 2a. Error Monitoring
64
67
65
68
We have global error handlers out of the box. However, in many frameworks there are ways for users to capture errors
66
69
too, which may lead to them not bubble up to our global handlers. Generally, the goal is that all errors are captured by
@@ -69,16 +72,39 @@ Sentry.
69
72
Either we should use some hook (e.g. ` app.on('error') ` ) to capture exceptions, or provide composables (e.g.
70
73
` setupFastifyErrorHandler(app) ` ) that user can call.
71
74
72
- ### 2c. OPTIONAL: Middleware Tracking
75
+ ### 2b. Performance Monitoring
76
+
77
+ #### Routing Instrumentation
78
+
79
+ At a minimum, each Node SDK should have ** Routing Instrumentation** .
80
+
81
+ Most SDKs that build on top of ` @sentry/node ` should automatically have basic ` http.server ` spans emitted for incoming
82
+ requests by the ` httpIntegration ` . However, these spans do not contain any routing information (e.g. a ` http.route `
83
+ attribute). A server SDK should make sure to add route information to these spans.
84
+
85
+ If there are things that should be captured in spans that are not covered by ` httpIntegration ` , we may need to write our
86
+ own instrumentation to capture ` http.server ` spans.
73
87
74
- If possible, we may want to instrument middlewares, and create spans for them.
88
+ Some of the following concepts may be relevant to your SDK:
75
89
76
- ### 2d. OPTIONAL: Additional features
90
+ - ** Route Params** : Routes should be parametrized, which means that instead of ` /users/123 ` we want to capture
91
+ ` /users/:id ` or simmilar.
92
+ - ** Query Params** : Query params should generally be removed from the route.
93
+
94
+ #### Middleware Tracking
95
+
96
+ Additionally, Node SDKs may also ** Middleware Tracking** . If possible, we may want to instrument middlewares, and create
97
+ spans for them. These are stretch goals, though, and do not need to be part of an MVP.
98
+
99
+ ### 2c. OPTIONAL: Additional features
77
100
78
101
We may also want to instrument additional features, if applicable, including:
79
102
80
- - Crons
81
- - Cache module
103
+ - Automatic cron instrumentation
104
+ - [ Cache module] ( https://docs.sentry.io/product/insights/caches/ ) - See
105
+ [ Instrument Caches] ( https://docs.sentry.io/platforms/javascript/guides/connect/tracing/instrumentation/custom-instrumentation/caches-module/ )
106
+ - [ Queue module] ( https://docs.sentry.io/product/insights/queue-monitoring/ ) - See
107
+ [ Instrument Queues] ( https://docs.sentry.io/platforms/javascript/guides/connect/tracing/instrumentation/custom-instrumentation/queues-module/ )
82
108
83
109
## 3. Meta SDKs
84
110
@@ -102,3 +128,19 @@ errors & spans for things like:
102
128
103
129
When possible, we should auto-capture this. If not possible, we should provide utilities for users to do this
104
130
themselves.
131
+
132
+ ### 3c. Bundler Integration / Source Maps
133
+
134
+ When possible, Meta SDKs should integrate with the used bundler. For example, SvelteKit uses Vite, so we should
135
+ automatically set up ` @sentry/vite-plugin ` for the user. At a minimum, we want to enable source maps upload for the meta
136
+ SDK, but this may also include automated release creation and other bundler features.
137
+
138
+ We _ should not_ expose the bundler plugin config directly, because this means that we cannot bump the underlying bundler
139
+ plugin version in a major way (because the bundler plugin config becomes public API of the meta SDK). Instead, we should
140
+ provide an abstraction layer of options that we expose on top of that.
141
+
142
+ ### 3d. Alternate JS Runtimes
143
+
144
+ We generally want to support Node runtimes for the server. However, sometimes there may be alternate runtimes that may
145
+ be supported, e.g. Cloudflare Workers or Vercel Edge Functions. We generally do not need to support these in an MVP, but
146
+ may decide to support them later.
0 commit comments