@kronos-integration/service-health 6.0.2 → 7.0.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/package.json +3 -3
- package/src/service-health.mjs +17 -20
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kronos-integration/service-health",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"provenance": true
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@kronos-integration/endpoint": "^10.0.5",
|
|
36
|
-
"@kronos-integration/service": "^13.
|
|
37
|
-
"pacc": "^3.
|
|
36
|
+
"@kronos-integration/service": "^13.1.2",
|
|
37
|
+
"pacc": "^3.11.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"ava": "^6.4.1",
|
package/src/service-health.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import process from "process";
|
|
2
|
-
import {
|
|
2
|
+
import { prepareAttributesDefinitions } from "pacc";
|
|
3
3
|
import { Service } from "@kronos-integration/service";
|
|
4
4
|
|
|
5
5
|
const intervalOptions = {
|
|
@@ -21,7 +21,7 @@ let lastCpuUsage;
|
|
|
21
21
|
|
|
22
22
|
const intervalEndpointDefs = {
|
|
23
23
|
cpu: {
|
|
24
|
-
receive: () => {
|
|
24
|
+
receive: () => {
|
|
25
25
|
lastCpuUsage = process.cpuUsage(lastCpuUsage);
|
|
26
26
|
return lastCpuUsage;
|
|
27
27
|
},
|
|
@@ -73,7 +73,8 @@ export class ServiceHealth extends Service {
|
|
|
73
73
|
endpoint.send(hcs.isHealthy);
|
|
74
74
|
const listener = () => endpoint.send(hcs.isHealthy);
|
|
75
75
|
hcs.owner.addListener("serviceStateChanged", listener);
|
|
76
|
-
return () =>
|
|
76
|
+
return () =>
|
|
77
|
+
hcs.owner.removeListener("serviceStateChanged", listener);
|
|
77
78
|
}
|
|
78
79
|
}
|
|
79
80
|
},
|
|
@@ -81,23 +82,19 @@ export class ServiceHealth extends Service {
|
|
|
81
82
|
};
|
|
82
83
|
}
|
|
83
84
|
|
|
84
|
-
static
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
),
|
|
98
|
-
Service.configurationAttributes
|
|
99
|
-
);
|
|
100
|
-
}
|
|
85
|
+
static attributes = prepareAttributesDefinitions(
|
|
86
|
+
Object.fromEntries(
|
|
87
|
+
Object.entries(intervalEndpointDefs).map(([name, def]) => [
|
|
88
|
+
name + "Interval",
|
|
89
|
+
{
|
|
90
|
+
description: `${name} endpoint send interval (in seconds)`,
|
|
91
|
+
default: 30,
|
|
92
|
+
type: "duration"
|
|
93
|
+
}
|
|
94
|
+
])
|
|
95
|
+
),
|
|
96
|
+
Service.attributes
|
|
97
|
+
);
|
|
101
98
|
|
|
102
99
|
/**
|
|
103
100
|
* Start immediate
|