nestjs-otel 6.1.0 → 6.1.1
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/metrics/decorators/index.d.ts +1 -3
- package/lib/metrics/decorators/index.js +1 -3
- package/lib/metrics/decorators/param.d.ts +8 -0
- package/lib/metrics/decorators/param.js +21 -0
- package/package.json +1 -1
- package/lib/metrics/decorators/counter.d.ts +0 -2
- package/lib/metrics/decorators/counter.js +0 -17
- package/lib/metrics/decorators/histogram.d.ts +0 -1
- package/lib/metrics/decorators/histogram.js +0 -11
- package/lib/metrics/decorators/observable.d.ts +0 -3
- package/lib/metrics/decorators/observable.js +0 -23
|
@@ -2,6 +2,4 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
tslib_1.__exportStar(require("./common"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./
|
|
6
|
-
tslib_1.__exportStar(require("./histogram"), exports);
|
|
7
|
-
tslib_1.__exportStar(require("./observable"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./param"), exports);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { OtelMetricOptions } from '../../interfaces/metric-options.interface';
|
|
2
|
+
export type MetricParamDecorator = (name: string, options?: OtelMetricOptions) => ParameterDecorator;
|
|
3
|
+
export declare const OtelCounter: MetricParamDecorator;
|
|
4
|
+
export declare const OtelUpDownCounter: MetricParamDecorator;
|
|
5
|
+
export declare const OtelHistogram: MetricParamDecorator;
|
|
6
|
+
export declare const OtelObservableGauge: MetricParamDecorator;
|
|
7
|
+
export declare const OtelObservableCounter: MetricParamDecorator;
|
|
8
|
+
export declare const OtelObservableUpDownCounter: MetricParamDecorator;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OtelObservableUpDownCounter = exports.OtelObservableCounter = exports.OtelObservableGauge = exports.OtelHistogram = exports.OtelUpDownCounter = exports.OtelCounter = void 0;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
const metric_data_1 = require("../metric-data");
|
|
6
|
+
function createMetricParamDecorator(type, getOrCreateMetric) {
|
|
7
|
+
return (name, options) => {
|
|
8
|
+
return (0, common_1.createParamDecorator)(() => {
|
|
9
|
+
if (!name || name.length === 0) {
|
|
10
|
+
throw new Error(`${type} need a name argument`);
|
|
11
|
+
}
|
|
12
|
+
return getOrCreateMetric(name, options);
|
|
13
|
+
})();
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
exports.OtelCounter = createMetricParamDecorator('OtelCounter', metric_data_1.getOrCreateCounter);
|
|
17
|
+
exports.OtelUpDownCounter = createMetricParamDecorator('OtelUpDownCounter', metric_data_1.getOrCreateCounter);
|
|
18
|
+
exports.OtelHistogram = createMetricParamDecorator('OtelHistogram', metric_data_1.getOrCreateHistogram);
|
|
19
|
+
exports.OtelObservableGauge = createMetricParamDecorator('OtelObservableGauge', metric_data_1.getOrCreateObservableGauge);
|
|
20
|
+
exports.OtelObservableCounter = createMetricParamDecorator('OtelObservableCounter', metric_data_1.getOrCreateObservableCounter);
|
|
21
|
+
exports.OtelObservableUpDownCounter = createMetricParamDecorator('OtelObservableUpDownCounter', metric_data_1.getOrCreateObservableUpDownCounter);
|
package/package.json
CHANGED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export declare const OtelCounter: (...dataOrPipes: (string | import("@nestjs/common").PipeTransform<any, any> | import("@nestjs/common").Type<import("@nestjs/common").PipeTransform<any, any>>)[]) => ParameterDecorator;
|
|
2
|
-
export declare const OtelUpDownCounter: (...dataOrPipes: (string | import("@nestjs/common").PipeTransform<any, any> | import("@nestjs/common").Type<import("@nestjs/common").PipeTransform<any, any>>)[]) => ParameterDecorator;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.OtelUpDownCounter = exports.OtelCounter = void 0;
|
|
4
|
-
const common_1 = require("@nestjs/common");
|
|
5
|
-
const metric_data_1 = require("../metric-data");
|
|
6
|
-
exports.OtelCounter = (0, common_1.createParamDecorator)((name, options) => {
|
|
7
|
-
if (!name || name.length === 0) {
|
|
8
|
-
throw new Error('OtelCounter need a name argument');
|
|
9
|
-
}
|
|
10
|
-
return (0, metric_data_1.getOrCreateCounter)(name, options);
|
|
11
|
-
});
|
|
12
|
-
exports.OtelUpDownCounter = (0, common_1.createParamDecorator)((name, options) => {
|
|
13
|
-
if (!name || name.length === 0) {
|
|
14
|
-
throw new Error('OtelUpDownCounter need a name argument');
|
|
15
|
-
}
|
|
16
|
-
return (0, metric_data_1.getOrCreateCounter)(name, options);
|
|
17
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const OtelHistogram: (...dataOrPipes: (string | import("@nestjs/common").PipeTransform<any, any> | import("@nestjs/common").Type<import("@nestjs/common").PipeTransform<any, any>>)[]) => ParameterDecorator;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.OtelHistogram = void 0;
|
|
4
|
-
const common_1 = require("@nestjs/common");
|
|
5
|
-
const metric_data_1 = require("../metric-data");
|
|
6
|
-
exports.OtelHistogram = (0, common_1.createParamDecorator)((name, options) => {
|
|
7
|
-
if (!name || name.length === 0) {
|
|
8
|
-
throw new Error('OtelHistogram need a name argument');
|
|
9
|
-
}
|
|
10
|
-
return (0, metric_data_1.getOrCreateHistogram)(name, options);
|
|
11
|
-
});
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export declare const OtelObservableGauge: (...dataOrPipes: (string | import("@nestjs/common").PipeTransform<any, any> | import("@nestjs/common").Type<import("@nestjs/common").PipeTransform<any, any>>)[]) => ParameterDecorator;
|
|
2
|
-
export declare const OtelObservableCounter: (...dataOrPipes: (string | import("@nestjs/common").PipeTransform<any, any> | import("@nestjs/common").Type<import("@nestjs/common").PipeTransform<any, any>>)[]) => ParameterDecorator;
|
|
3
|
-
export declare const OtelObservableUpDownCounter: (...dataOrPipes: (string | import("@nestjs/common").PipeTransform<any, any> | import("@nestjs/common").Type<import("@nestjs/common").PipeTransform<any, any>>)[]) => ParameterDecorator;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.OtelObservableUpDownCounter = exports.OtelObservableCounter = exports.OtelObservableGauge = void 0;
|
|
4
|
-
const common_1 = require("@nestjs/common");
|
|
5
|
-
const metric_data_1 = require("../metric-data");
|
|
6
|
-
exports.OtelObservableGauge = (0, common_1.createParamDecorator)((name, options) => {
|
|
7
|
-
if (!name || name.length === 0) {
|
|
8
|
-
throw new Error('OtelObservableGauge need a name argument');
|
|
9
|
-
}
|
|
10
|
-
return (0, metric_data_1.getOrCreateObservableGauge)(name, options);
|
|
11
|
-
});
|
|
12
|
-
exports.OtelObservableCounter = (0, common_1.createParamDecorator)((name, options) => {
|
|
13
|
-
if (!name || name.length === 0) {
|
|
14
|
-
throw new Error('OtelObservableCounter need a name argument');
|
|
15
|
-
}
|
|
16
|
-
return (0, metric_data_1.getOrCreateObservableCounter)(name, options);
|
|
17
|
-
});
|
|
18
|
-
exports.OtelObservableUpDownCounter = (0, common_1.createParamDecorator)((name, options) => {
|
|
19
|
-
if (!name || name.length === 0) {
|
|
20
|
-
throw new Error('OtelObservableUpDownCounter need a name argument');
|
|
21
|
-
}
|
|
22
|
-
return (0, metric_data_1.getOrCreateObservableUpDownCounter)(name, options);
|
|
23
|
-
});
|