@midwayjs/prometheus 3.19.2 → 4.0.0-alpha.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/dist/configuration.js
CHANGED
|
@@ -23,7 +23,7 @@ const DefaultConfig = require("./config/config.default");
|
|
|
23
23
|
let PrometheusConfiguration = class PrometheusConfiguration {
|
|
24
24
|
async onReady() {
|
|
25
25
|
PromClient.collectDefaultMetrics(this.prometheusConfig);
|
|
26
|
-
const modules =
|
|
26
|
+
const modules = core_1.DecoratorManager.listModule('prometheus:master');
|
|
27
27
|
const handlers = {};
|
|
28
28
|
let sockFile = path.join(os.tmpdir(), 'midway-master.sock');
|
|
29
29
|
if (process.platform === 'win32') {
|
|
@@ -47,7 +47,7 @@ let PrometheusConfiguration = class PrometheusConfiguration {
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
for (const module of modules) {
|
|
50
|
-
const rules =
|
|
50
|
+
const rules = core_1.MetadataManager.getOwnMetadata('prometheus:master:options', module);
|
|
51
51
|
for (const rule of rules) {
|
|
52
52
|
if ((0, utils_1.isMaster)()) {
|
|
53
53
|
handlers[rule.name] = async (...args) => {
|
|
@@ -91,15 +91,16 @@ let PrometheusConfiguration = class PrometheusConfiguration {
|
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
};
|
|
94
|
+
exports.PrometheusConfiguration = PrometheusConfiguration;
|
|
94
95
|
__decorate([
|
|
95
96
|
(0, core_1.Config)('prometheus'),
|
|
96
97
|
__metadata("design:type", Object)
|
|
97
98
|
], PrometheusConfiguration.prototype, "prometheusConfig", void 0);
|
|
98
99
|
__decorate([
|
|
99
|
-
(0, core_1.
|
|
100
|
+
(0, core_1.MainApp)(),
|
|
100
101
|
__metadata("design:type", Object)
|
|
101
102
|
], PrometheusConfiguration.prototype, "app", void 0);
|
|
102
|
-
PrometheusConfiguration = __decorate([
|
|
103
|
+
exports.PrometheusConfiguration = PrometheusConfiguration = __decorate([
|
|
103
104
|
(0, core_1.Configuration)({
|
|
104
105
|
namespace: 'prometheus',
|
|
105
106
|
importConfigs: [
|
|
@@ -109,5 +110,4 @@ PrometheusConfiguration = __decorate([
|
|
|
109
110
|
],
|
|
110
111
|
})
|
|
111
112
|
], PrometheusConfiguration);
|
|
112
|
-
exports.PrometheusConfiguration = PrometheusConfiguration;
|
|
113
113
|
//# sourceMappingURL=configuration.js.map
|
package/dist/decorator/master.js
CHANGED
|
@@ -9,7 +9,7 @@ const utils_1 = require("../utils/utils");
|
|
|
9
9
|
const qs = require("querystring");
|
|
10
10
|
function Master() {
|
|
11
11
|
return function (target, propertyKey, descriptor) {
|
|
12
|
-
|
|
12
|
+
core_1.DecoratorManager.saveModule('prometheus:master', target.constructor);
|
|
13
13
|
const sockFile = path.join(os.tmpdir(), 'midway-master.sock');
|
|
14
14
|
if (!(0, utils_1.isMaster)()) {
|
|
15
15
|
descriptor.value = (...args) => {
|
|
@@ -26,7 +26,7 @@ function Master() {
|
|
|
26
26
|
});
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
|
-
|
|
29
|
+
core_1.MetadataManager.attachMetadata('prometheus:master:options', {
|
|
30
30
|
name: `${target.constructor.name}_${propertyKey}`,
|
|
31
31
|
value: descriptor.value,
|
|
32
32
|
}, target.constructor);
|
|
@@ -84,6 +84,7 @@ let DataService = class DataService {
|
|
|
84
84
|
return Register.metrics();
|
|
85
85
|
}
|
|
86
86
|
};
|
|
87
|
+
exports.DataService = DataService;
|
|
87
88
|
__decorate([
|
|
88
89
|
(0, core_1.Config)('prometheus'),
|
|
89
90
|
__metadata("design:type", Object)
|
|
@@ -124,9 +125,8 @@ __decorate([
|
|
|
124
125
|
__metadata("design:paramtypes", []),
|
|
125
126
|
__metadata("design:returntype", Promise)
|
|
126
127
|
], DataService.prototype, "getData", null);
|
|
127
|
-
DataService = __decorate([
|
|
128
|
+
exports.DataService = DataService = __decorate([
|
|
128
129
|
(0, core_1.Provide)(),
|
|
129
130
|
(0, core_1.Scope)(core_1.ScopeEnum.Singleton)
|
|
130
131
|
], DataService);
|
|
131
|
-
exports.DataService = DataService;
|
|
132
132
|
//# sourceMappingURL=dataService.js.map
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midwayjs/prometheus",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-alpha.1",
|
|
4
4
|
"description": "midway component for prometheus",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "tsc",
|
|
9
|
-
"test": "node
|
|
10
|
-
"cov": "node
|
|
9
|
+
"test": "node -r ts-node/register ../../node_modules/jest/bin/jest.js --runInBand",
|
|
10
|
+
"cov": "node -r ts-node/register ../../node_modules/jest/bin/jest.js --runInBand --coverage --forceExit",
|
|
11
11
|
"ci": "npm run cov --ts"
|
|
12
12
|
},
|
|
13
13
|
"keywords": [
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
],
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@midwayjs/core": "^
|
|
27
|
-
"@midwayjs/koa": "^
|
|
28
|
-
"@midwayjs/mock": "^
|
|
26
|
+
"@midwayjs/core": "^4.0.0-alpha.1",
|
|
27
|
+
"@midwayjs/koa": "^4.0.0-alpha.1",
|
|
28
|
+
"@midwayjs/mock": "^4.0.0-alpha.1",
|
|
29
29
|
"@types/request": "2.48.12"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"engines": {
|
|
36
36
|
"node": ">=12"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "14bb4da91805a1cf52f190c0d37a74b395dd6372"
|
|
39
39
|
}
|