@rsdk/core 1.0.9 → 1.0.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 +6 -0
- package/dist/app/platform.app.d.ts +2 -1
- package/dist/app/platform.app.js.map +1 -1
- package/dist/config/config.const.d.ts +13 -0
- package/dist/config/config.const.js +17 -0
- package/dist/config/config.const.js.map +1 -0
- package/dist/config/metadata/decorators/config-section.decorator.d.ts +4 -0
- package/dist/config/metadata/decorators/config-section.decorator.js.map +1 -1
- package/dist/config/types.d.ts +3 -1
- package/dist/exceptions.handling/global-exceptions.config.js +4 -1
- package/dist/exceptions.handling/global-exceptions.config.js.map +1 -1
- package/dist/health/autodoc/heath.autodoc-resolver.d.ts +16 -0
- package/dist/health/autodoc/heath.autodoc-resolver.js +24 -0
- package/dist/health/autodoc/heath.autodoc-resolver.js.map +1 -0
- package/dist/health/health.service.d.ts +2 -1
- package/dist/health/health.service.js.map +1 -1
- package/dist/health/index.d.ts +1 -0
- package/dist/health/index.js +3 -0
- package/dist/health/index.js.map +1 -1
- package/dist/health/metadata/indicator.decorator.d.ts +16 -0
- package/dist/health/metadata/indicator.decorator.js +21 -0
- package/dist/health/metadata/indicator.decorator.js.map +1 -1
- package/dist/health/metadata/indicators.registry.js +0 -3
- package/dist/health/metadata/indicators.registry.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/logging/logging.config.js +4 -1
- package/dist/logging/logging.config.js.map +1 -1
- package/dist/metrics/index.d.ts +2 -0
- package/dist/metrics/index.js +3 -1
- package/dist/metrics/index.js.map +1 -1
- package/dist/metrics/metadata/autodoc/metrics.autodoc-resolver.d.ts +8 -0
- package/dist/metrics/metadata/autodoc/metrics.autodoc-resolver.js +26 -0
- package/dist/metrics/metadata/autodoc/metrics.autodoc-resolver.js.map +1 -0
- package/dist/metrics/metadata/decorators/metric.decorator.d.ts +12 -5
- package/dist/metrics/metadata/decorators/metric.decorator.js.map +1 -1
- package/dist/metrics/metadata/index.d.ts +2 -0
- package/dist/metrics/metadata/index.js +3 -0
- package/dist/metrics/metadata/index.js.map +1 -1
- package/dist/metrics/metadata/types.d.ts +8 -0
- package/dist/metrics/metadata/types.js +3 -0
- package/dist/metrics/metadata/types.js.map +1 -0
- package/dist/metrics/metrics.config.js +5 -1
- package/dist/metrics/metrics.config.js.map +1 -1
- package/dist/metrics/metrics.module.js +15 -3
- package/dist/metrics/metrics.module.js.map +1 -1
- package/dist/platform.context.d.ts +5 -3
- package/dist/platform.context.js +31 -14
- package/dist/platform.context.js.map +1 -1
- package/dist/tracing/tracing.config.js +4 -1
- package/dist/tracing/tracing.config.js.map +1 -1
- package/dist/types/metadata.d.ts +7 -1
- package/dist/types/metadata.js.map +1 -1
- package/dist/types/options.d.ts +3 -1
- package/package.json +20 -18
- package/src/app/platform.app.ts +1 -1
- package/src/config/config.const.ts +13 -0
- package/src/config/metadata/decorators/config-section.decorator.ts +4 -0
- package/src/config/types.ts +3 -1
- package/src/exceptions.handling/global-exceptions.config.ts +4 -1
- package/src/health/autodoc/heath.autodoc-resolver.ts +33 -0
- package/src/health/health.service.ts +2 -1
- package/src/health/index.ts +1 -0
- package/src/health/metadata/indicator.decorator.ts +34 -0
- package/src/health/metadata/indicators.registry.ts +0 -4
- package/src/index.ts +2 -0
- package/src/logging/logging.config.ts +4 -1
- package/src/metrics/index.ts +2 -0
- package/src/metrics/metadata/autodoc/metrics.autodoc-resolver.ts +30 -0
- package/src/metrics/metadata/decorators/metric.decorator.ts +14 -6
- package/src/metrics/metadata/index.ts +3 -0
- package/src/metrics/metadata/types.ts +11 -0
- package/src/metrics/metrics.config.ts +5 -1
- package/src/metrics/metrics.module.ts +23 -2
- package/src/platform.context.ts +40 -21
- package/src/tracing/tracing.config.ts +4 -1
- package/src/types/metadata.ts +8 -1
- package/src/types/options.ts +3 -1
- package/tsconfig.json +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
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
|
+
## 1.0.10 (2023-05-22)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* add PPM_CI variable to workflow ([5e5c129](https://github.com/R-Vision/rsdk/commit/5e5c129a5e551fc57bf7da8a70cb14cf918e360e))
|
|
11
|
+
|
|
6
12
|
## 1.0.9 (2023-05-21)
|
|
7
13
|
|
|
8
14
|
**Note:** Version bump only for package @rsdk/core
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PlatformContext } from '../platform.context';
|
|
1
2
|
import type { PlatformAppMetadata, PlatformAppOptions } from '../types';
|
|
2
3
|
/**
|
|
3
4
|
* Platform application itself.
|
|
@@ -8,7 +9,7 @@ import type { PlatformAppMetadata, PlatformAppOptions } from '../types';
|
|
|
8
9
|
export declare class PlatformApp {
|
|
9
10
|
readonly platformAppOptions: PlatformAppOptions;
|
|
10
11
|
private static logger;
|
|
11
|
-
|
|
12
|
+
readonly context: PlatformContext;
|
|
12
13
|
constructor(platformAppOptions: PlatformAppOptions);
|
|
13
14
|
/**
|
|
14
15
|
* Get all important information about PlatformApp instance
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform.app.js","sourceRoot":"","sources":["../../src/app/platform.app.ts"],"names":[],"mappings":";;;AACA,uCAA2C;AAC3C,yCAAoC;AACpC,2CAA8C;AAE9C,0DAAsD;AAGtD;;;;;GAKG;AACH,MAAa,WAAW;IAiCD;IAhCb,MAAM,CAAC,MAAM,GAAG,uBAAa,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"platform.app.js","sourceRoot":"","sources":["../../src/app/platform.app.ts"],"names":[],"mappings":";;;AACA,uCAA2C;AAC3C,yCAAoC;AACpC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,EAAE,CAAC;QAC1D,MAAM,GAAG,GAAG,MAAM,kBAAW,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,WAAW,CAAC,CAAC;QAEnE,MAAM,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;QAChC,OAAO,GAAG,CAAC;IACb,CAAC;;AApEH,kCAqEC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const ConfigTag: {
|
|
2
|
+
readonly infrastructure: "infrastructure";
|
|
3
|
+
readonly logging: "logging";
|
|
4
|
+
readonly errorHandling: "error-handling";
|
|
5
|
+
readonly metric: "metric";
|
|
6
|
+
readonly tracing: "tracing";
|
|
7
|
+
readonly storage: "storage";
|
|
8
|
+
readonly transport: "transport";
|
|
9
|
+
readonly graphql: "graphql";
|
|
10
|
+
readonly http: "http";
|
|
11
|
+
readonly grpcServer: "grpc-server";
|
|
12
|
+
readonly natsHemera: "nats-hemera";
|
|
13
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConfigTag = void 0;
|
|
4
|
+
exports.ConfigTag = {
|
|
5
|
+
infrastructure: 'infrastructure',
|
|
6
|
+
logging: 'logging',
|
|
7
|
+
errorHandling: 'error-handling',
|
|
8
|
+
metric: 'metric',
|
|
9
|
+
tracing: 'tracing',
|
|
10
|
+
storage: 'storage',
|
|
11
|
+
transport: 'transport',
|
|
12
|
+
graphql: 'graphql',
|
|
13
|
+
http: 'http',
|
|
14
|
+
grpcServer: 'grpc-server',
|
|
15
|
+
natsHemera: 'nats-hemera',
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=config.const.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.const.js","sourceRoot":"","sources":["../../src/config/config.const.ts"],"names":[],"mappings":";;;AAAa,QAAA,SAAS,GAAG;IACvB,cAAc,EAAE,gBAAgB;IAChC,OAAO,EAAE,SAAS;IAClB,aAAa,EAAE,gBAAgB;IAC/B,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,SAAS,EAAE,WAAW;IACtB,OAAO,EAAE,SAAS;IAClB,IAAI,EAAE,MAAM;IACZ,UAAU,EAAE,aAAa;IACzB,UAAU,EAAE,aAAa;CACjB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-section.decorator.js","sourceRoot":"","sources":["../../../../src/config/metadata/decorators/config-section.decorator.ts"],"names":[],"mappings":";;;AAIA,0EAAqE;AAErE,6DAA2D;
|
|
1
|
+
{"version":3,"file":"config-section.decorator.js","sourceRoot":"","sources":["../../../../src/config/metadata/decorators/config-section.decorator.ts"],"names":[],"mappings":";;;AAIA,0EAAqE;AAErE,6DAA2D;AAW3D;;;;GAIG;AACI,MAAM,aAAa,GAAG,CAAC,OAA8B,EAAkB,EAAE,CAC9E,UAAU,MAAgB;IACxB,MAAM,QAAQ,GAAG,OAAO,CAAC,WAAW,CAClC,wCAAmB,EACnB,MAAM,CACY,CAAC;IAErB,iDAAsB,CAAC,eAAe,CAAC,MAAqB,EAAE;QAC5D,GAAG,QAAQ;QACX,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC;KACnB,CAAC,CAAC;AACL,CAAC,CAAC;AAXS,QAAA,aAAa,iBAWtB"}
|
package/dist/config/types.d.ts
CHANGED
|
@@ -29,9 +29,11 @@ export interface PropertyMetadata<T extends ConfigValue = ConfigValue> {
|
|
|
29
29
|
defaultValue?: T | undefined;
|
|
30
30
|
}
|
|
31
31
|
export interface SectionMetadata {
|
|
32
|
-
name
|
|
32
|
+
name?: string;
|
|
33
|
+
constructorName: string;
|
|
33
34
|
properties: Record<string | symbol, PropertyMetadata>;
|
|
34
35
|
description?: string;
|
|
36
|
+
tags?: string[];
|
|
35
37
|
}
|
|
36
38
|
export interface SourceMetadata {
|
|
37
39
|
type: SourceType;
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.GlobalExceptionsConfig = void 0;
|
|
13
13
|
const common_1 = require("@rsdk/common");
|
|
14
14
|
const config_1 = require("../config");
|
|
15
|
+
const config_const_1 = require("../config/config.const");
|
|
15
16
|
let GlobalExceptionsConfig = class GlobalExceptionsConfig extends config_1.Config {
|
|
16
17
|
verbose;
|
|
17
18
|
};
|
|
@@ -26,7 +27,9 @@ __decorate([
|
|
|
26
27
|
__metadata("design:type", Boolean)
|
|
27
28
|
], GlobalExceptionsConfig.prototype, "verbose", void 0);
|
|
28
29
|
GlobalExceptionsConfig = __decorate([
|
|
29
|
-
(0, config_1.ConfigSection)(
|
|
30
|
+
(0, config_1.ConfigSection)({
|
|
31
|
+
tags: [config_const_1.ConfigTag.infrastructure, config_const_1.ConfigTag.errorHandling],
|
|
32
|
+
})
|
|
30
33
|
], GlobalExceptionsConfig);
|
|
31
34
|
exports.GlobalExceptionsConfig = GlobalExceptionsConfig;
|
|
32
35
|
//# sourceMappingURL=global-exceptions.config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global-exceptions.config.js","sourceRoot":"","sources":["../../src/exceptions.handling/global-exceptions.config.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAoC;AAEpC,sCAAwE;
|
|
1
|
+
{"version":3,"file":"global-exceptions.config.js","sourceRoot":"","sources":["../../src/exceptions.handling/global-exceptions.config.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAoC;AAEpC,sCAAwE;AACxE,yDAAmD;AAK5C,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,eAAM;IAQvC,OAAO,CAAW;CAC5B,CAAA;AARC;IAAC,IAAA,iBAAQ,EAAC,gBAAgB,EAAE,IAAI,mBAAU,EAAE,EAAE;QAC5C,YAAY,EAAE,IAAI;QAClB,WAAW,EAAE,IAAA,aAAI,EAAA;;;KAGhB;KACF,CAAC;;uDACyB;AARhB,sBAAsB;IAHlC,IAAA,sBAAa,EAAC;QACb,IAAI,EAAE,CAAC,wBAAS,CAAC,cAAc,EAAE,wBAAS,CAAC,aAAa,CAAC;KAC1D,CAAC;GACW,sBAAsB,CASlC;AATY,wDAAsB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { DocumentNode, DocumentResolver } from '@rsdk/autodoc-protocol';
|
|
2
|
+
import type { RsdkMetadata } from '@rsdk/metadata';
|
|
3
|
+
import type { IndicatorOptions } from '../metadata';
|
|
4
|
+
export declare class IndicatorAutodoc implements DocumentResolver {
|
|
5
|
+
readonly rsdkMetadata: RsdkMetadata<{
|
|
6
|
+
key: string;
|
|
7
|
+
options: IndicatorOptions;
|
|
8
|
+
constructorName: string;
|
|
9
|
+
}>;
|
|
10
|
+
constructor(rsdkMetadata: RsdkMetadata<{
|
|
11
|
+
key: string;
|
|
12
|
+
options: IndicatorOptions;
|
|
13
|
+
constructorName: string;
|
|
14
|
+
}>);
|
|
15
|
+
getNode(): DocumentNode | null;
|
|
16
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IndicatorAutodoc = void 0;
|
|
4
|
+
const autodoc_protocol_1 = require("@rsdk/autodoc-protocol");
|
|
5
|
+
class IndicatorAutodoc {
|
|
6
|
+
rsdkMetadata;
|
|
7
|
+
constructor(rsdkMetadata) {
|
|
8
|
+
this.rsdkMetadata = rsdkMetadata;
|
|
9
|
+
}
|
|
10
|
+
getNode() {
|
|
11
|
+
const resources = this.rsdkMetadata.get();
|
|
12
|
+
if (!resources) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
return new autodoc_protocol_1.Composite(new autodoc_protocol_1.Table(resources.map(({ value }) => ({
|
|
16
|
+
key: value.key,
|
|
17
|
+
scope: value.options.scope ?? '-',
|
|
18
|
+
description: value.options.description ?? '-',
|
|
19
|
+
name: value.constructorName,
|
|
20
|
+
}))), 'Health indicators');
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.IndicatorAutodoc = IndicatorAutodoc;
|
|
24
|
+
//# sourceMappingURL=heath.autodoc-resolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"heath.autodoc-resolver.js","sourceRoot":"","sources":["../../../src/health/autodoc/heath.autodoc-resolver.ts"],"names":[],"mappings":";;;AACA,6DAA0D;AAK1D,MAAa,gBAAgB;IAEhB;IADX,YACW,YAIP;QAJO,iBAAY,GAAZ,YAAY,CAInB;IACD,CAAC;IAEJ,OAAO;QACL,MAAM,SAAS,GAAG,IAAI,CAAC,YAAY,CAAC,GAAG,EAAE,CAAC;QAC1C,IAAI,CAAC,SAAS,EAAE;YACd,OAAO,IAAI,CAAC;SACb;QACD,OAAO,IAAI,4BAAS,CAClB,IAAI,wBAAK,CACP,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;YAC5B,GAAG,EAAE,KAAK,CAAC,GAAG;YACd,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,IAAI,GAAG;YACjC,WAAW,EAAE,KAAK,CAAC,OAAO,CAAC,WAAW,IAAI,GAAG;YAC7C,IAAI,EAAE,KAAK,CAAC,eAAe;SAC5B,CAAC,CAAC,CACJ,EACD,mBAAmB,CACpB,CAAC;IACJ,CAAC;CACF;AA1BD,4CA0BC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import type { OnModuleInit } from '@nestjs/common';
|
|
1
2
|
import { ModuleRef } from '@nestjs/core';
|
|
2
3
|
import { ILogger } from '@rsdk/logging';
|
|
3
4
|
import type { CheckSummary } from './types';
|
|
4
|
-
export declare class HealthChecksService {
|
|
5
|
+
export declare class HealthChecksService implements OnModuleInit {
|
|
5
6
|
private readonly logger;
|
|
6
7
|
private readonly moduleRef;
|
|
7
8
|
private readonly indicators;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"health.service.js","sourceRoot":"","sources":["../../src/health/health.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"health.service.js","sourceRoot":"","sources":["../../src/health/health.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AACA,2CAA4C;AAC5C,uCAAyC;AAEzC,iDAA2C;AAG3C,wCAA0C;AAE1C,6CAAoD;AACpD,yCAAgD;AAQzC,IAAM,mBAAmB,2BAAzB,MAAM,mBAAmB;IAKwB;IACnC;IALF,UAAU,GAAuB,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;IAChD,cAAc,GAAG,IAAI,GAAG,EAA2B,CAAC;IAErE,YACsD,MAAe,EAClD,SAAoB;QADe,WAAM,GAAN,MAAM,CAAS;QAClD,cAAS,GAAT,SAAS,CAAW;IACpC,CAAC;IAGE,AAAN,KAAK,CAAC,KAAK,CAAC,MAAqB;QAC/B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,iBAAiB,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;QAEhD,MAAM,UAAU,GAAG,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;QAEjD,IAAI,OAAO,GAAG,IAAI,CAAC;QACnB,MAAM,OAAO,GAAiB,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;QAE5D,MAAM,OAAO,CAAC,GAAG,CACf,UAAU,CAAC,GAAG,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE;YACjC,MAAM,IAAI,GAAG,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;YAChD,IAAI,CAAC,IAAI,EAAE;gBACT,MAAM,IAAI,KAAK,CACb,cAAc,SAAS,CAAC,WAAW,CAAC,IAAI,oBAAoB,CAC7D,CAAC;aACH;YAED,IAAI;gBACF,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC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K,GAAG;gBACN,OAAO,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;YAErC;;;eAGG;YACH,OAAO,CAAC,CAAC;gBACP,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;gBAEzC,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;oBACtC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,mCAAmC,MAAM,EAAE,CAAC,CAAC;iBAC/D;gBAED,OAAO,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,CAAC;aACzD;SACF;IACH,CAAC;IAEO,OAAO,CACb,UAAoD;QAEpD,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;YAC1B,IAAI,OAAO,CAAC,KAAK,UAAU,EAAE;gBAC3B,OAAO,CAAC,CAAC;aACV;YAED,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;QAClD,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AAjGO;IADL,IAAA,oBAAO,GAAE;;;;gDAqCT;AA9CU,mBAAmB;IAD/B,IAAA,mBAAU,GAAE;IAMR,WAAA,IAAA,sBAAY,EAAC,qBAAmB,CAAC,CAAA;6CACN,gBAAS;GAN5B,mBAAmB,CA2G/B;AA3GY,kDAAmB"}
|
package/dist/health/index.d.ts
CHANGED
package/dist/health/index.js
CHANGED
|
@@ -14,10 +14,13 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.IndicatorAutodocResolver = void 0;
|
|
17
18
|
__exportStar(require("./health.module"), exports);
|
|
18
19
|
__exportStar(require("./health.service"), exports);
|
|
19
20
|
__exportStar(require("./indicators.abstract"), exports);
|
|
20
21
|
__exportStar(require("./metadata/indicator.decorator"), exports);
|
|
21
22
|
__exportStar(require("./types"), exports);
|
|
22
23
|
__exportStar(require("./helpers"), exports);
|
|
24
|
+
var heath_autodoc_resolver_1 = require("./autodoc/heath.autodoc-resolver");
|
|
25
|
+
Object.defineProperty(exports, "IndicatorAutodocResolver", { enumerable: true, get: function () { return heath_autodoc_resolver_1.IndicatorAutodoc; } });
|
|
23
26
|
//# sourceMappingURL=index.js.map
|
package/dist/health/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/health/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/health/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,mDAAiC;AACjC,wDAAsC;AACtC,iEAA+C;AAC/C,0CAAwB;AACxB,4CAA0B;AAC1B,2EAAgG;AAAvF,kIAAA,gBAAgB,OAA4B"}
|
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
export interface IndicatorOptions {
|
|
2
|
+
/**
|
|
3
|
+
* Description
|
|
4
|
+
*/
|
|
2
5
|
description?: string;
|
|
6
|
+
/**
|
|
7
|
+
* FIXME: WTF?
|
|
8
|
+
*/
|
|
3
9
|
scope?: string;
|
|
4
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* Registers health indicator. Indicators should be added to application
|
|
13
|
+
* modules as providers and use common DI to inject necessary services
|
|
14
|
+
* (api, database clients, etc.)
|
|
15
|
+
* @param {string} key Healthcheck response is object where each key
|
|
16
|
+
* is a specific indicator. Thus you can use key to recognize an
|
|
17
|
+
* indicator in healthcheck response
|
|
18
|
+
* @param {IndicatorOptions} options Indicator metadata
|
|
19
|
+
* @returns {ClassDecorator}
|
|
20
|
+
*/
|
|
5
21
|
export declare const Indicator: (key: string, options?: IndicatorOptions) => ClassDecorator;
|
|
@@ -2,7 +2,20 @@
|
|
|
2
2
|
/* eslint-disable @typescript-eslint/ban-types */
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.Indicator = void 0;
|
|
5
|
+
const autodoc_protocol_1 = require("@rsdk/autodoc-protocol");
|
|
6
|
+
const metadata_1 = require("@rsdk/metadata");
|
|
7
|
+
const heath_autodoc_resolver_1 = require("../autodoc/heath.autodoc-resolver");
|
|
5
8
|
const indicators_registry_1 = require("./indicators.registry");
|
|
9
|
+
/**
|
|
10
|
+
* Registers health indicator. Indicators should be added to application
|
|
11
|
+
* modules as providers and use common DI to inject necessary services
|
|
12
|
+
* (api, database clients, etc.)
|
|
13
|
+
* @param {string} key Healthcheck response is object where each key
|
|
14
|
+
* is a specific indicator. Thus you can use key to recognize an
|
|
15
|
+
* indicator in healthcheck response
|
|
16
|
+
* @param {IndicatorOptions} options Indicator metadata
|
|
17
|
+
* @returns {ClassDecorator}
|
|
18
|
+
*/
|
|
6
19
|
const Indicator = (key, options = {}) => {
|
|
7
20
|
return function (target) {
|
|
8
21
|
indicators_registry_1.IndicatorsRegistry.register(target, {
|
|
@@ -10,6 +23,14 @@ const Indicator = (key, options = {}) => {
|
|
|
10
23
|
scope: 'common',
|
|
11
24
|
...options,
|
|
12
25
|
});
|
|
26
|
+
const rsdkMetadata = new metadata_1.RsdkMetadata(target, 'health-indicator');
|
|
27
|
+
rsdkMetadata.add({
|
|
28
|
+
key,
|
|
29
|
+
options,
|
|
30
|
+
constructorName: target.name,
|
|
31
|
+
});
|
|
32
|
+
const autodocMetadata = new autodoc_protocol_1.AutodocMetadata(rsdkMetadata);
|
|
33
|
+
autodocMetadata.defineResolver(new heath_autodoc_resolver_1.IndicatorAutodoc(rsdkMetadata));
|
|
13
34
|
};
|
|
14
35
|
};
|
|
15
36
|
exports.Indicator = Indicator;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"indicator.decorator.js","sourceRoot":"","sources":["../../../src/health/metadata/indicator.decorator.ts"],"names":[],"mappings":";AAAA,iDAAiD;;;
|
|
1
|
+
{"version":3,"file":"indicator.decorator.js","sourceRoot":"","sources":["../../../src/health/metadata/indicator.decorator.ts"],"names":[],"mappings":";AAAA,iDAAiD;;;AAEjD,6DAAyD;AAEzD,6CAA8C;AAE9C,8EAAqE;AAGrE,+DAA2D;AAc3D;;;;;;;;;GASG;AACI,MAAM,SAAS,GAAG,CACvB,GAAW,EACX,UAA4B,EAAE,EACd,EAAE;IAClB,OAAO,UAAU,MAAgB;QAC/B,wCAAkB,CAAC,QAAQ,CAAC,MAAsC,EAAE;YAClE,GAAG;YACH,KAAK,EAAE,QAAQ;YACf,GAAG,OAAO;SACX,CAAC,CAAC;QACH,MAAM,YAAY,GAAG,IAAI,uBAAY,CAIlC,MAAM,EAAE,kBAAkB,CAAC,CAAC;QAE/B,YAAY,CAAC,GAAG,CAAC;YACf,GAAG;YACH,OAAO;YACP,eAAe,EAAE,MAAM,CAAC,IAAI;SAC7B,CAAC,CAAC;QACH,MAAM,eAAe,GAAG,IAAI,kCAAe,CAAC,YAAY,CAAC,CAAC;QAE1D,eAAe,CAAC,cAAc,CAAC,IAAI,yCAAgB,CAAC,YAAY,CAAC,CAAC,CAAC;IACrE,CAAC,CAAC;AACJ,CAAC,CAAC;AAzBW,QAAA,SAAS,aAyBpB"}
|
|
@@ -13,9 +13,6 @@ class IndicatorsRegistry {
|
|
|
13
13
|
if (this.indicators.has(target)) {
|
|
14
14
|
throw new exceptions_1.DoubleInitException('Health indicator', target.name);
|
|
15
15
|
}
|
|
16
|
-
this.logger.info(`Registering indicator: ${target.name}`, {
|
|
17
|
-
indicator: target.name,
|
|
18
|
-
});
|
|
19
16
|
this.indicators.set(target, options);
|
|
20
17
|
}
|
|
21
18
|
static entries() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"indicators.registry.js","sourceRoot":"","sources":["../../../src/health/metadata/indicators.registry.ts"],"names":[],"mappings":";;;AACA,2CAA8C;AAE9C,iDAAuD;AAGvD,MAAa,kBAAkB;IACrB,MAAM,CAAC,MAAM,GAAG,uBAAa,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;IAC3D,MAAM,CAAC,UAAU,GAAG,IAAI,GAAG,EAGhC,CAAC;IAEJ,MAAM,CAAC,YAAY,CAAC,IAAkC;QACpD,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IAED,MAAM,CAAC,QAAQ,CACb,MAAoC,EACpC,OAA0B;QAE1B,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;YAC/B,MAAM,IAAI,gCAAmB,CAAC,kBAAkB,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;SAChE;QAED,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"indicators.registry.js","sourceRoot":"","sources":["../../../src/health/metadata/indicators.registry.ts"],"names":[],"mappings":";;;AACA,2CAA8C;AAE9C,iDAAuD;AAGvD,MAAa,kBAAkB;IACrB,MAAM,CAAC,MAAM,GAAG,uBAAa,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;IAC3D,MAAM,CAAC,UAAU,GAAG,IAAI,GAAG,EAGhC,CAAC;IAEJ,MAAM,CAAC,YAAY,CAAC,IAAkC;QACpD,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IAED,MAAM,CAAC,QAAQ,CACb,MAAoC,EACpC,OAA0B;QAE1B,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;YAC/B,MAAM,IAAI,gCAAmB,CAAC,kBAAkB,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;SAChE;QAED,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvC,CAAC;IAED,MAAM,CAAC,OAAO;QAGZ,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;IACnC,CAAC;;AA1BH,gDA2BC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -14,7 +14,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.PlatformApp = exports.register = exports.MetricsModule = exports.Metric = exports.Summary = exports.Histogram = exports.Gauge = exports.Counter = exports.InjectLogger = exports.CheckResult = exports.Indicator = exports.HealthChecksService = exports.PingIndicator = exports.FileSystemIndicator = exports.PlatformContext = void 0;
|
|
17
|
+
exports.PlatformApp = exports.register = exports.MetricsModule = exports.Metric = exports.Summary = exports.Histogram = exports.Gauge = exports.Counter = exports.InjectLogger = exports.CheckResult = exports.Indicator = exports.HealthChecksService = exports.PingIndicator = exports.FileSystemIndicator = exports.PlatformContext = exports.ConfigTag = void 0;
|
|
18
|
+
var config_const_1 = require("./config/config.const");
|
|
19
|
+
Object.defineProperty(exports, "ConfigTag", { enumerable: true, get: function () { return config_const_1.ConfigTag; } });
|
|
18
20
|
var platform_context_1 = require("./platform.context");
|
|
19
21
|
Object.defineProperty(exports, "PlatformContext", { enumerable: true, get: function () { return platform_context_1.PlatformContext; } });
|
|
20
22
|
__exportStar(require("./config"), exports);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,uDAAqD;AAA5C,mHAAA,eAAe,OAAA;AAExB,2CAAyB;AACzB,+CAA6B;AAC7B,wDAAsC;AACtC,mCAWkB;AARhB,6GAAA,mBAAmB,OAAA;AAEnB,uGAAA,aAAa,OAAA;AAEb,6GAAA,mBAAmB,OAAA;AAEnB,mGAAA,SAAS,OAAA;AACT,qGAAA,WAAW,OAAA;AAEb,qCAAyC;AAAhC,uGAAA,YAAY,OAAA;AACrB,qCASmB;AAPjB,kGAAA,OAAO,OAAA;AACP,gGAAA,KAAK,OAAA;AACL,oGAAA,SAAS,OAAA;AACT,kGAAA,OAAO,OAAA;AACP,iGAAA,MAAM,OAAA;AACN,wGAAA,aAAa,OAAA;AACb,mGAAA,QAAQ,OAAA;AAEV,mDAAiD;AAAxC,2GAAA,WAAW,OAAA;AACpB,0CAAwB;AACxB,4DAA0C;AAC1C,oEAAkD"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,sDAAkD;AAAzC,yGAAA,SAAS,OAAA;AAElB,uDAAqD;AAA5C,mHAAA,eAAe,OAAA;AAExB,2CAAyB;AACzB,+CAA6B;AAC7B,wDAAsC;AACtC,mCAWkB;AARhB,6GAAA,mBAAmB,OAAA;AAEnB,uGAAA,aAAa,OAAA;AAEb,6GAAA,mBAAmB,OAAA;AAEnB,mGAAA,SAAS,OAAA;AACT,qGAAA,WAAW,OAAA;AAEb,qCAAyC;AAAhC,uGAAA,YAAY,OAAA;AACrB,qCASmB;AAPjB,kGAAA,OAAO,OAAA;AACP,gGAAA,KAAK,OAAA;AACL,oGAAA,SAAS,OAAA;AACT,kGAAA,OAAO,OAAA;AACP,iGAAA,MAAM,OAAA;AACN,wGAAA,aAAa,OAAA;AACb,mGAAA,QAAQ,OAAA;AAEV,mDAAiD;AAAxC,2GAAA,WAAW,OAAA;AACpB,0CAAwB;AACxB,4DAA0C;AAC1C,oEAAkD"}
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.LoggingConfig = void 0;
|
|
13
13
|
const logging_1 = require("@rsdk/logging");
|
|
14
14
|
const config_1 = require("../config");
|
|
15
|
+
const config_const_1 = require("../config/config.const");
|
|
15
16
|
let LoggingConfig = class LoggingConfig extends config_1.Config {
|
|
16
17
|
level;
|
|
17
18
|
redact;
|
|
@@ -32,7 +33,9 @@ __decorate([
|
|
|
32
33
|
__metadata("design:type", Array)
|
|
33
34
|
], LoggingConfig.prototype, "redact", void 0);
|
|
34
35
|
LoggingConfig = __decorate([
|
|
35
|
-
(0, config_1.ConfigSection)(
|
|
36
|
+
(0, config_1.ConfigSection)({
|
|
37
|
+
tags: [config_const_1.ConfigTag.infrastructure, config_const_1.ConfigTag.logging],
|
|
38
|
+
})
|
|
36
39
|
], LoggingConfig);
|
|
37
40
|
exports.LoggingConfig = LoggingConfig;
|
|
38
41
|
//# sourceMappingURL=logging.config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logging.config.js","sourceRoot":"","sources":["../../src/logging/logging.config.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAyC;AAEzC,sCAOmB;
|
|
1
|
+
{"version":3,"file":"logging.config.js","sourceRoot":"","sources":["../../src/logging/logging.config.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAyC;AAEzC,sCAOmB;AACnB,yDAAmD;AAK5C,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,eAAM;IAM9B,KAAK,CAAY;IAMjB,MAAM,CAAY;CAC5B,CAAA;AAZC;IAAC,IAAA,iBAAQ,EAAC,WAAW,EAAE,IAAI,mBAAU,CAAC,kBAAQ,CAAC,EAAE;QAC/C,sEAAsE;QACtE,YAAY,EAAE,kBAAQ,CAAC,KAAK;QAC5B,WAAW,EAAE,WAAW;KACzB,CAAC;;4CACwB;AAE1B;IAAC,IAAA,iBAAQ,EAAC,YAAY,EAAE,IAAI,oBAAW,CAAC,IAAI,qBAAY,EAAE,CAAC,EAAE;QAC3D,YAAY,EAAE,EAAE;QAChB,WAAW,EAAE,WAAW;KACzB,CAAC;;6CACyB;AAZhB,aAAa;IAHzB,IAAA,sBAAa,EAAC;QACb,IAAI,EAAE,CAAC,wBAAS,CAAC,cAAc,EAAE,wBAAS,CAAC,OAAO,CAAC;KACpD,CAAC;GACW,aAAa,CAazB;AAbY,sCAAa"}
|
package/dist/metrics/index.d.ts
CHANGED
package/dist/metrics/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.register = exports.Summary = exports.Histogram = exports.Gauge = exports.Counter = void 0;
|
|
17
|
+
exports.MetricAutodocResolver = exports.register = exports.Summary = exports.Histogram = exports.Gauge = exports.Counter = void 0;
|
|
18
18
|
var prom_client_1 = require("prom-client");
|
|
19
19
|
Object.defineProperty(exports, "Counter", { enumerable: true, get: function () { return prom_client_1.Counter; } });
|
|
20
20
|
Object.defineProperty(exports, "Gauge", { enumerable: true, get: function () { return prom_client_1.Gauge; } });
|
|
@@ -24,4 +24,6 @@ Object.defineProperty(exports, "register", { enumerable: true, get: function ()
|
|
|
24
24
|
__exportStar(require("./metrics.module"), exports);
|
|
25
25
|
__exportStar(require("./types"), exports);
|
|
26
26
|
__exportStar(require("./metadata"), exports);
|
|
27
|
+
var metadata_1 = require("./metadata");
|
|
28
|
+
Object.defineProperty(exports, "MetricAutodocResolver", { enumerable: true, get: function () { return metadata_1.MetricAutodocResolver; } });
|
|
27
29
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/metrics/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,2CAA2E;AAAlE,sGAAA,OAAO,OAAA;AAAE,oGAAA,KAAK,OAAA;AAAE,wGAAA,SAAS,OAAA;AAAE,sGAAA,OAAO,OAAA;AAAE,uGAAA,QAAQ,OAAA;AACrD,mDAAiC;AACjC,0CAAwB;AACxB,6CAA2B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/metrics/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,2CAA2E;AAAlE,sGAAA,OAAO,OAAA;AAAE,oGAAA,KAAK,OAAA;AAAE,wGAAA,SAAS,OAAA;AAAE,sGAAA,OAAO,OAAA;AAAE,uGAAA,QAAQ,OAAA;AACrD,mDAAiC;AACjC,0CAAwB;AACxB,6CAA2B;AAC3B,uCAAmD;AAA1C,iHAAA,qBAAqB,OAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { DocumentNode, DocumentResolver } from '@rsdk/autodoc-protocol';
|
|
2
|
+
import type { RsdkMetadata } from '@rsdk/metadata';
|
|
3
|
+
import type { MetricRsdkMetadata } from '../types';
|
|
4
|
+
export declare class MetricAutodocResolver implements DocumentResolver {
|
|
5
|
+
readonly rsdkMetadata: RsdkMetadata<MetricRsdkMetadata>;
|
|
6
|
+
constructor(rsdkMetadata: RsdkMetadata<MetricRsdkMetadata>);
|
|
7
|
+
getNode(): DocumentNode | null;
|
|
8
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MetricAutodocResolver = void 0;
|
|
4
|
+
const autodoc_protocol_1 = require("@rsdk/autodoc-protocol");
|
|
5
|
+
class MetricAutodocResolver {
|
|
6
|
+
rsdkMetadata;
|
|
7
|
+
constructor(rsdkMetadata) {
|
|
8
|
+
this.rsdkMetadata = rsdkMetadata;
|
|
9
|
+
}
|
|
10
|
+
getNode() {
|
|
11
|
+
const resources = this.rsdkMetadata.get();
|
|
12
|
+
if (!resources) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
return new autodoc_protocol_1.Composite(new autodoc_protocol_1.Table(resources.map(({ value }) => {
|
|
16
|
+
return {
|
|
17
|
+
name: value.metadata.name,
|
|
18
|
+
description: value.metadata.description,
|
|
19
|
+
type: value.type,
|
|
20
|
+
controllerName: value.metricController.name,
|
|
21
|
+
};
|
|
22
|
+
})), 'Metrics');
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.MetricAutodocResolver = MetricAutodocResolver;
|
|
26
|
+
//# sourceMappingURL=metrics.autodoc-resolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metrics.autodoc-resolver.js","sourceRoot":"","sources":["../../../../src/metrics/metadata/autodoc/metrics.autodoc-resolver.ts"],"names":[],"mappings":";;;AACA,6DAA0D;AAK1D,MAAa,qBAAqB;IACX;IAArB,YAAqB,YAA8C;QAA9C,iBAAY,GAAZ,YAAY,CAAkC;IAAG,CAAC;IAEvE,OAAO;QACL,MAAM,SAAS,GAAG,IAAI,CAAC,YAAY,CAAC,GAAG,EAAE,CAAC;QAC1C,IAAI,CAAC,SAAS,EAAE;YACd,OAAO,IAAI,CAAC;SACb;QAED,OAAO,IAAI,4BAAS,CAClB,IAAI,wBAAK,CACP,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;YAC1B,OAAO;gBACL,IAAI,EAAE,KAAK,CAAC,QAAQ,CAAC,IAAI;gBACzB,WAAW,EAAE,KAAK,CAAC,QAAQ,CAAC,WAAW;gBACvC,IAAI,EAAE,KAAK,CAAC,IAAI;gBAChB,cAAc,EAAE,KAAK,CAAC,gBAAgB,CAAC,IAAI;aAC5C,CAAC;QACJ,CAAC,CAAC,CACH,EACD,SAAS,CACV,CAAC;IACJ,CAAC;CACF;AAvBD,sDAuBC"}
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import type { CounterMetadata, GaugeMetadata, HistogramMetadata, OmitType, SummaryMetadata } from '../../types';
|
|
2
|
+
export type MetricType = 'counter' | 'gauge' | 'histogram' | 'summary';
|
|
2
3
|
/**
|
|
3
|
-
* Registers metric
|
|
4
|
-
*
|
|
5
|
-
* a provider
|
|
4
|
+
* Registers a custom metric. Metrics a added to MetricsModules inside
|
|
5
|
+
* the core, so you **should NOT** use them as providers in your application.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
* Conventional usage is to create a class that extends one of prom-client
|
|
8
|
+
* metric: Counter, Gauge, Histogram or Summary, and mark it with this
|
|
9
|
+
* decorator. The class should stay empty - it's is used only as a "host"
|
|
10
|
+
* for Metrics decorator.
|
|
11
|
+
*
|
|
12
|
+
* @param {counter|gauge|histogram|summary} type type of metric
|
|
13
|
+
* @param {CounterMetadata|GaugeMetadata|HistogramMetadata|SummaryMetadata} metadata
|
|
14
|
+
* respective metadata
|
|
15
|
+
* @returns {ClassDecorator}
|
|
9
16
|
*/
|
|
10
17
|
export declare function Metric(type: 'counter', metadata: OmitType<CounterMetadata>): ClassDecorator;
|
|
11
18
|
export declare function Metric(type: 'gauge', metadata: OmitType<GaugeMetadata>): ClassDecorator;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metric.decorator.js","sourceRoot":"","sources":["../../../../src/metrics/metadata/decorators/metric.decorator.ts"],"names":[],"mappings":";;;AAWA,0DAAsD;
|
|
1
|
+
{"version":3,"file":"metric.decorator.js","sourceRoot":"","sources":["../../../../src/metrics/metadata/decorators/metric.decorator.ts"],"names":[],"mappings":";;;AAWA,0DAAsD;AAkCtD,SAAgB,MAAM,CACpB,IAAgB,EAChB,QAAkC;IAElC,OAAO,UAAU,MAAgB;QAC/B,kCAAe,CAAC,QAAQ,CAAC,MAAqB,EAAE,EAAE,GAAG,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;IACzE,CAAC,CAAC;AACJ,CAAC;AAPD,wBAOC"}
|
|
@@ -14,6 +14,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.MetricAutodocResolver = void 0;
|
|
17
18
|
__exportStar(require("./metrics.registry"), exports);
|
|
18
19
|
__exportStar(require("./decorators"), exports);
|
|
20
|
+
var metrics_autodoc_resolver_1 = require("./autodoc/metrics.autodoc-resolver");
|
|
21
|
+
Object.defineProperty(exports, "MetricAutodocResolver", { enumerable: true, get: function () { return metrics_autodoc_resolver_1.MetricAutodocResolver; } });
|
|
19
22
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/metrics/metadata/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/metrics/metadata/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,+CAA6B;AAC7B,+EAA2E;AAAlE,iIAAA,qBAAqB,OAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Constructor } from '@rsdk/common';
|
|
2
|
+
import type { AnyMetric, MetricMetadata, OmitType } from '../types';
|
|
3
|
+
import type { MetricType } from './decorators';
|
|
4
|
+
export type MetricRsdkMetadata = {
|
|
5
|
+
type: MetricType;
|
|
6
|
+
metadata: OmitType<MetricMetadata>;
|
|
7
|
+
metricController: Constructor<AnyMetric>;
|
|
8
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/metrics/metadata/types.ts"],"names":[],"mappings":""}
|
|
@@ -11,6 +11,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.MetricsModuleConfig = void 0;
|
|
13
13
|
const config_1 = require("../config");
|
|
14
|
+
const config_const_1 = require("../config/config.const");
|
|
14
15
|
let MetricsModuleConfig = class MetricsModuleConfig extends config_1.Config {
|
|
15
16
|
isEnabled;
|
|
16
17
|
includeDefault;
|
|
@@ -30,7 +31,10 @@ __decorate([
|
|
|
30
31
|
__metadata("design:type", Boolean)
|
|
31
32
|
], MetricsModuleConfig.prototype, "includeDefault", void 0);
|
|
32
33
|
MetricsModuleConfig = __decorate([
|
|
33
|
-
(0, config_1.ConfigSection)({
|
|
34
|
+
(0, config_1.ConfigSection)({
|
|
35
|
+
name: 'Metrics configuration',
|
|
36
|
+
tags: [config_const_1.ConfigTag.infrastructure, config_const_1.ConfigTag.metric],
|
|
37
|
+
})
|
|
34
38
|
], MetricsModuleConfig);
|
|
35
39
|
exports.MetricsModuleConfig = MetricsModuleConfig;
|
|
36
40
|
//# sourceMappingURL=metrics.config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metrics.config.js","sourceRoot":"","sources":["../../src/metrics/metrics.config.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,sCAAwE;
|
|
1
|
+
{"version":3,"file":"metrics.config.js","sourceRoot":"","sources":["../../src/metrics/metrics.config.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,sCAAwE;AACxE,yDAAmD;AAM5C,IAAM,mBAAmB,GAAzB,MAAM,mBAAoB,SAAQ,eAAM;IAK7C,SAAS,CAAW;IAMpB,cAAc,CAAW;CAC1B,CAAA;AAXC;IAAC,IAAA,iBAAQ,EAAC,iBAAiB,EAAE,IAAI,mBAAU,EAAE,EAAE;QAC7C,YAAY,EAAE,IAAI;QAClB,WAAW,EAAE,0CAA0C;KACxD,CAAC;;sDACkB;AAEpB;IAAC,IAAA,iBAAQ,EAAC,yBAAyB,EAAE,IAAI,mBAAU,EAAE,EAAE;QACrD,YAAY,EAAE,IAAI;QAClB,WAAW,EAAE,2DAA2D;KACzE,CAAC;;2DACuB;AAXd,mBAAmB;IAJ/B,IAAA,sBAAa,EAAC;QACb,IAAI,EAAE,uBAAuB;QAC7B,IAAI,EAAE,CAAC,wBAAS,CAAC,cAAc,EAAE,wBAAS,CAAC,MAAM,CAAC;KACnD,CAAC;GACW,mBAAmB,CAY/B;AAZY,kDAAmB"}
|
|
@@ -15,9 +15,11 @@ var MetricsModule_1;
|
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
16
|
exports.MetricsModule = void 0;
|
|
17
17
|
const common_1 = require("@nestjs/common");
|
|
18
|
+
const autodoc_protocol_1 = require("@rsdk/autodoc-protocol");
|
|
19
|
+
const metadata_1 = require("@rsdk/metadata");
|
|
18
20
|
const prom_client_1 = __importDefault(require("prom-client"));
|
|
19
21
|
const config_1 = require("../config");
|
|
20
|
-
const
|
|
22
|
+
const metadata_2 = require("./metadata");
|
|
21
23
|
const metrics_config_1 = require("./metrics.config");
|
|
22
24
|
/**
|
|
23
25
|
* Metrics module exposes metrics interface (depending on transport)
|
|
@@ -59,11 +61,21 @@ let MetricsModule = MetricsModule_1 = class MetricsModule {
|
|
|
59
61
|
providers.push(existing);
|
|
60
62
|
continue;
|
|
61
63
|
}
|
|
62
|
-
const metadata =
|
|
63
|
-
|
|
64
|
+
const metadata = metadata_2.MetricsRegistry.getOne(ctor);
|
|
65
|
+
const provider = {
|
|
64
66
|
provide: ctor,
|
|
65
67
|
useValue: new ctor(metadata),
|
|
68
|
+
};
|
|
69
|
+
const rsdkMetadata = new metadata_1.RsdkMetadata(provider, 'metrics');
|
|
70
|
+
rsdkMetadata.add({
|
|
71
|
+
type: metadata.type,
|
|
72
|
+
metricController: ctor,
|
|
73
|
+
metadata,
|
|
66
74
|
});
|
|
75
|
+
const autodocMetadata = new autodoc_protocol_1.AutodocMetadata(rsdkMetadata);
|
|
76
|
+
const metricsDocumentResolver = new metadata_2.MetricAutodocResolver(rsdkMetadata);
|
|
77
|
+
autodocMetadata.defineResolver(metricsDocumentResolver);
|
|
78
|
+
providers.push(provider);
|
|
67
79
|
}
|
|
68
80
|
return {
|
|
69
81
|
module: MetricsModule_1,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metrics.module.js","sourceRoot":"","sources":["../../src/metrics/metrics.module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAKA,2CAAwC;
|
|
1
|
+
{"version":3,"file":"metrics.module.js","sourceRoot":"","sources":["../../src/metrics/metrics.module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAKA,2CAAwC;AACxC,6DAAyD;AAEzD,6CAA8C;AAC9C,8DAAiC;AAEjC,sCAAiD;AAGjD,yCAAoE;AACpE,qDAAuD;AAGvD;;;;;;;GAOG;AAII,IAAM,aAAa,qBAAnB,MAAM,aAAa;IAIK;IAHrB,MAAM,CAAC,cAAc,GAAG,KAAK,CAAC;IAC9B,MAAM,CAAC,OAAO,GAAG,IAAI,GAAG,EAAoC,CAAC;IAErE,YAA6B,MAA2B;QAA3B,WAAM,GAAN,MAAM,CAAqB;IAAG,CAAC;IAE5D;;;;OAIG;IACH,MAAM,CAAC,OAAO,CAAC,OAA6B;QAC1C,OAAO;YACL,WAAW,EAAE,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC;YACrC,MAAM,EAAE,eAAa;SACtB,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,UAAU,CACf,KAA6B,EAC7B,GAAG,KAA+B;QAElC,MAAM,SAAS,GAAe,EAAE,CAAC;QAEjC,KAAK,MAAM,IAAI,IAAI,CAAC,KAAK,EAAE,GAAG,KAAK,CAAC,EAAE;YACpC,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAExC,IAAI,QAAQ,EAAE;gBACZ,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;gBAEzB,SAAS;aACV;YAED,MAAM,QAAQ,GAAG,0BAAe,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAE9C,MAAM,QAAQ,GAAG;gBACf,OAAO,EAAE,IAAI;gBACb,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