@firebreak/vitals 1.0.3 → 1.1.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.
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/checks/databricks.ts
|
|
21
|
+
var databricks_exports = {};
|
|
22
|
+
__export(databricks_exports, {
|
|
23
|
+
databricksCheck: () => databricksCheck
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(databricks_exports);
|
|
26
|
+
|
|
27
|
+
// src/types.ts
|
|
28
|
+
var Status = {
|
|
29
|
+
HEALTHY: 2,
|
|
30
|
+
DEGRADED: 1,
|
|
31
|
+
OUTAGE: 0
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
// src/checks/databricks.ts
|
|
35
|
+
function databricksCheck(client) {
|
|
36
|
+
return async () => {
|
|
37
|
+
let session;
|
|
38
|
+
let op;
|
|
39
|
+
try {
|
|
40
|
+
session = await client.openSession();
|
|
41
|
+
op = await session.executeStatement("SELECT 1");
|
|
42
|
+
return { status: Status.HEALTHY, message: "" };
|
|
43
|
+
} catch (error) {
|
|
44
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
45
|
+
return { status: Status.OUTAGE, message };
|
|
46
|
+
} finally {
|
|
47
|
+
op?.close().catch(() => {
|
|
48
|
+
});
|
|
49
|
+
session?.close().catch(() => {
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
55
|
+
0 && (module.exports = {
|
|
56
|
+
databricksCheck
|
|
57
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { A as AsyncCheckFn } from '../core-BJ2Z0rRi.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Minimal interface for a connected Databricks SQL client.
|
|
5
|
+
* Avoids a hard dependency on `@databricks/sql`.
|
|
6
|
+
*/
|
|
7
|
+
interface DatabricksClient {
|
|
8
|
+
openSession(): Promise<DatabricksSession>;
|
|
9
|
+
}
|
|
10
|
+
interface DatabricksSession {
|
|
11
|
+
executeStatement(statement: string, options?: Record<string, unknown>): Promise<DatabricksOperation>;
|
|
12
|
+
close(): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
interface DatabricksOperation {
|
|
15
|
+
close(): Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Creates a healthcheck function that opens a session on an existing
|
|
19
|
+
* Databricks SQL client, runs `SELECT 1`, and closes the session.
|
|
20
|
+
*/
|
|
21
|
+
declare function databricksCheck(client: DatabricksClient): AsyncCheckFn;
|
|
22
|
+
|
|
23
|
+
export { AsyncCheckFn, type DatabricksClient, type DatabricksOperation, type DatabricksSession, databricksCheck };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { A as AsyncCheckFn } from '../core-BJ2Z0rRi.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Minimal interface for a connected Databricks SQL client.
|
|
5
|
+
* Avoids a hard dependency on `@databricks/sql`.
|
|
6
|
+
*/
|
|
7
|
+
interface DatabricksClient {
|
|
8
|
+
openSession(): Promise<DatabricksSession>;
|
|
9
|
+
}
|
|
10
|
+
interface DatabricksSession {
|
|
11
|
+
executeStatement(statement: string, options?: Record<string, unknown>): Promise<DatabricksOperation>;
|
|
12
|
+
close(): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
interface DatabricksOperation {
|
|
15
|
+
close(): Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Creates a healthcheck function that opens a session on an existing
|
|
19
|
+
* Databricks SQL client, runs `SELECT 1`, and closes the session.
|
|
20
|
+
*/
|
|
21
|
+
declare function databricksCheck(client: DatabricksClient): AsyncCheckFn;
|
|
22
|
+
|
|
23
|
+
export { AsyncCheckFn, type DatabricksClient, type DatabricksOperation, type DatabricksSession, databricksCheck };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// src/types.ts
|
|
2
|
+
var Status = {
|
|
3
|
+
HEALTHY: 2,
|
|
4
|
+
DEGRADED: 1,
|
|
5
|
+
OUTAGE: 0
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
// src/checks/databricks.ts
|
|
9
|
+
function databricksCheck(client) {
|
|
10
|
+
return async () => {
|
|
11
|
+
let session;
|
|
12
|
+
let op;
|
|
13
|
+
try {
|
|
14
|
+
session = await client.openSession();
|
|
15
|
+
op = await session.executeStatement("SELECT 1");
|
|
16
|
+
return { status: Status.HEALTHY, message: "" };
|
|
17
|
+
} catch (error) {
|
|
18
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
19
|
+
return { status: Status.OUTAGE, message };
|
|
20
|
+
} finally {
|
|
21
|
+
op?.close().catch(() => {
|
|
22
|
+
});
|
|
23
|
+
session?.close().catch(() => {
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
databricksCheck
|
|
30
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@firebreak/vitals",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Deep healthcheck endpoints following the HEALTHCHECK_SPEC format",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -34,6 +34,16 @@
|
|
|
34
34
|
"default": "./dist/checks/http.cjs"
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
|
+
"./checks/databricks": {
|
|
38
|
+
"import": {
|
|
39
|
+
"types": "./dist/checks/databricks.d.ts",
|
|
40
|
+
"default": "./dist/checks/databricks.mjs"
|
|
41
|
+
},
|
|
42
|
+
"require": {
|
|
43
|
+
"types": "./dist/checks/databricks.d.cts",
|
|
44
|
+
"default": "./dist/checks/databricks.cjs"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
37
47
|
"./checks/redis": {
|
|
38
48
|
"import": {
|
|
39
49
|
"types": "./dist/checks/redis.d.ts",
|
|
@@ -109,5 +119,5 @@
|
|
|
109
119
|
"engines": {
|
|
110
120
|
"node": ">=20.0.0"
|
|
111
121
|
},
|
|
112
|
-
"license": "
|
|
122
|
+
"license": "MIT"
|
|
113
123
|
}
|