@midwayjs/prometheus 3.5.1 → 3.6.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/dist/configuration.js
CHANGED
|
@@ -10,7 +10,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.PrometheusConfiguration = void 0;
|
|
13
|
-
const
|
|
13
|
+
const core_1 = require("@midwayjs/core");
|
|
14
14
|
const PromClient = require("prom-client");
|
|
15
15
|
const utils_1 = require("./utils/utils");
|
|
16
16
|
const os = require("os");
|
|
@@ -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 = (0,
|
|
26
|
+
const modules = (0, core_1.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 = (0,
|
|
50
|
+
const rules = (0, core_1.getClassMetadata)('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) => {
|
|
@@ -92,15 +92,15 @@ let PrometheusConfiguration = class PrometheusConfiguration {
|
|
|
92
92
|
}
|
|
93
93
|
};
|
|
94
94
|
__decorate([
|
|
95
|
-
(0,
|
|
95
|
+
(0, core_1.Config)('prometheus'),
|
|
96
96
|
__metadata("design:type", Object)
|
|
97
97
|
], PrometheusConfiguration.prototype, "prometheusConfig", void 0);
|
|
98
98
|
__decorate([
|
|
99
|
-
(0,
|
|
99
|
+
(0, core_1.App)(),
|
|
100
100
|
__metadata("design:type", Object)
|
|
101
101
|
], PrometheusConfiguration.prototype, "app", void 0);
|
|
102
102
|
PrometheusConfiguration = __decorate([
|
|
103
|
-
(0,
|
|
103
|
+
(0, core_1.Configuration)({
|
|
104
104
|
namespace: 'prometheus',
|
|
105
105
|
importConfigs: [
|
|
106
106
|
{
|
package/dist/decorator/master.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Master = void 0;
|
|
4
|
-
const
|
|
4
|
+
const core_1 = require("@midwayjs/core");
|
|
5
5
|
const request = require("request");
|
|
6
6
|
const path = require("path");
|
|
7
7
|
const os = require("os");
|
|
@@ -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
|
-
(0,
|
|
12
|
+
(0, core_1.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
|
-
(0,
|
|
29
|
+
(0, core_1.attachClassMetadata)('prometheus:master:options', {
|
|
30
30
|
name: `${target.constructor.name}_${propertyKey}`,
|
|
31
31
|
value: descriptor.value,
|
|
32
32
|
}, target.constructor);
|
|
@@ -10,7 +10,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.DataService = void 0;
|
|
13
|
-
const
|
|
13
|
+
const core_1 = require("@midwayjs/core");
|
|
14
14
|
const Client = require("prom-client");
|
|
15
15
|
const master_1 = require("../decorator/master");
|
|
16
16
|
const PromClient = require("prom-client");
|
|
@@ -80,7 +80,7 @@ let DataService = class DataService {
|
|
|
80
80
|
}
|
|
81
81
|
};
|
|
82
82
|
__decorate([
|
|
83
|
-
(0,
|
|
83
|
+
(0, core_1.Config)('prometheus'),
|
|
84
84
|
__metadata("design:type", Object)
|
|
85
85
|
], DataService.prototype, "prometheusConfig", void 0);
|
|
86
86
|
__decorate([
|
|
@@ -114,8 +114,8 @@ __decorate([
|
|
|
114
114
|
__metadata("design:returntype", Promise)
|
|
115
115
|
], DataService.prototype, "getData", null);
|
|
116
116
|
DataService = __decorate([
|
|
117
|
-
(0,
|
|
118
|
-
(0,
|
|
117
|
+
(0, core_1.Provide)(),
|
|
118
|
+
(0, core_1.Scope)(core_1.ScopeEnum.Singleton)
|
|
119
119
|
], DataService);
|
|
120
120
|
exports.DataService = DataService;
|
|
121
121
|
//# sourceMappingURL=dataService.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midwayjs/prometheus",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.0",
|
|
4
4
|
"description": "midway component for prometheus",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "index.d.ts",
|
|
@@ -23,10 +23,9 @@
|
|
|
23
23
|
],
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@midwayjs/core": "^3.
|
|
27
|
-
"@midwayjs/
|
|
28
|
-
"@midwayjs/
|
|
29
|
-
"@midwayjs/mock": "^3.5.1",
|
|
26
|
+
"@midwayjs/core": "^3.6.0",
|
|
27
|
+
"@midwayjs/koa": "^3.6.0",
|
|
28
|
+
"@midwayjs/mock": "^3.6.0",
|
|
30
29
|
"@types/request": "2.48.8"
|
|
31
30
|
},
|
|
32
31
|
"dependencies": {
|
|
@@ -36,5 +35,5 @@
|
|
|
36
35
|
"engines": {
|
|
37
36
|
"node": ">=12"
|
|
38
37
|
},
|
|
39
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "22643b0e8519766bb7c68b975930199fc136336e"
|
|
40
39
|
}
|