@openstatus/health-sentry 0.1.4-dev.0

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 ADDED
@@ -0,0 +1,68 @@
1
+ # @openstatus/health-sentry
2
+
3
+ [Sentry](https://sentry.io/) probe for
4
+ [`@openstatus/health`](https://jsr.io/@openstatus/health). Sends
5
+ `GET {baseUrl}/api/0/`, the root of the Sentry web API, and fails the check
6
+ unless it answers 2xx — with `fetch` alone, on every runtime, against
7
+ sentry.io or your own instance.
8
+
9
+ ```sh
10
+ deno add jsr:@openstatus/health jsr:@openstatus/health-sentry
11
+ npm install @openstatus/health @openstatus/health-sentry
12
+ ```
13
+
14
+ ```ts
15
+ import { createHealthHandler, readEnv } from "@openstatus/health";
16
+ import { sentryProbe } from "@openstatus/health-sentry";
17
+
18
+ Deno.serve(
19
+ createHealthHandler({
20
+ probes: [sentryProbe({ token: readEnv("SENTRY_AUTH_TOKEN") })],
21
+ }),
22
+ );
23
+ ```
24
+
25
+ The API root answers without credentials, so the probe works with no
26
+ configuration against `https://sentry.io`. Pass `token` — an organization or
27
+ user auth token — to also verify that the token is accepted, and `baseUrl` for
28
+ a regional host (`https://de.sentry.io`) or a self-hosted instance. Like every
29
+ probe here, this one never reads the environment itself — pass the values in,
30
+ and use `skip` for environments where Sentry is not configured.
31
+
32
+ This proves the API Sentry's dashboard and integrations use is reachable.
33
+ Event ingestion goes to a separate host (your DSN's `oXXX.ingest.sentry.io`),
34
+ and the SDK queues and drops events on its own when that is down — it never
35
+ blocks a request — so an ingestion outage is invisible to this probe by
36
+ design.
37
+
38
+ ```ts
39
+ sentryProbe({
40
+ token,
41
+ // optional overrides from the Probe contract
42
+ name: "errors",
43
+ critical: true,
44
+ timeoutMs: 2000,
45
+ skip: () => env.SENTRY_NOOP === "true",
46
+ });
47
+ ```
48
+
49
+ Non-critical by default: nothing in the request path depends on Sentry, so an
50
+ outage degrades the report instead of taking the service out of rotation.
51
+
52
+ ## About openstatus
53
+
54
+ [openstatus](https://www.openstatus.dev/) is the open-source uptime monitoring
55
+ and status page platform. This package is part of
56
+ [`@openstatus/health`](https://github.com/openstatusHQ/health), the `/health`
57
+ endpoints behind openstatus's own services, extracted so any JavaScript server
58
+ can expose one. Point an
59
+ [openstatus monitor](https://www.openstatus.dev/docs/reference/http-monitor)
60
+ at the endpoint and assert on `status` in the body to be alerted on
61
+ `degraded` before it becomes `unhealthy`.
62
+
63
+ Source: [github.com/openstatusHQ/health](https://github.com/openstatusHQ/health).
64
+ Issues and PRs welcome.
65
+
66
+ ## License
67
+
68
+ [MIT](https://github.com/openstatusHQ/health/blob/main/LICENSE)
@@ -0,0 +1,30 @@
1
+ //#region rolldown:runtime
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
+ key = keys[i];
11
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
+ get: ((k) => from[k]).bind(null, key),
13
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
+ });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
+ value: mod,
20
+ enumerable: true
21
+ }) : target, mod));
22
+
23
+ //#endregion
24
+
25
+ Object.defineProperty(exports, '__toESM', {
26
+ enumerable: true,
27
+ get: function () {
28
+ return __toESM;
29
+ }
30
+ });
package/dist/mod.cjs ADDED
@@ -0,0 +1,36 @@
1
+ const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
2
+ const __openstatus_health = require_rolldown_runtime.__toESM(require("@openstatus/health"));
3
+
4
+ //#region src/mod.ts
5
+ /** API base URL when `baseUrl` is unset. */
6
+ const sentryDefaultBaseUrl = "https://sentry.io";
7
+ /** Probe name when `name` is unset. */
8
+ const sentryDefaultName = "sentry";
9
+ /** A probe that expects 2xx from `GET {baseUrl}/api/0/`, sending `token` as a bearer token when given; non-critical by default. Throws `ProbeConfigError` for an empty or non-string `token` or an invalid `baseUrl`. */
10
+ function sentryProbe(options = {}) {
11
+ const doFetch = options.fetch ?? globalThis.fetch;
12
+ const url = (0, __openstatus_health.probeUrl)({
13
+ probe: "sentryProbe",
14
+ field: "baseUrl",
15
+ value: options.baseUrl ?? sentryDefaultBaseUrl,
16
+ path: "/api/0/"
17
+ });
18
+ if (options.token != null && (typeof options.token !== "string" || options.token.length === 0)) throw new __openstatus_health.ProbeConfigError("sentryProbe", "token", typeof options.token !== "string" ? `must be a string, got ${String(options.token)}` : "must not be empty");
19
+ const headers = options.token == null ? void 0 : { authorization: `Bearer ${options.token}` };
20
+ return {
21
+ name: options.name ?? sentryDefaultName,
22
+ critical: options.critical ?? false,
23
+ timeoutMs: options.timeoutMs,
24
+ skip: options.skip,
25
+ run: (signal) => (0, __openstatus_health.expectOk)(doFetch(url, {
26
+ method: "GET",
27
+ headers,
28
+ signal
29
+ }))
30
+ };
31
+ }
32
+
33
+ //#endregion
34
+ exports.sentryDefaultBaseUrl = sentryDefaultBaseUrl;
35
+ exports.sentryDefaultName = sentryDefaultName;
36
+ exports.sentryProbe = sentryProbe;
package/dist/mod.d.cts ADDED
@@ -0,0 +1,23 @@
1
+ import { Probe, ProbeOverrides } from "@openstatus/health";
2
+
3
+ //#region src/mod.d.ts
4
+
5
+ /** API base URL when `baseUrl` is unset. */
6
+ declare const sentryDefaultBaseUrl = "https://sentry.io";
7
+ /** Probe name when `name` is unset. */
8
+ declare const sentryDefaultName = "sentry";
9
+ /** Options for `sentryProbe()`. */
10
+ interface SentryProbeOptions extends ProbeOverrides {
11
+ /** An auth token, to also verify credentials. Optional. */
12
+ readonly token?: string;
13
+ /** API host. Default `sentryDefaultBaseUrl`. */
14
+ readonly baseUrl?: string | URL;
15
+ /** Replacement `fetch`, for tests. */
16
+ readonly fetch?: typeof fetch;
17
+ }
18
+ /** A probe that expects 2xx from `GET {baseUrl}/api/0/`, sending `token` as a bearer token when given; non-critical by default. Throws `ProbeConfigError` for an empty or non-string `token` or an invalid `baseUrl`. */
19
+ declare function sentryProbe(options?: SentryProbeOptions): Probe;
20
+ //# sourceMappingURL=mod.d.ts.map
21
+ //#endregion
22
+ export { SentryProbeOptions, sentryDefaultBaseUrl, sentryDefaultName, sentryProbe };
23
+ //# sourceMappingURL=mod.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mod.d.cts","names":[],"sources":["../src/mod.ts"],"sourcesContent":[],"mappings":";;;;;AAoCqC,cAfxB,oBAAA,GAewB,mBAAA;;AAA+B,cAbvD,iBAAA,GAauD,QAAA;;UAVnD,kBAAA,SAA2B;;;;8BAId;;0BAEJ;;;iBAIV,WAAA,WAAqB,qBAA0B"}
package/dist/mod.d.ts ADDED
@@ -0,0 +1,23 @@
1
+ import { Probe, ProbeOverrides } from "@openstatus/health";
2
+
3
+ //#region src/mod.d.ts
4
+
5
+ /** API base URL when `baseUrl` is unset. */
6
+ declare const sentryDefaultBaseUrl = "https://sentry.io";
7
+ /** Probe name when `name` is unset. */
8
+ declare const sentryDefaultName = "sentry";
9
+ /** Options for `sentryProbe()`. */
10
+ interface SentryProbeOptions extends ProbeOverrides {
11
+ /** An auth token, to also verify credentials. Optional. */
12
+ readonly token?: string;
13
+ /** API host. Default `sentryDefaultBaseUrl`. */
14
+ readonly baseUrl?: string | URL;
15
+ /** Replacement `fetch`, for tests. */
16
+ readonly fetch?: typeof fetch;
17
+ }
18
+ /** A probe that expects 2xx from `GET {baseUrl}/api/0/`, sending `token` as a bearer token when given; non-critical by default. Throws `ProbeConfigError` for an empty or non-string `token` or an invalid `baseUrl`. */
19
+ declare function sentryProbe(options?: SentryProbeOptions): Probe;
20
+ //# sourceMappingURL=mod.d.ts.map
21
+ //#endregion
22
+ export { SentryProbeOptions, sentryDefaultBaseUrl, sentryDefaultName, sentryProbe };
23
+ //# sourceMappingURL=mod.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mod.d.ts","names":[],"sources":["../src/mod.ts"],"sourcesContent":[],"mappings":";;;;;AAoCqC,cAfxB,oBAAA,GAewB,mBAAA;;AAA+B,cAbvD,iBAAA,GAauD,QAAA;;UAVnD,kBAAA,SAA2B;;;;8BAId;;0BAEJ;;;iBAIV,WAAA,WAAqB,qBAA0B"}
package/dist/mod.js ADDED
@@ -0,0 +1,34 @@
1
+ import { ProbeConfigError, expectOk, probeUrl } from "@openstatus/health";
2
+
3
+ //#region src/mod.ts
4
+ /** API base URL when `baseUrl` is unset. */
5
+ const sentryDefaultBaseUrl = "https://sentry.io";
6
+ /** Probe name when `name` is unset. */
7
+ const sentryDefaultName = "sentry";
8
+ /** A probe that expects 2xx from `GET {baseUrl}/api/0/`, sending `token` as a bearer token when given; non-critical by default. Throws `ProbeConfigError` for an empty or non-string `token` or an invalid `baseUrl`. */
9
+ function sentryProbe(options = {}) {
10
+ const doFetch = options.fetch ?? globalThis.fetch;
11
+ const url = probeUrl({
12
+ probe: "sentryProbe",
13
+ field: "baseUrl",
14
+ value: options.baseUrl ?? sentryDefaultBaseUrl,
15
+ path: "/api/0/"
16
+ });
17
+ if (options.token != null && (typeof options.token !== "string" || options.token.length === 0)) throw new ProbeConfigError("sentryProbe", "token", typeof options.token !== "string" ? `must be a string, got ${String(options.token)}` : "must not be empty");
18
+ const headers = options.token == null ? void 0 : { authorization: `Bearer ${options.token}` };
19
+ return {
20
+ name: options.name ?? sentryDefaultName,
21
+ critical: options.critical ?? false,
22
+ timeoutMs: options.timeoutMs,
23
+ skip: options.skip,
24
+ run: (signal) => expectOk(doFetch(url, {
25
+ method: "GET",
26
+ headers,
27
+ signal
28
+ }))
29
+ };
30
+ }
31
+
32
+ //#endregion
33
+ export { sentryDefaultBaseUrl, sentryDefaultName, sentryProbe };
34
+ //# sourceMappingURL=mod.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mod.js","names":["options: SentryProbeOptions"],"sources":["../src/mod.ts"],"sourcesContent":["/**\n * Sentry reachability probe for `@openstatus/health`, against `/api/0/`.\n *\n * ```ts\n * import { sentryProbe } from \"@openstatus/health-sentry\";\n *\n * const probe = sentryProbe({});\n * ```\n *\n * @module\n */\n\nimport {\n expectOk,\n type Probe,\n ProbeConfigError,\n type ProbeOverrides,\n probeUrl,\n} from \"@openstatus/health\";\n\n/** API base URL when `baseUrl` is unset. */\nexport const sentryDefaultBaseUrl = \"https://sentry.io\";\n/** Probe name when `name` is unset. */\nexport const sentryDefaultName = \"sentry\";\n\n/** Options for `sentryProbe()`. */\nexport interface SentryProbeOptions extends ProbeOverrides {\n /** An auth token, to also verify credentials. Optional. */\n readonly token?: string;\n /** API host. Default `sentryDefaultBaseUrl`. */\n readonly baseUrl?: string | URL;\n /** Replacement `fetch`, for tests. */\n readonly fetch?: typeof fetch;\n}\n\n/** A probe that expects 2xx from `GET {baseUrl}/api/0/`, sending `token` as a bearer token when given; non-critical by default. Throws `ProbeConfigError` for an empty or non-string `token` or an invalid `baseUrl`. */\nexport function sentryProbe(options: SentryProbeOptions = {}): Probe {\n const doFetch = options.fetch ?? globalThis.fetch;\n const url = probeUrl({\n probe: \"sentryProbe\",\n field: \"baseUrl\",\n value: options.baseUrl ?? sentryDefaultBaseUrl,\n path: \"/api/0/\",\n });\n if (\n options.token != null &&\n (typeof options.token !== \"string\" || options.token.length === 0)\n ) {\n throw new ProbeConfigError(\n \"sentryProbe\",\n \"token\",\n typeof options.token !== \"string\"\n ? `must be a string, got ${String(options.token)}`\n : \"must not be empty\",\n );\n }\n const headers = options.token == null\n ? undefined\n : { authorization: `Bearer ${options.token}` };\n return {\n name: options.name ?? sentryDefaultName,\n critical: options.critical ?? false,\n timeoutMs: options.timeoutMs,\n skip: options.skip,\n run: (signal) => expectOk(doFetch(url, { method: \"GET\", headers, signal })),\n };\n}\n"],"mappings":";;;;AAqBA,MAAa,uBAAuB;;AAEpC,MAAa,oBAAoB;;AAajC,SAAgB,YAAYA,UAA8B,CAAE,GAAS;CACnE,MAAM,UAAU,QAAQ,SAAS,WAAW;CAC5C,MAAM,MAAM,SAAS;EACnB,OAAO;EACP,OAAO;EACP,OAAO,QAAQ,WAAW;EAC1B,MAAM;CACP,EAAC;AACF,KACE,QAAQ,SAAS,gBACT,QAAQ,UAAU,YAAY,QAAQ,MAAM,WAAW,GAE/D,OAAM,IAAI,iBACR,eACA,gBACO,QAAQ,UAAU,YACpB,wBAAwB,OAAO,QAAQ,MAAM,CAAC,IAC/C;CAGR,MAAM,UAAU,QAAQ,SAAS,gBAE7B,EAAE,gBAAgB,SAAS,QAAQ,MAAM,EAAG;AAChD,QAAO;EACL,MAAM,QAAQ,QAAQ;EACtB,UAAU,QAAQ,YAAY;EAC9B,WAAW,QAAQ;EACnB,MAAM,QAAQ;EACd,KAAK,CAAC,WAAW,SAAS,QAAQ,KAAK;GAAE,QAAQ;GAAO;GAAS;EAAQ,EAAC,CAAC;CAC5E;AACF"}
package/package.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "@openstatus/health-sentry",
3
+ "version": "0.1.4-dev.0",
4
+ "description": "Sentry API probe for @openstatus/health",
5
+ "keywords": [
6
+ "openstatus",
7
+ "health",
8
+ "healthcheck",
9
+ "sentry",
10
+ "error-tracking",
11
+ "monitoring"
12
+ ],
13
+ "license": "MIT",
14
+ "author": {
15
+ "name": "openstatus",
16
+ "url": "https://www.openstatus.dev/"
17
+ },
18
+ "homepage": "https://github.com/openstatusHQ/health",
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "git+https://github.com/openstatusHQ/health.git",
22
+ "directory": "packages/sentry/"
23
+ },
24
+ "bugs": {
25
+ "url": "https://github.com/openstatusHQ/health/issues"
26
+ },
27
+ "type": "module",
28
+ "module": "./dist/mod.js",
29
+ "main": "./dist/mod.cjs",
30
+ "types": "./dist/mod.d.ts",
31
+ "exports": {
32
+ ".": {
33
+ "types": {
34
+ "import": "./dist/mod.d.ts",
35
+ "require": "./dist/mod.d.cts"
36
+ },
37
+ "import": "./dist/mod.js",
38
+ "require": "./dist/mod.cjs"
39
+ },
40
+ "./package.json": "./package.json"
41
+ },
42
+ "sideEffects": false,
43
+ "files": [
44
+ "dist/"
45
+ ],
46
+ "engines": {
47
+ "node": ">=22"
48
+ },
49
+ "peerDependencies": {
50
+ "@openstatus/health": "^0.1.4-dev.0"
51
+ },
52
+ "devDependencies": {
53
+ "tsdown": "^0.12.7",
54
+ "typescript": "^5.8.3"
55
+ },
56
+ "scripts": {
57
+ "build": "tsdown",
58
+ "prepack": "tsdown",
59
+ "test": "node --experimental-transform-types --test"
60
+ }
61
+ }