@spinajs/metrics 2.0.45 → 2.0.48
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/README.md +11 -11
- package/lib/config/metrics.d.ts +2 -0
- package/lib/config/metrics.d.ts.map +1 -0
- package/lib/config/metrics.js +1 -0
- package/lib/config/metrics.js.map +1 -1
- package/lib/controllers/metrics.d.ts +1 -0
- package/lib/controllers/metrics.d.ts.map +1 -0
- package/lib/controllers/metrics.js +9 -35
- package/lib/controllers/metrics.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +7 -33
- package/lib/index.js.map +1 -1
- package/package.json +51 -48
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
# `@spinajs/intl`
|
|
2
|
-
|
|
3
|
-
> TODO: description
|
|
4
|
-
|
|
5
|
-
## Usage
|
|
6
|
-
|
|
7
|
-
```
|
|
8
|
-
const intl = require('@spinajs/intl');
|
|
9
|
-
|
|
10
|
-
// TODO: DEMONSTRATE API
|
|
11
|
-
```
|
|
1
|
+
# `@spinajs/intl`
|
|
2
|
+
|
|
3
|
+
> TODO: description
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
const intl = require('@spinajs/intl');
|
|
9
|
+
|
|
10
|
+
// TODO: DEMONSTRATE API
|
|
11
|
+
```
|
package/lib/config/metrics.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../../src/config/metrics.ts"],"names":[],"mappings":""}
|
package/lib/config/metrics.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../src/config/metrics.ts"],"names":[],"mappings":"AAAA,iDAAiD
|
|
1
|
+
{"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../src/config/metrics.ts"],"names":[],"mappings":"AAAA,iDAAiD;;AAEjD,qBAAqB;AACrB,YAAY;AACZ,uBAAuB;AACvB,OAAO;AACP,KAAK"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../../src/controllers/metrics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,YAAY,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AAEtC,eAAO,MAAM,KAAK,qBAAe,CAAC;AAClC,eAAO,MAAM,SAAS,yBAAmB,CAAC;AAC1C,eAAO,MAAM,OAAO,uBAAiB,CAAC;AACtC,eAAO,MAAM,OAAO,uBAAiB,CAAC;AACtC,qBACa,mBAAoB,SAAQ,YAAY;IAC5C,SAAS,IAAI,IAAI;CAKzB"}
|
|
@@ -1,42 +1,16 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
1
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
2
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
3
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
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;
|
|
22
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
6
|
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
-
exports.MetricsBootstrapper = exports.counter = exports.summary = exports.histogram = exports.gauge = void 0;
|
|
33
|
-
const di_1 = require("@spinajs/di");
|
|
34
|
-
const client = __importStar(require("prom-client"));
|
|
35
|
-
exports.gauge = client.Gauge;
|
|
36
|
-
exports.histogram = client.Histogram;
|
|
37
|
-
exports.summary = client.Summary;
|
|
38
|
-
exports.counter = client.Counter;
|
|
39
|
-
let MetricsBootstrapper = class MetricsBootstrapper extends di_1.Bootstrapper {
|
|
7
|
+
import { Injectable, Bootstrapper } from '@spinajs/di';
|
|
8
|
+
import * as client from 'prom-client';
|
|
9
|
+
export const gauge = client.Gauge;
|
|
10
|
+
export const histogram = client.Histogram;
|
|
11
|
+
export const summary = client.Summary;
|
|
12
|
+
export const counter = client.Counter;
|
|
13
|
+
let MetricsBootstrapper = class MetricsBootstrapper extends Bootstrapper {
|
|
40
14
|
bootstrap() {
|
|
41
15
|
client.collectDefaultMetrics({
|
|
42
16
|
labels: { NODE_APP_INSTANCE: process.env.NODE_APP_INSTANCE },
|
|
@@ -44,7 +18,7 @@ let MetricsBootstrapper = class MetricsBootstrapper extends di_1.Bootstrapper {
|
|
|
44
18
|
}
|
|
45
19
|
};
|
|
46
20
|
MetricsBootstrapper = __decorate([
|
|
47
|
-
|
|
21
|
+
Injectable(Bootstrapper)
|
|
48
22
|
], MetricsBootstrapper);
|
|
49
|
-
|
|
23
|
+
export { MetricsBootstrapper };
|
|
50
24
|
//# sourceMappingURL=metrics.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../src/controllers/metrics.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../src/controllers/metrics.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AAEtC,MAAM,CAAC,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;AAClC,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;AAC1C,MAAM,CAAC,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;AACtC,MAAM,CAAC,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;AAE/B,IAAM,mBAAmB,GAAzB,MAAM,mBAAoB,SAAQ,YAAY;IAC5C,SAAS;QACd,MAAM,CAAC,qBAAqB,CAAC;YAC3B,MAAM,EAAE,EAAE,iBAAiB,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE;SAC7D,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AANY,mBAAmB;IAD/B,UAAU,CAAC,YAAY,CAAC;GACZ,mBAAmB,CAM/B;SANY,mBAAmB"}
|
package/lib/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,cAAc,EAAO,QAAQ,EAAE,MAAM,eAAe,CAAC;AAExE,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAEnC,cAAM,kBAAmB,SAAQ,QAAQ;;IAK1B,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC,QAAQ;CAIlE;AAED,qBACa,OAAQ,SAAQ,cAAc;IAE5B,UAAU;CAGxB"}
|
package/lib/index.js
CHANGED
|
@@ -1,41 +1,15 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
1
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
2
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
3
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
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;
|
|
22
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
6
|
};
|
|
24
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
25
|
-
if (mod && mod.__esModule) return mod;
|
|
26
|
-
var result = {};
|
|
27
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
28
|
-
__setModuleDefault(result, mod);
|
|
29
|
-
return result;
|
|
30
|
-
};
|
|
31
7
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
32
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
33
9
|
};
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const client = __importStar(require("prom-client"));
|
|
38
|
-
class PrometheusResponse extends http_1.Response {
|
|
10
|
+
import { BasePath, BaseController, Get, Response } from '@spinajs/http';
|
|
11
|
+
import * as client from 'prom-client';
|
|
12
|
+
class PrometheusResponse extends Response {
|
|
39
13
|
constructor() {
|
|
40
14
|
super(null);
|
|
41
15
|
}
|
|
@@ -44,19 +18,19 @@ class PrometheusResponse extends http_1.Response {
|
|
|
44
18
|
res.end(client.register.metrics());
|
|
45
19
|
}
|
|
46
20
|
}
|
|
47
|
-
let Metrics = class Metrics extends
|
|
21
|
+
let Metrics = class Metrics extends BaseController {
|
|
48
22
|
async getMetrics() {
|
|
49
23
|
return new PrometheusResponse();
|
|
50
24
|
}
|
|
51
25
|
};
|
|
52
26
|
__decorate([
|
|
53
|
-
|
|
27
|
+
Get(),
|
|
54
28
|
__metadata("design:type", Function),
|
|
55
29
|
__metadata("design:paramtypes", []),
|
|
56
30
|
__metadata("design:returntype", Promise)
|
|
57
31
|
], Metrics.prototype, "getMetrics", null);
|
|
58
32
|
Metrics = __decorate([
|
|
59
|
-
|
|
33
|
+
BasePath('metrics')
|
|
60
34
|
], Metrics);
|
|
61
|
-
|
|
35
|
+
export { Metrics };
|
|
62
36
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACxE,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;QAC/D,GAAG,CAAC,WAAW,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QAC7C,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;IACrC,CAAC;CACF;AAGM,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,EAAE;;;;yCAGL;AAJU,OAAO;IADnB,QAAQ,CAAC,SAAS,CAAC;GACP,OAAO,CAKnB;SALY,OAAO"}
|
package/package.json
CHANGED
|
@@ -1,48 +1,51 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@spinajs/metrics",
|
|
3
|
-
"version": "2.0.
|
|
4
|
-
"description": "metrics integration for spinajs using prometheus",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"spinajs"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@spinajs/metrics",
|
|
3
|
+
"version": "2.0.48",
|
|
4
|
+
"description": "metrics integration for spinajs using prometheus",
|
|
5
|
+
"exports": "./lib/index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"private": false,
|
|
8
|
+
"engines": {
|
|
9
|
+
"node": ">=16.11"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "npm run clean && npm run compile",
|
|
13
|
+
"compile": "tsc -b tsconfig.json",
|
|
14
|
+
"rimraf": "./node_modules/rimraf/bin.js",
|
|
15
|
+
"clean": "rimraf lib/ && rimraf tsconfig.tsbuildinfo",
|
|
16
|
+
"test": "ts-mocha -p tsconfig.json test/**/*.test.ts",
|
|
17
|
+
"coverage": "nyc npm run test",
|
|
18
|
+
"build-docs": "rimraf docs && typedoc --options typedoc.json src/",
|
|
19
|
+
"format": "prettier --write \"src/**/*.ts\"",
|
|
20
|
+
"lint": "eslint -c .eslintrc.cjs --ext .ts src --fix",
|
|
21
|
+
"preversion": "npm run lint",
|
|
22
|
+
"version": "npm run format && git add -A src",
|
|
23
|
+
"postinstall": "npm run build"
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"lib/**/*"
|
|
27
|
+
],
|
|
28
|
+
"types": "lib",
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "git+https://github.com/spinajs/main.git"
|
|
32
|
+
},
|
|
33
|
+
"keywords": [
|
|
34
|
+
"spinajs",
|
|
35
|
+
"intl"
|
|
36
|
+
],
|
|
37
|
+
"author": "SpinaJS <spinajs@coderush.pl> (https://github.com/spinajs/main)",
|
|
38
|
+
"license": "MIT",
|
|
39
|
+
"bugs": {
|
|
40
|
+
"url": "https://github.com/spinajs/main/issues"
|
|
41
|
+
},
|
|
42
|
+
"homepage": "https://github.com/spinajs/main#readme",
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"@spinajs/di": "^2.0.46",
|
|
45
|
+
"@spinajs/exceptions": "^2.0.39",
|
|
46
|
+
"@spinajs/http": "^2.0.46",
|
|
47
|
+
"express-prom-bundle": "^6.6.0",
|
|
48
|
+
"prom-client": "^14.1.1"
|
|
49
|
+
},
|
|
50
|
+
"gitHead": "b7a2a772723957f74e97698aae2610c22c7c803e"
|
|
51
|
+
}
|