@firebreak/vitals 3.0.0-beta.2 → 3.0.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.
|
@@ -32,11 +32,12 @@ var Status = {
|
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
// src/checks/databricks.ts
|
|
35
|
-
function databricksCheck(
|
|
35
|
+
function databricksCheck(clientOrFactory) {
|
|
36
36
|
return async () => {
|
|
37
37
|
let session;
|
|
38
38
|
let op;
|
|
39
39
|
try {
|
|
40
|
+
const client = typeof clientOrFactory === "function" ? await clientOrFactory() : clientOrFactory;
|
|
40
41
|
session = await client.openSession();
|
|
41
42
|
op = await session.executeStatement("SELECT 1");
|
|
42
43
|
return { status: Status.HEALTHY, message: "" };
|
|
@@ -14,10 +14,11 @@ interface DatabricksSession {
|
|
|
14
14
|
interface DatabricksOperation {
|
|
15
15
|
close(): Promise<void>;
|
|
16
16
|
}
|
|
17
|
+
type DatabricksClientOrFactory = DatabricksClient | (() => DatabricksClient | Promise<DatabricksClient>);
|
|
17
18
|
/**
|
|
18
19
|
* Creates a healthcheck function that opens a session on an existing
|
|
19
20
|
* Databricks SQL client, runs `SELECT 1`, and closes the session.
|
|
20
21
|
*/
|
|
21
|
-
declare function databricksCheck(
|
|
22
|
+
declare function databricksCheck(clientOrFactory: DatabricksClientOrFactory): AsyncCheckFn;
|
|
22
23
|
|
|
23
|
-
export { AsyncCheckFn, type DatabricksClient, type DatabricksOperation, type DatabricksSession, databricksCheck };
|
|
24
|
+
export { AsyncCheckFn, type DatabricksClient, type DatabricksClientOrFactory, type DatabricksOperation, type DatabricksSession, databricksCheck };
|
|
@@ -14,10 +14,11 @@ interface DatabricksSession {
|
|
|
14
14
|
interface DatabricksOperation {
|
|
15
15
|
close(): Promise<void>;
|
|
16
16
|
}
|
|
17
|
+
type DatabricksClientOrFactory = DatabricksClient | (() => DatabricksClient | Promise<DatabricksClient>);
|
|
17
18
|
/**
|
|
18
19
|
* Creates a healthcheck function that opens a session on an existing
|
|
19
20
|
* Databricks SQL client, runs `SELECT 1`, and closes the session.
|
|
20
21
|
*/
|
|
21
|
-
declare function databricksCheck(
|
|
22
|
+
declare function databricksCheck(clientOrFactory: DatabricksClientOrFactory): AsyncCheckFn;
|
|
22
23
|
|
|
23
|
-
export { AsyncCheckFn, type DatabricksClient, type DatabricksOperation, type DatabricksSession, databricksCheck };
|
|
24
|
+
export { AsyncCheckFn, type DatabricksClient, type DatabricksClientOrFactory, type DatabricksOperation, type DatabricksSession, databricksCheck };
|
|
@@ -6,11 +6,12 @@ var Status = {
|
|
|
6
6
|
};
|
|
7
7
|
|
|
8
8
|
// src/checks/databricks.ts
|
|
9
|
-
function databricksCheck(
|
|
9
|
+
function databricksCheck(clientOrFactory) {
|
|
10
10
|
return async () => {
|
|
11
11
|
let session;
|
|
12
12
|
let op;
|
|
13
13
|
try {
|
|
14
|
+
const client = typeof clientOrFactory === "function" ? await clientOrFactory() : clientOrFactory;
|
|
14
15
|
session = await client.openSession();
|
|
15
16
|
op = await session.executeStatement("SELECT 1");
|
|
16
17
|
return { status: Status.HEALTHY, message: "" };
|