@sigil-dev/plugin-sentry 0.8.6 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +73 -8
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -1,15 +1,80 @@
|
|
|
1
|
-
# plugin-sentry
|
|
1
|
+
# @sigil-dev/plugin-sentry
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Integrates [Sentry](https://sentry.io) with Grimoire. Captures errors and fatal log entries, optionally captures warnings, and reports worker crashes with worker context attached.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
bun add @sigil-dev/plugin-sentry @sentry/bun
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { defineConfig } from "@sigil-dev/grimoire";
|
|
15
|
+
import { sentryPlugin } from "@sigil-dev/plugin-sentry";
|
|
16
|
+
|
|
17
|
+
export default defineConfig({
|
|
18
|
+
plugins: [
|
|
19
|
+
sentryPlugin({
|
|
20
|
+
dsn: process.env.SENTRY_DSN!,
|
|
21
|
+
}),
|
|
22
|
+
],
|
|
23
|
+
});
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Options
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
interface SentryPluginOptions {
|
|
30
|
+
/** Sentry DSN. Required. */
|
|
31
|
+
dsn: string;
|
|
32
|
+
/** Also capture warn-level log entries as Sentry messages. Default: false. */
|
|
33
|
+
captureWarns?: boolean;
|
|
34
|
+
/** Return false to suppress a log entry from being sent to Sentry. */
|
|
35
|
+
beforeSend?: (entry: LogEntry) => boolean;
|
|
36
|
+
/** Additional options passed directly to Sentry.init(). */
|
|
37
|
+
sentryOptions?: Record<string, unknown>;
|
|
38
|
+
}
|
|
7
39
|
```
|
|
8
40
|
|
|
9
|
-
|
|
41
|
+
## What gets captured
|
|
42
|
+
|
|
43
|
+
| Event | Sentry level | Notes |
|
|
44
|
+
|---|---|---|
|
|
45
|
+
| `log.error(...)` | `error` | Captures as exception with scope + worker tags. |
|
|
46
|
+
| `log.fatal(...)` | `fatal` | Same as error. |
|
|
47
|
+
| `log.warn(...)` | `warning` | Only if `captureWarns: true`. |
|
|
48
|
+
| Worker crash | `error` | Captured as message with worker name and mode tags. |
|
|
49
|
+
|
|
50
|
+
All captured events include request context (`url`, `method`) set via `Sentry.setContext` on each request.
|
|
51
|
+
|
|
52
|
+
## Filtering events
|
|
10
53
|
|
|
11
|
-
|
|
12
|
-
|
|
54
|
+
Use `beforeSend` to suppress specific entries:
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
sentryPlugin({
|
|
58
|
+
dsn: process.env.SENTRY_DSN!,
|
|
59
|
+
beforeSend(entry) {
|
|
60
|
+
// don't send expected 404s to Sentry
|
|
61
|
+
if (entry.message.includes("Not Found")) return false;
|
|
62
|
+
return true;
|
|
63
|
+
},
|
|
64
|
+
})
|
|
13
65
|
```
|
|
14
66
|
|
|
15
|
-
|
|
67
|
+
## Passing additional Sentry options
|
|
68
|
+
|
|
69
|
+
Any option accepted by `Sentry.init()` can be passed via `sentryOptions`:
|
|
70
|
+
|
|
71
|
+
```ts
|
|
72
|
+
sentryPlugin({
|
|
73
|
+
dsn: process.env.SENTRY_DSN!,
|
|
74
|
+
sentryOptions: {
|
|
75
|
+
environment: process.env.NODE_ENV,
|
|
76
|
+
release: process.env.GIT_SHA,
|
|
77
|
+
tracesSampleRate: 0.2,
|
|
78
|
+
},
|
|
79
|
+
})
|
|
80
|
+
```
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sigil-dev/plugin-sentry",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"description": "Sentry error tracking plugin for grimoire",
|
|
5
5
|
"type": "module",
|
|
6
|
+
"private": false,
|
|
6
7
|
"main": "./dist/index.js",
|
|
7
8
|
"types": "./dist/index.d.ts",
|
|
8
9
|
"exports": {
|
|
@@ -19,7 +20,7 @@
|
|
|
19
20
|
"typecheck": "tsc --noEmit"
|
|
20
21
|
},
|
|
21
22
|
"dependencies": {
|
|
22
|
-
"@sigil-dev/grimoire": "0.
|
|
23
|
+
"@sigil-dev/grimoire": "0.9.1",
|
|
23
24
|
"@sentry/bun": "^8.0.0"
|
|
24
25
|
},
|
|
25
26
|
"peerDependencies": {
|