@spinajs/metrics 2.0.180 → 2.0.181
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/lib/cjs/config/metrics.d.ts +29 -29
- package/lib/cjs/config/metrics.js +42 -42
- package/lib/cjs/controllers/metrics.d.ts +14 -14
- package/lib/cjs/controllers/metrics.js +67 -67
- package/lib/cjs/controllers/metrics.js.map +1 -1
- package/lib/cjs/index.d.ts +25 -25
- package/lib/cjs/index.js +105 -105
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/policies/DefaultMetricsPolicy.d.ts +10 -10
- package/lib/cjs/policies/DefaultMetricsPolicy.js +56 -56
- package/lib/cjs/policies/DefaultMetricsPolicy.js.map +1 -1
- package/lib/mjs/config/metrics.d.ts +29 -29
- package/lib/mjs/config/metrics.js +40 -40
- package/lib/mjs/controllers/metrics.d.ts +14 -14
- package/lib/mjs/controllers/metrics.js +41 -41
- package/lib/mjs/controllers/metrics.js.map +1 -1
- package/lib/mjs/index.d.ts +25 -25
- package/lib/mjs/index.js +72 -72
- package/lib/mjs/index.js.map +1 -1
- package/lib/mjs/policies/DefaultMetricsPolicy.d.ts +10 -10
- package/lib/mjs/policies/DefaultMetricsPolicy.js +53 -53
- package/lib/mjs/policies/DefaultMetricsPolicy.js.map +1 -1
- package/lib/tsconfig.cjs.tsbuildinfo +1 -1
- package/lib/tsconfig.mjs.tsbuildinfo +1 -1
- package/package.json +4 -4
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.DefaultMetricsPolicy = void 0;
|
|
13
|
-
const configuration_1 = require("@spinajs/configuration");
|
|
14
|
-
const http_1 = require("@spinajs/http");
|
|
15
|
-
const exceptions_1 = require("@spinajs/exceptions");
|
|
16
|
-
const log_1 = require("@spinajs/log");
|
|
17
|
-
const di_1 = require("@spinajs/di");
|
|
18
|
-
let DefaultMetricsPolicy = class DefaultMetricsPolicy extends http_1.BasePolicy {
|
|
19
|
-
constructor() {
|
|
20
|
-
super(...arguments);
|
|
21
|
-
this.HEADER_TOKEN_FIELD = 'x-metrics-token';
|
|
22
|
-
}
|
|
23
|
-
isEnabled(_action, _instance) {
|
|
24
|
-
return true;
|
|
25
|
-
}
|
|
26
|
-
async execute(req) {
|
|
27
|
-
if (this.isDev) {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
const token = req.headers[this.HEADER_TOKEN_FIELD];
|
|
31
|
-
if (!token) {
|
|
32
|
-
this.Log.warn(`No token is set for restricted area, header field: ${this.HEADER_TOKEN_FIELD}, policy: DefaultMetricsPolicy, ip: ${req.storage.realIp}`);
|
|
33
|
-
throw new exceptions_1.Forbidden('access token is not set');
|
|
34
|
-
}
|
|
35
|
-
if (token !== this.Token) {
|
|
36
|
-
this.Log.warn(`Invalid access token received, token: ${token}, header field: ${this.HEADER_TOKEN_FIELD}, policy: DefaultMetricsPolicy, ip: ${req.storage.realIp}`);
|
|
37
|
-
throw new exceptions_1.Forbidden('invalid access token');
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
DefaultMetricsPolicy
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.DefaultMetricsPolicy = void 0;
|
|
13
|
+
const configuration_1 = require("@spinajs/configuration");
|
|
14
|
+
const http_1 = require("@spinajs/http");
|
|
15
|
+
const exceptions_1 = require("@spinajs/exceptions");
|
|
16
|
+
const log_1 = require("@spinajs/log");
|
|
17
|
+
const di_1 = require("@spinajs/di");
|
|
18
|
+
let DefaultMetricsPolicy = class DefaultMetricsPolicy extends http_1.BasePolicy {
|
|
19
|
+
constructor() {
|
|
20
|
+
super(...arguments);
|
|
21
|
+
this.HEADER_TOKEN_FIELD = 'x-metrics-token';
|
|
22
|
+
}
|
|
23
|
+
isEnabled(_action, _instance) {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
async execute(req) {
|
|
27
|
+
if (this.isDev) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const token = req.headers[this.HEADER_TOKEN_FIELD];
|
|
31
|
+
if (!token) {
|
|
32
|
+
this.Log.warn(`No token is set for restricted area, header field: ${this.HEADER_TOKEN_FIELD}, policy: DefaultMetricsPolicy, ip: ${req.storage.realIp}`);
|
|
33
|
+
throw new exceptions_1.Forbidden('access token is not set');
|
|
34
|
+
}
|
|
35
|
+
if (token !== this.Token) {
|
|
36
|
+
this.Log.warn(`Invalid access token received, token: ${token}, header field: ${this.HEADER_TOKEN_FIELD}, policy: DefaultMetricsPolicy, ip: ${req.storage.realIp}`);
|
|
37
|
+
throw new exceptions_1.Forbidden('invalid access token');
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
exports.DefaultMetricsPolicy = DefaultMetricsPolicy;
|
|
42
|
+
__decorate([
|
|
43
|
+
(0, log_1.Logger)('Security'),
|
|
44
|
+
__metadata("design:type", log_1.Log)
|
|
45
|
+
], DefaultMetricsPolicy.prototype, "Log", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
(0, configuration_1.Config)('metrics.auth.token'),
|
|
48
|
+
__metadata("design:type", String)
|
|
49
|
+
], DefaultMetricsPolicy.prototype, "Token", void 0);
|
|
50
|
+
__decorate([
|
|
51
|
+
(0, configuration_1.Config)('configuration.isDevelopment'),
|
|
52
|
+
__metadata("design:type", Boolean)
|
|
53
|
+
], DefaultMetricsPolicy.prototype, "isDev", void 0);
|
|
54
|
+
exports.DefaultMetricsPolicy = DefaultMetricsPolicy = __decorate([
|
|
55
|
+
(0, di_1.Injectable)(http_1.BasePolicy)
|
|
56
|
+
], DefaultMetricsPolicy);
|
|
57
57
|
//# sourceMappingURL=DefaultMetricsPolicy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultMetricsPolicy.js","sourceRoot":"","sources":["../../../src/policies/DefaultMetricsPolicy.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0DAAgD;AAChD,wC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sB;QACtD,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,GAAY;QAC/B,IAAI,IAAI,CAAC,KAAK,EAAE;YACd,OAAO;SACR;QAED,MAAM,KAAK,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;QACnD,IAAI,CAAC,KAAK,EAAE;YACV,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,sDAAsD,IAAI,CAAC,kBAAkB,uCAAuC,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;YACxJ,MAAM,IAAI,sBAAS,CAAC,yBAAyB,CAAC,CAAC;SAChD;QAED,IAAI,KAAK,KAAK,IAAI,CAAC,KAAK,EAAE;YACxB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,yCAAyC,KAAK,mBAAmB,IAAI,CAAC,kBAAkB,uCAAuC,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;YACnK,MAAM,IAAI,sBAAS,CAAC,sBAAsB,CAAC,CAAC;SAC7C;IACH,CAAC;CACF,CAAA;AAjCY,oDAAoB;AAErB;IADT,IAAA,YAAM,EAAC,UAAU,CAAC;8BACJ,SAAG;iDAAC;AAGT;IADT,IAAA,sBAAM,EAAC,oBAAoB,CAAC;;mDACL;AAKd;IADT,IAAA,sBAAM,EAAC,6BAA6B,CAAC;;mDACb;+BAVd,oBAAoB;IADhC,IAAA,eAAU,EAAC,iBAAU,CAAC;GACV,oBAAoB,CAiChC"}
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* Configuraiton for prom metrics bundle for express
|
|
4
|
-
* https://github.com/jochen-schweizer/express-prom-bundle
|
|
5
|
-
*
|
|
6
|
-
*/
|
|
7
|
-
declare const config: {
|
|
8
|
-
system: {
|
|
9
|
-
dirs: {
|
|
10
|
-
controllers: string[];
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
metrics: {
|
|
14
|
-
auth: {
|
|
15
|
-
token: string;
|
|
16
|
-
policy: string;
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* * Configuraiton for prom metrics bundle for express
|
|
20
|
-
* https://github.com/jochen-schweizer/express-prom-bundle
|
|
21
|
-
*/
|
|
22
|
-
http: {
|
|
23
|
-
includeStatusCode: boolean;
|
|
24
|
-
includeMethod: boolean;
|
|
25
|
-
includePath: boolean;
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
export default config;
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* Configuraiton for prom metrics bundle for express
|
|
4
|
+
* https://github.com/jochen-schweizer/express-prom-bundle
|
|
5
|
+
*
|
|
6
|
+
*/
|
|
7
|
+
declare const config: {
|
|
8
|
+
system: {
|
|
9
|
+
dirs: {
|
|
10
|
+
controllers: string[];
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
metrics: {
|
|
14
|
+
auth: {
|
|
15
|
+
token: string;
|
|
16
|
+
policy: string;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* * Configuraiton for prom metrics bundle for express
|
|
20
|
+
* https://github.com/jochen-schweizer/express-prom-bundle
|
|
21
|
+
*/
|
|
22
|
+
http: {
|
|
23
|
+
includeStatusCode: boolean;
|
|
24
|
+
includeMethod: boolean;
|
|
25
|
+
includePath: boolean;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export default config;
|
|
30
30
|
//# sourceMappingURL=metrics.d.ts.map
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import { join, normalize, resolve } from 'path';
|
|
2
|
-
function dir(path) {
|
|
3
|
-
const inCommonJs = typeof module !== 'undefined';
|
|
4
|
-
return resolve(normalize(join(process.cwd(), 'node_modules', '@spinajs', 'metrics', 'lib', inCommonJs ? 'cjs' : 'mjs', path)));
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
*
|
|
8
|
-
* Configuraiton for prom metrics bundle for express
|
|
9
|
-
* https://github.com/jochen-schweizer/express-prom-bundle
|
|
10
|
-
*
|
|
11
|
-
*/
|
|
12
|
-
const config = {
|
|
13
|
-
system: {
|
|
14
|
-
dirs: {
|
|
15
|
-
controllers: [dir('controllers')],
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
metrics: {
|
|
19
|
-
auth: {
|
|
20
|
-
// set this in your project
|
|
21
|
-
token: '',
|
|
22
|
-
policy: 'DefaultMetricsPolicy',
|
|
23
|
-
},
|
|
24
|
-
/**
|
|
25
|
-
* * Configuraiton for prom metrics bundle for express
|
|
26
|
-
* https://github.com/jochen-schweizer/express-prom-bundle
|
|
27
|
-
*/
|
|
28
|
-
http: {
|
|
29
|
-
includeStatusCode: true,
|
|
30
|
-
includeMethod: true,
|
|
31
|
-
includePath: true,
|
|
32
|
-
// customLabels: "spinajs",
|
|
33
|
-
// includeUp: true,
|
|
34
|
-
// metricsPath: "/metrics",
|
|
35
|
-
// metricType: "histogram",
|
|
36
|
-
// httpDurationMetricName: 60
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
};
|
|
40
|
-
export default config;
|
|
1
|
+
import { join, normalize, resolve } from 'path';
|
|
2
|
+
function dir(path) {
|
|
3
|
+
const inCommonJs = typeof module !== 'undefined';
|
|
4
|
+
return resolve(normalize(join(process.cwd(), 'node_modules', '@spinajs', 'metrics', 'lib', inCommonJs ? 'cjs' : 'mjs', path)));
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
* Configuraiton for prom metrics bundle for express
|
|
9
|
+
* https://github.com/jochen-schweizer/express-prom-bundle
|
|
10
|
+
*
|
|
11
|
+
*/
|
|
12
|
+
const config = {
|
|
13
|
+
system: {
|
|
14
|
+
dirs: {
|
|
15
|
+
controllers: [dir('controllers')],
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
metrics: {
|
|
19
|
+
auth: {
|
|
20
|
+
// set this in your project
|
|
21
|
+
token: '',
|
|
22
|
+
policy: 'DefaultMetricsPolicy',
|
|
23
|
+
},
|
|
24
|
+
/**
|
|
25
|
+
* * Configuraiton for prom metrics bundle for express
|
|
26
|
+
* https://github.com/jochen-schweizer/express-prom-bundle
|
|
27
|
+
*/
|
|
28
|
+
http: {
|
|
29
|
+
includeStatusCode: true,
|
|
30
|
+
includeMethod: true,
|
|
31
|
+
includePath: true,
|
|
32
|
+
// customLabels: "spinajs",
|
|
33
|
+
// includeUp: true,
|
|
34
|
+
// metricsPath: "/metrics",
|
|
35
|
+
// metricType: "histogram",
|
|
36
|
+
// httpDurationMetricName: 60
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
export default config;
|
|
41
41
|
//# sourceMappingURL=metrics.js.map
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { BaseController, Response } from '@spinajs/http';
|
|
2
|
-
import * as express from 'express';
|
|
3
|
-
declare class PrometheusResponse extends Response {
|
|
4
|
-
constructor();
|
|
5
|
-
execute(_req: express.Request, res: express.Response): Promise<void>;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Default controller for serving
|
|
9
|
-
* metrics data. Can be protected by access policy from configuration file
|
|
10
|
-
*/
|
|
11
|
-
export declare class Metrics extends BaseController {
|
|
12
|
-
getMetrics(): Promise<PrometheusResponse>;
|
|
13
|
-
}
|
|
14
|
-
export {};
|
|
1
|
+
import { BaseController, Response } from '@spinajs/http';
|
|
2
|
+
import * as express from 'express';
|
|
3
|
+
declare class PrometheusResponse extends Response {
|
|
4
|
+
constructor();
|
|
5
|
+
execute(_req: express.Request, res: express.Response): Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Default controller for serving
|
|
9
|
+
* metrics data. Can be protected by access policy from configuration file
|
|
10
|
+
*/
|
|
11
|
+
export declare class Metrics extends BaseController {
|
|
12
|
+
getMetrics(): Promise<PrometheusResponse>;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
15
15
|
//# sourceMappingURL=metrics.d.ts.map
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
-
};
|
|
10
|
-
import { BasePath, BaseController, Get, Response, Policy } from '@spinajs/http';
|
|
11
|
-
import * as client from 'prom-client';
|
|
12
|
-
class PrometheusResponse extends Response {
|
|
13
|
-
constructor() {
|
|
14
|
-
super(null);
|
|
15
|
-
}
|
|
16
|
-
async execute(_req, res) {
|
|
17
|
-
const result = await client.register.metrics();
|
|
18
|
-
res.contentType(client.register.contentType);
|
|
19
|
-
res.end(result);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Default controller for serving
|
|
24
|
-
* metrics data. Can be protected by access policy from configuration file
|
|
25
|
-
*/
|
|
26
|
-
let Metrics = class Metrics extends BaseController {
|
|
27
|
-
async getMetrics() {
|
|
28
|
-
return new PrometheusResponse();
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
__decorate([
|
|
32
|
-
Get('/'),
|
|
33
|
-
__metadata("design:type", Function),
|
|
34
|
-
__metadata("design:paramtypes", []),
|
|
35
|
-
__metadata("design:returntype", Promise)
|
|
36
|
-
], Metrics.prototype, "getMetrics", null);
|
|
37
|
-
Metrics = __decorate([
|
|
38
|
-
BasePath('metrics'),
|
|
39
|
-
Policy('metrics.auth.policy')
|
|
40
|
-
], Metrics);
|
|
41
|
-
export { Metrics };
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { BasePath, BaseController, Get, Response, Policy } from '@spinajs/http';
|
|
11
|
+
import * as client from 'prom-client';
|
|
12
|
+
class PrometheusResponse extends Response {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(null);
|
|
15
|
+
}
|
|
16
|
+
async execute(_req, res) {
|
|
17
|
+
const result = await client.register.metrics();
|
|
18
|
+
res.contentType(client.register.contentType);
|
|
19
|
+
res.end(result);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Default controller for serving
|
|
24
|
+
* metrics data. Can be protected by access policy from configuration file
|
|
25
|
+
*/
|
|
26
|
+
let Metrics = class Metrics extends BaseController {
|
|
27
|
+
async getMetrics() {
|
|
28
|
+
return new PrometheusResponse();
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
__decorate([
|
|
32
|
+
Get('/'),
|
|
33
|
+
__metadata("design:type", Function),
|
|
34
|
+
__metadata("design:paramtypes", []),
|
|
35
|
+
__metadata("design:returntype", Promise)
|
|
36
|
+
], Metrics.prototype, "getMetrics", null);
|
|
37
|
+
Metrics = __decorate([
|
|
38
|
+
BasePath('metrics'),
|
|
39
|
+
Policy('metrics.auth.policy')
|
|
40
|
+
], Metrics);
|
|
41
|
+
export { Metrics };
|
|
42
42
|
//# sourceMappingURL=metrics.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../../src/controllers/metrics.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAChF,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AAGtC,MAAM,kBAAmB,SAAQ,QAAQ;IACvC;QACE,KAAK,CAAC,IAAI,CAAC,CAAC;IACd,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,IAAqB,EAAE,GAAqB;QAE/D,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;QAE/C,GAAG,CAAC,WAAW,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QAC7C,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAClB,CAAC;CACF;AAED;;;GAGG;AAGI,IAAM,OAAO,GAAb,MAAM,OAAQ,SAAQ,cAAc;IAE5B,AAAN,KAAK,CAAC,UAAU;QACrB,OAAO,IAAI,kBAAkB,EAAE,CAAC;IAClC,CAAC;CACF,CAAA;AAHc;IADZ,GAAG,CAAC,GAAG,CAAC;;;;yCAGR;AAJU,OAAO;IAFnB,QAAQ,CAAC,SAAS,CAAC;IACnB,MAAM,CAAC,qBAAqB,CAAC;GACjB,OAAO,CAKnB
|
|
1
|
+
{"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../../src/controllers/metrics.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAChF,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AAGtC,MAAM,kBAAmB,SAAQ,QAAQ;IACvC;QACE,KAAK,CAAC,IAAI,CAAC,CAAC;IACd,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,IAAqB,EAAE,GAAqB;QAE/D,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;QAE/C,GAAG,CAAC,WAAW,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QAC7C,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAClB,CAAC;CACF;AAED;;;GAGG;AAGI,IAAM,OAAO,GAAb,MAAM,OAAQ,SAAQ,cAAc;IAE5B,AAAN,KAAK,CAAC,UAAU;QACrB,OAAO,IAAI,kBAAkB,EAAE,CAAC;IAClC,CAAC;CACF,CAAA;AAHc;IADZ,GAAG,CAAC,GAAG,CAAC;;;;yCAGR;AAJU,OAAO;IAFnB,QAAQ,CAAC,SAAS,CAAC;IACnB,MAAM,CAAC,qBAAqB,CAAC;GACjB,OAAO,CAKnB"}
|
package/lib/mjs/index.d.ts
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { Bootstrapper } from '@spinajs/di';
|
|
2
|
-
import * as client from 'prom-client';
|
|
3
|
-
export * from "./policies/DefaultMetricsPolicy.js";
|
|
4
|
-
export * from "./controllers/metrics.js";
|
|
5
|
-
export declare const Gauge: typeof client.Gauge;
|
|
6
|
-
export declare const Histogram: typeof client.Histogram;
|
|
7
|
-
export declare const Summary: typeof client.Summary;
|
|
8
|
-
export declare const Counter: typeof client.Counter;
|
|
9
|
-
export declare class MetricsBootstrapper extends Bootstrapper {
|
|
10
|
-
bootstrap(): void;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Simple wrapper class for handling prom metrics
|
|
14
|
-
*/
|
|
15
|
-
export declare class Metrics {
|
|
16
|
-
protected _histograms: Map<string, client.Histogram>;
|
|
17
|
-
protected _gauges: Map<string, client.Gauge>;
|
|
18
|
-
protected _counters: Map<string, client.Counter>;
|
|
19
|
-
protected _summaries: Map<string, client.Summary>;
|
|
20
|
-
constructor();
|
|
21
|
-
histogram<T extends string>(name: string, configuration: client.HistogramConfiguration<T>): client.Histogram<string>;
|
|
22
|
-
gauge<T extends string>(name: string, configuration: client.GaugeConfiguration<T>): client.Gauge<string>;
|
|
23
|
-
counter<T extends string>(name: string, configuration: client.CounterConfiguration<T>): client.Counter<string>;
|
|
24
|
-
summary<T extends string>(name: string, configuration: client.SummaryConfiguration<T>): client.Summary<string>;
|
|
25
|
-
}
|
|
1
|
+
import { Bootstrapper } from '@spinajs/di';
|
|
2
|
+
import * as client from 'prom-client';
|
|
3
|
+
export * from "./policies/DefaultMetricsPolicy.js";
|
|
4
|
+
export * from "./controllers/metrics.js";
|
|
5
|
+
export declare const Gauge: typeof client.Gauge;
|
|
6
|
+
export declare const Histogram: typeof client.Histogram;
|
|
7
|
+
export declare const Summary: typeof client.Summary;
|
|
8
|
+
export declare const Counter: typeof client.Counter;
|
|
9
|
+
export declare class MetricsBootstrapper extends Bootstrapper {
|
|
10
|
+
bootstrap(): void;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Simple wrapper class for handling prom metrics
|
|
14
|
+
*/
|
|
15
|
+
export declare class Metrics {
|
|
16
|
+
protected _histograms: Map<string, client.Histogram>;
|
|
17
|
+
protected _gauges: Map<string, client.Gauge>;
|
|
18
|
+
protected _counters: Map<string, client.Counter>;
|
|
19
|
+
protected _summaries: Map<string, client.Summary>;
|
|
20
|
+
constructor();
|
|
21
|
+
histogram<T extends string>(name: string, configuration: client.HistogramConfiguration<T>): client.Histogram<string>;
|
|
22
|
+
gauge<T extends string>(name: string, configuration: client.GaugeConfiguration<T>): client.Gauge<string>;
|
|
23
|
+
counter<T extends string>(name: string, configuration: client.CounterConfiguration<T>): client.Counter<string>;
|
|
24
|
+
summary<T extends string>(name: string, configuration: client.SummaryConfiguration<T>): client.Summary<string>;
|
|
25
|
+
}
|
|
26
26
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/mjs/index.js
CHANGED
|
@@ -1,73 +1,73 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { Injectable, Bootstrapper, DI } from '@spinajs/di';
|
|
8
|
-
import * as client from 'prom-client';
|
|
9
|
-
import { default as promHttpBundle } from 'express-prom-bundle';
|
|
10
|
-
import { Configuration } from '@spinajs/configuration';
|
|
11
|
-
export * from "./policies/DefaultMetricsPolicy.js";
|
|
12
|
-
export * from "./controllers/metrics.js";
|
|
13
|
-
export const Gauge = client.Gauge;
|
|
14
|
-
export const Histogram = client.Histogram;
|
|
15
|
-
export const Summary = client.Summary;
|
|
16
|
-
export const Counter = client.Counter;
|
|
17
|
-
let MetricsBootstrapper = class MetricsBootstrapper extends Bootstrapper {
|
|
18
|
-
bootstrap() {
|
|
19
|
-
client.collectDefaultMetrics({
|
|
20
|
-
labels: { NODE_APP_INSTANCE: process.env.NODE_APP_INSTANCE },
|
|
21
|
-
});
|
|
22
|
-
DI.on('di.resolved.HttpServer', (_, server) => {
|
|
23
|
-
const cfg = _.get(Configuration);
|
|
24
|
-
const promCfg = cfg.get('metrics.http');
|
|
25
|
-
server.use(promHttpBundle({
|
|
26
|
-
...promCfg,
|
|
27
|
-
// disable default autoregister
|
|
28
|
-
// we do this by controller with proper auth handling
|
|
29
|
-
autoregister: false,
|
|
30
|
-
}));
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
MetricsBootstrapper = __decorate([
|
|
35
|
-
Injectable(Bootstrapper)
|
|
36
|
-
], MetricsBootstrapper);
|
|
37
|
-
export { MetricsBootstrapper };
|
|
38
|
-
/**
|
|
39
|
-
* Simple wrapper class for handling prom metrics
|
|
40
|
-
*/
|
|
41
|
-
export class Metrics {
|
|
42
|
-
constructor() {
|
|
43
|
-
this._histograms = new Map();
|
|
44
|
-
this._gauges = new Map();
|
|
45
|
-
this._counters = new Map();
|
|
46
|
-
this._summaries = new Map();
|
|
47
|
-
}
|
|
48
|
-
histogram(name, configuration) {
|
|
49
|
-
if (!this._histograms.has(name)) {
|
|
50
|
-
this._histograms.set(name, new client.Histogram(configuration));
|
|
51
|
-
}
|
|
52
|
-
return this._histograms.get(name);
|
|
53
|
-
}
|
|
54
|
-
gauge(name, configuration) {
|
|
55
|
-
if (!this._gauges.has(name)) {
|
|
56
|
-
this._gauges.set(name, new client.Gauge(configuration));
|
|
57
|
-
}
|
|
58
|
-
return this._gauges.get(name);
|
|
59
|
-
}
|
|
60
|
-
counter(name, configuration) {
|
|
61
|
-
if (!this._counters.has(name)) {
|
|
62
|
-
this._counters.set(name, new client.Gauge(configuration));
|
|
63
|
-
}
|
|
64
|
-
return this._counters.get(name);
|
|
65
|
-
}
|
|
66
|
-
summary(name, configuration) {
|
|
67
|
-
if (!this._summaries.has(name)) {
|
|
68
|
-
this._summaries.set(name, new client.Summary(configuration));
|
|
69
|
-
}
|
|
70
|
-
return this._summaries.get(name);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { Injectable, Bootstrapper, DI } from '@spinajs/di';
|
|
8
|
+
import * as client from 'prom-client';
|
|
9
|
+
import { default as promHttpBundle } from 'express-prom-bundle';
|
|
10
|
+
import { Configuration } from '@spinajs/configuration';
|
|
11
|
+
export * from "./policies/DefaultMetricsPolicy.js";
|
|
12
|
+
export * from "./controllers/metrics.js";
|
|
13
|
+
export const Gauge = client.Gauge;
|
|
14
|
+
export const Histogram = client.Histogram;
|
|
15
|
+
export const Summary = client.Summary;
|
|
16
|
+
export const Counter = client.Counter;
|
|
17
|
+
let MetricsBootstrapper = class MetricsBootstrapper extends Bootstrapper {
|
|
18
|
+
bootstrap() {
|
|
19
|
+
client.collectDefaultMetrics({
|
|
20
|
+
labels: { NODE_APP_INSTANCE: process.env.NODE_APP_INSTANCE },
|
|
21
|
+
});
|
|
22
|
+
DI.on('di.resolved.HttpServer', (_, server) => {
|
|
23
|
+
const cfg = _.get(Configuration);
|
|
24
|
+
const promCfg = cfg.get('metrics.http');
|
|
25
|
+
server.use(promHttpBundle({
|
|
26
|
+
...promCfg,
|
|
27
|
+
// disable default autoregister
|
|
28
|
+
// we do this by controller with proper auth handling
|
|
29
|
+
autoregister: false,
|
|
30
|
+
}));
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
MetricsBootstrapper = __decorate([
|
|
35
|
+
Injectable(Bootstrapper)
|
|
36
|
+
], MetricsBootstrapper);
|
|
37
|
+
export { MetricsBootstrapper };
|
|
38
|
+
/**
|
|
39
|
+
* Simple wrapper class for handling prom metrics
|
|
40
|
+
*/
|
|
41
|
+
export class Metrics {
|
|
42
|
+
constructor() {
|
|
43
|
+
this._histograms = new Map();
|
|
44
|
+
this._gauges = new Map();
|
|
45
|
+
this._counters = new Map();
|
|
46
|
+
this._summaries = new Map();
|
|
47
|
+
}
|
|
48
|
+
histogram(name, configuration) {
|
|
49
|
+
if (!this._histograms.has(name)) {
|
|
50
|
+
this._histograms.set(name, new client.Histogram(configuration));
|
|
51
|
+
}
|
|
52
|
+
return this._histograms.get(name);
|
|
53
|
+
}
|
|
54
|
+
gauge(name, configuration) {
|
|
55
|
+
if (!this._gauges.has(name)) {
|
|
56
|
+
this._gauges.set(name, new client.Gauge(configuration));
|
|
57
|
+
}
|
|
58
|
+
return this._gauges.get(name);
|
|
59
|
+
}
|
|
60
|
+
counter(name, configuration) {
|
|
61
|
+
if (!this._counters.has(name)) {
|
|
62
|
+
this._counters.set(name, new client.Gauge(configuration));
|
|
63
|
+
}
|
|
64
|
+
return this._counters.get(name);
|
|
65
|
+
}
|
|
66
|
+
summary(name, configuration) {
|
|
67
|
+
if (!this._summaries.has(name)) {
|
|
68
|
+
this._summaries.set(name, new client.Summary(configuration));
|
|
69
|
+
}
|
|
70
|
+
return this._summaries.get(name);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
73
|
//# sourceMappingURL=index.js.map
|
package/lib/mjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,EAAE,EAAc,MAAM,aAAa,CAAC;AAEvE,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,cAAc,oCAAoC,CAAC;AACnD,cAAc,0BAA0B,CAAC;AAEzC,MAAM,CAAC,MAAM,KA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BasePolicy, IController, IRoute, Request } from '@spinajs/http';
|
|
2
|
-
import { Log } from '@spinajs/log';
|
|
3
|
-
export declare class DefaultMetricsPolicy extends BasePolicy {
|
|
4
|
-
protected Log: Log;
|
|
5
|
-
protected Token: string;
|
|
6
|
-
protected HEADER_TOKEN_FIELD: string;
|
|
7
|
-
protected isDev: boolean;
|
|
8
|
-
isEnabled(_action: IRoute, _instance: IController): boolean;
|
|
9
|
-
execute(req: Request): Promise<void>;
|
|
10
|
-
}
|
|
1
|
+
import { BasePolicy, IController, IRoute, Request } from '@spinajs/http';
|
|
2
|
+
import { Log } from '@spinajs/log';
|
|
3
|
+
export declare class DefaultMetricsPolicy extends BasePolicy {
|
|
4
|
+
protected Log: Log;
|
|
5
|
+
protected Token: string;
|
|
6
|
+
protected HEADER_TOKEN_FIELD: string;
|
|
7
|
+
protected isDev: boolean;
|
|
8
|
+
isEnabled(_action: IRoute, _instance: IController): boolean;
|
|
9
|
+
execute(req: Request): Promise<void>;
|
|
10
|
+
}
|
|
11
11
|
//# sourceMappingURL=DefaultMetricsPolicy.d.ts.map
|