@midwayjs/prometheus 3.0.0-alpha.43 → 3.0.0-beta.10

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/CHANGELOG.md CHANGED
@@ -3,6 +3,100 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [3.0.0-beta.10](https://github.com/midwayjs/midway/compare/v3.0.0-beta.9...v3.0.0-beta.10) (2021-12-20)
7
+
8
+ **Note:** Version bump only for package @midwayjs/prometheus
9
+
10
+
11
+
12
+
13
+
14
+ # [3.0.0-beta.9](https://github.com/midwayjs/midway/compare/v3.0.0-beta.8...v3.0.0-beta.9) (2021-12-09)
15
+
16
+ **Note:** Version bump only for package @midwayjs/prometheus
17
+
18
+
19
+
20
+
21
+
22
+ # [3.0.0-beta.8](https://github.com/midwayjs/midway/compare/v3.0.0-beta.7...v3.0.0-beta.8) (2021-12-08)
23
+
24
+ **Note:** Version bump only for package @midwayjs/prometheus
25
+
26
+
27
+
28
+
29
+
30
+ # [3.0.0-beta.7](https://github.com/midwayjs/midway/compare/v3.0.0-beta.6...v3.0.0-beta.7) (2021-12-03)
31
+
32
+
33
+ ### Bug Fixes
34
+
35
+ * add app.keys ([#1395](https://github.com/midwayjs/midway/issues/1395)) ([c44afc6](https://github.com/midwayjs/midway/commit/c44afc6cc6764a959d1fa7ae04d60099282d156a))
36
+
37
+
38
+
39
+
40
+
41
+ # [3.0.0-beta.6](https://github.com/midwayjs/midway/compare/v3.0.0-beta.5...v3.0.0-beta.6) (2021-11-26)
42
+
43
+ **Note:** Version bump only for package @midwayjs/prometheus
44
+
45
+
46
+
47
+
48
+
49
+ # [3.0.0-beta.5](https://github.com/midwayjs/midway/compare/v3.0.0-beta.4...v3.0.0-beta.5) (2021-11-25)
50
+
51
+ **Note:** Version bump only for package @midwayjs/prometheus
52
+
53
+
54
+
55
+
56
+
57
+ # [3.0.0-beta.4](https://github.com/midwayjs/midway/compare/v3.0.0-beta.3...v3.0.0-beta.4) (2021-11-24)
58
+
59
+ **Note:** Version bump only for package @midwayjs/prometheus
60
+
61
+
62
+
63
+
64
+
65
+ # [3.0.0-beta.3](https://github.com/midwayjs/midway/compare/v3.0.0-beta.2...v3.0.0-beta.3) (2021-11-18)
66
+
67
+
68
+ ### Features
69
+
70
+ * add component and framework config definition ([#1367](https://github.com/midwayjs/midway/issues/1367)) ([b2fe615](https://github.com/midwayjs/midway/commit/b2fe6157f99659471ff1333eca0b86bb889f61a3))
71
+
72
+
73
+
74
+
75
+
76
+ # [3.0.0-beta.2](https://github.com/midwayjs/midway/compare/v3.0.0-beta.1...v3.0.0-beta.2) (2021-11-16)
77
+
78
+ **Note:** Version bump only for package @midwayjs/prometheus
79
+
80
+
81
+
82
+
83
+
84
+ # [3.0.0-beta.1](https://github.com/midwayjs/midway/compare/v2.12.4...v3.0.0-beta.1) (2021-11-14)
85
+
86
+
87
+ ### Bug Fixes
88
+
89
+ * node v16 typings ([#1269](https://github.com/midwayjs/midway/issues/1269)) ([e3443b5](https://github.com/midwayjs/midway/commit/e3443b58fc1faddadf1e95dd03a2f319410941bb))
90
+
91
+
92
+ ### Features
93
+
94
+ * add setDiff ([#1263](https://github.com/midwayjs/midway/issues/1263)) ([9dd1a08](https://github.com/midwayjs/midway/commit/9dd1a08326540da52abf79cf31182d4e63b7f4d9))
95
+
96
+
97
+
98
+
99
+
6
100
  ## [2.12.3](https://github.com/midwayjs/midway/compare/v2.12.2...v2.12.3) (2021-08-09)
7
101
 
8
102
  **Note:** Version bump only for package @midwayjs/prometheus
@@ -1,3 +1,3 @@
1
- import { DefaultMetricsCollectorConfiguration as DefaultConfig } from 'prom-client';
2
- export declare const prometheus: DefaultConfig;
1
+ import { DefaultMetricsCollectorConfiguration } from 'prom-client';
2
+ export declare const prometheus: DefaultMetricsCollectorConfiguration;
3
3
  //# sourceMappingURL=config.default.d.ts.map
@@ -1,8 +1,8 @@
1
- export declare class AutoConfiguration {
1
+ export declare class PrometheusConfiguration {
2
2
  prometheusConfig: any;
3
3
  app: any;
4
4
  http_server: any;
5
- onReady(contanier: any): Promise<void>;
5
+ onReady(): Promise<void>;
6
6
  onStop(): Promise<void>;
7
7
  }
8
8
  //# sourceMappingURL=configuration.d.ts.map
@@ -9,9 +9,8 @@ var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.AutoConfiguration = void 0;
12
+ exports.PrometheusConfiguration = void 0;
13
13
  const decorator_1 = require("@midwayjs/decorator");
14
- const path_1 = require("path");
15
14
  const PromClient = require("prom-client");
16
15
  const utils_1 = require("./utils/utils");
17
16
  const os = require("os");
@@ -20,8 +19,9 @@ const fs = require("fs");
20
19
  const http = require("http");
21
20
  const qs = require("querystring");
22
21
  const dataService_1 = require("./service/dataService");
23
- let AutoConfiguration = class AutoConfiguration {
24
- async onReady(contanier) {
22
+ const DefaultConfig = require("./config/config.default");
23
+ let PrometheusConfiguration = class PrometheusConfiguration {
24
+ async onReady() {
25
25
  PromClient.collectDefaultMetrics(this.prometheusConfig);
26
26
  const modules = (0, decorator_1.listModule)('prometheus:master');
27
27
  const handlers = {};
@@ -94,16 +94,20 @@ let AutoConfiguration = class AutoConfiguration {
94
94
  __decorate([
95
95
  (0, decorator_1.Config)('prometheus'),
96
96
  __metadata("design:type", Object)
97
- ], AutoConfiguration.prototype, "prometheusConfig", void 0);
97
+ ], PrometheusConfiguration.prototype, "prometheusConfig", void 0);
98
98
  __decorate([
99
99
  (0, decorator_1.App)(),
100
100
  __metadata("design:type", Object)
101
- ], AutoConfiguration.prototype, "app", void 0);
102
- AutoConfiguration = __decorate([
101
+ ], PrometheusConfiguration.prototype, "app", void 0);
102
+ PrometheusConfiguration = __decorate([
103
103
  (0, decorator_1.Configuration)({
104
104
  namespace: 'prometheus',
105
- importConfigs: [(0, path_1.join)(__dirname, 'config')],
105
+ importConfigs: [
106
+ {
107
+ default: DefaultConfig,
108
+ },
109
+ ],
106
110
  })
107
- ], AutoConfiguration);
108
- exports.AutoConfiguration = AutoConfiguration;
111
+ ], PrometheusConfiguration);
112
+ exports.PrometheusConfiguration = PrometheusConfiguration;
109
113
  //# sourceMappingURL=configuration.js.map
package/dist/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- export { AutoConfiguration as Configuration } from './configuration';
2
- export { DefaultMetricsCollectorConfiguration as DefaultConfig } from 'prom-client';
1
+ export { PrometheusConfiguration as Configuration } from './configuration';
3
2
  export { DataService } from './service/dataService';
4
3
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DataService = exports.Configuration = void 0;
4
4
  var configuration_1 = require("./configuration");
5
- Object.defineProperty(exports, "Configuration", { enumerable: true, get: function () { return configuration_1.AutoConfiguration; } });
5
+ Object.defineProperty(exports, "Configuration", { enumerable: true, get: function () { return configuration_1.PrometheusConfiguration; } });
6
6
  var dataService_1 = require("./service/dataService");
7
7
  Object.defineProperty(exports, "DataService", { enumerable: true, get: function () { return dataService_1.DataService; } });
8
8
  //# sourceMappingURL=index.js.map
@@ -8,7 +8,7 @@ export declare class DataService {
8
8
  bInit: boolean;
9
9
  init(): Promise<void>;
10
10
  getUser(method: any, status: any, path: any, time: any): Promise<void>;
11
- define(name: any, type: any, options: any): Promise<void>;
11
+ define(name: any, type: any, options: any): void;
12
12
  inc(name: any, labels: any, value?: number): Promise<void>;
13
13
  set(name: any, value: any): Promise<void>;
14
14
  setDiff(name: any, diff: any): Promise<void>;
@@ -54,7 +54,7 @@ let DataService = class DataService {
54
54
  .labels(method, status, path, ...Object.values(this.prometheusConfig.labels))
55
55
  .observe(time);
56
56
  }
57
- async define(name, type, options) {
57
+ define(name, type, options) {
58
58
  options.labelNames = options.labelNames
59
59
  ? [...options.labelNames, ...Object.keys(this.prometheusConfig.labels)]
60
60
  : Object.keys(this.prometheusConfig.labels);
package/index.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ import { DefaultMetricsCollectorConfiguration } from 'prom-client';
2
+
3
+ export * from './dist/index';
4
+
5
+ declare module '@midwayjs/core/dist/interface' {
6
+ interface MidwayConfig {
7
+ prometheus?: DefaultMetricsCollectorConfiguration;
8
+ }
9
+ }
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@midwayjs/prometheus",
3
- "version": "3.0.0-alpha.43+8b8075f0",
3
+ "version": "3.0.0-beta.10",
4
4
  "description": "midway component for prometheus",
5
5
  "main": "dist/index.js",
6
- "typings": "dist/index.d.ts",
6
+ "typings": "index.d.ts",
7
7
  "scripts": {
8
8
  "build": "tsc",
9
9
  "test": "node --require=ts-node/register ../../node_modules/.bin/jest",
@@ -18,14 +18,15 @@
18
18
  ],
19
19
  "files": [
20
20
  "dist/**/*.js",
21
- "dist/**/*.d.ts"
21
+ "dist/**/*.d.ts",
22
+ "index.d.ts"
22
23
  ],
23
24
  "license": "MIT",
24
25
  "devDependencies": {
25
- "@midwayjs/core": "^3.0.0-alpha.43+8b8075f0",
26
- "@midwayjs/decorator": "^3.0.0-alpha.43+8b8075f0",
27
- "@midwayjs/koa": "^3.0.0-alpha.43+8b8075f0",
28
- "@midwayjs/mock": "^3.0.0-alpha.43+8b8075f0",
26
+ "@midwayjs/core": "^3.0.0-beta.10",
27
+ "@midwayjs/decorator": "^3.0.0-beta.10",
28
+ "@midwayjs/koa": "^3.0.0-beta.10",
29
+ "@midwayjs/mock": "^3.0.0-beta.10",
29
30
  "@types/request": "^2.48.5"
30
31
  },
31
32
  "dependencies": {
@@ -33,7 +34,7 @@
33
34
  "request": "^2.88.2"
34
35
  },
35
36
  "engines": {
36
- "node": ">= 12.0.0"
37
+ "node": ">=12"
37
38
  },
38
- "gitHead": "8b8075f0d40c5de19bb9026f0950e738ca512c7e"
39
+ "gitHead": "153870f2e2dd6b17673ec7591e49224a6bd51b36"
39
40
  }