@molecule/api-error-tracking-sentry 1.0.0 → 1.0.2
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 +124 -0
- package/package.json +8 -7
package/README.md
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
3
|
+
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
|
+
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
|
+
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
+
Generated: 2026-08-04T01:48:09.917Z
|
|
7
|
+
-->
|
|
8
|
+
|
|
9
|
+
# @molecule/api-error-tracking-sentry
|
|
10
|
+
|
|
11
|
+
> **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
|
|
12
|
+
> It is written to be read by coding agents as much as by people, and is generated from this
|
|
13
|
+
> package's source — edit `src/index.ts` JSDoc, not this file.
|
|
14
|
+
|
|
15
|
+
Sentry error tracking provider for molecule.dev.
|
|
16
|
+
|
|
17
|
+
Reports exceptions and messages to Sentry via `@sentry/node`, mapping the
|
|
18
|
+
normalized `@molecule/api-error-tracking` context onto Sentry scopes
|
|
19
|
+
(tags/user/extra).
|
|
20
|
+
|
|
21
|
+
## Quick Start
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
import { setProvider, captureException } from '@molecule/api-error-tracking'
|
|
25
|
+
import { provider } from '@molecule/api-error-tracking-sentry'
|
|
26
|
+
|
|
27
|
+
// Bond at startup (e.g. in setupBonds())
|
|
28
|
+
setProvider(provider)
|
|
29
|
+
|
|
30
|
+
// Anywhere in the app — delivered to Sentry once SENTRY_DSN is set
|
|
31
|
+
captureException(new Error('boom'), { tags: { source: 'worker' } })
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Type
|
|
35
|
+
|
|
36
|
+
`provider`
|
|
37
|
+
|
|
38
|
+
## Installation
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
npm install @molecule/api-error-tracking-sentry @molecule/api-bond @molecule/api-error-tracking @molecule/api-secrets @sentry/node
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## API
|
|
45
|
+
|
|
46
|
+
### Constants
|
|
47
|
+
|
|
48
|
+
#### `provider`
|
|
49
|
+
|
|
50
|
+
Sentry error tracking provider. Lazily initialized from `SENTRY_DSN`;
|
|
51
|
+
every method is a documented no-op while the DSN is unset.
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
const provider: ErrorTrackingProvider
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
#### `sentrySecretDefinitions`
|
|
58
|
+
|
|
59
|
+
Secret definitions required by the Sentry error tracking bond.
|
|
60
|
+
|
|
61
|
+
```typescript
|
|
62
|
+
const sentrySecretDefinitions: SecretDefinition[]
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Core Interface
|
|
66
|
+
|
|
67
|
+
Implements `@molecule/api-error-tracking` interface.
|
|
68
|
+
|
|
69
|
+
## Bond Wiring
|
|
70
|
+
|
|
71
|
+
Setup function to register this provider with the core interface:
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
import { setProvider } from '@molecule/api-error-tracking'
|
|
75
|
+
import { provider } from '@molecule/api-error-tracking-sentry'
|
|
76
|
+
|
|
77
|
+
export function setupErrorTrackingSentry(): void {
|
|
78
|
+
setProvider(provider)
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Injection Notes
|
|
83
|
+
|
|
84
|
+
### Requirements
|
|
85
|
+
|
|
86
|
+
Peer dependencies:
|
|
87
|
+
|
|
88
|
+
- `@molecule/api-bond` ^1.0.1
|
|
89
|
+
- `@molecule/api-error-tracking` ^1.0.1
|
|
90
|
+
- `@molecule/api-secrets` ^1.0.1
|
|
91
|
+
|
|
92
|
+
### Environment Variables
|
|
93
|
+
|
|
94
|
+
- `SENTRY_DSN` _(required)_ — Sentry DSN
|
|
95
|
+
- Setup: Sentry → Settings → Projects → your project → Client Keys (DSN); copy the DSN. Until it is set the bond is a no-op (no events are sent).
|
|
96
|
+
- Get it here: [https://sentry.io/settings/projects/](https://sentry.io/settings/projects/)
|
|
97
|
+
- Example: `https://examplePublicKey@o0.ingest.sentry.io/0`
|
|
98
|
+
- `SENTRY_ENVIRONMENT` _(optional)_ — Sentry environment
|
|
99
|
+
- Setup: Environment tag applied to every event (e.g. production, staging); defaults to NODE_ENV when unset.
|
|
100
|
+
- Example: `production`
|
|
101
|
+
- `SENTRY_TRACES_SAMPLE_RATE` _(optional)_ — Sentry traces sample rate
|
|
102
|
+
- Setup: Fraction between 0 and 1 of transactions sampled for performance tracing (e.g. 0.1 = 10%); unset disables tracing.
|
|
103
|
+
- Example: `0.1`
|
|
104
|
+
|
|
105
|
+
### Runtime Dependencies
|
|
106
|
+
|
|
107
|
+
- `@molecule/api-bond`
|
|
108
|
+
- `@molecule/api-error-tracking`
|
|
109
|
+
- `@molecule/api-secrets`
|
|
110
|
+
- `@sentry/node`
|
|
111
|
+
|
|
112
|
+
- **Without `SENTRY_DSN` the provider is a documented no-op.** It never
|
|
113
|
+
throws or crashes an app that installed it but hasn't configured the
|
|
114
|
+
key — captures simply do nothing, and the boot-time config report flags
|
|
115
|
+
the missing `SENTRY_DSN` with setup instructions.
|
|
116
|
+
- The SDK is initialized lazily (once) on first use, from `SENTRY_DSN`,
|
|
117
|
+
optional `SENTRY_ENVIRONMENT` (defaults to `NODE_ENV`), and optional
|
|
118
|
+
`SENTRY_TRACES_SAMPLE_RATE` (0–1; unset disables tracing).
|
|
119
|
+
- **A returned event id does NOT confirm delivery.** The SDK buffers and
|
|
120
|
+
sends asynchronously; a capture can return an id and still never reach
|
|
121
|
+
Sentry (bad DSN, network egress blocked, process exited too soon). Call
|
|
122
|
+
`flush(timeoutMs)` before process exit — `false` means events may have
|
|
123
|
+
been dropped — and check the DSN/network before concluding the
|
|
124
|
+
integration is broken.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/api-error-tracking-sentry",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Sentry error tracking provider for molecule.dev.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
19
|
"files": [
|
|
20
|
-
"dist"
|
|
20
|
+
"dist",
|
|
21
|
+
"README.md"
|
|
21
22
|
],
|
|
22
23
|
"keywords": [
|
|
23
24
|
"molecule",
|
|
@@ -31,19 +32,19 @@
|
|
|
31
32
|
"devDependencies": {
|
|
32
33
|
"@types/node": "26.1.2",
|
|
33
34
|
"typescript": "6.0.3",
|
|
34
|
-
"vitest": "4.1.
|
|
35
|
+
"vitest": "4.1.11"
|
|
35
36
|
},
|
|
36
37
|
"peerDependencies": {
|
|
37
|
-
"@molecule/api-bond": "^1.0.
|
|
38
|
-
"@molecule/api-error-tracking": "^1.0.
|
|
39
|
-
"@molecule/api-secrets": "^1.0.
|
|
38
|
+
"@molecule/api-bond": "^1.0.1",
|
|
39
|
+
"@molecule/api-error-tracking": "^1.0.1",
|
|
40
|
+
"@molecule/api-secrets": "^1.0.1"
|
|
40
41
|
},
|
|
41
42
|
"repository": {
|
|
42
43
|
"type": "git",
|
|
43
44
|
"url": "https://github.com/molecule-dev/molecule.git",
|
|
44
45
|
"directory": "packages/api/bonds/error-tracking/sentry"
|
|
45
46
|
},
|
|
46
|
-
"homepage": "https://
|
|
47
|
+
"homepage": "https://www.molecule.dev/packages/api-error-tracking-sentry",
|
|
47
48
|
"bugs": "https://github.com/molecule-dev/molecule/issues",
|
|
48
49
|
"publishConfig": {
|
|
49
50
|
"access": "public"
|