@biorate/nestjs-tools 2.2.6 → 2.3.0
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.
|
@@ -49,6 +49,8 @@ let TracingInterceptor = class TracingInterceptor {
|
|
|
49
49
|
span.setAttribute('incoming.response.statusCode', this.stringify(res.statusCode));
|
|
50
50
|
span.setAttribute('incoming.response.errorCode', this.stringify(e.code));
|
|
51
51
|
span.setAttribute('incoming.response.data', this.stringify(e?.response?.data));
|
|
52
|
+
span.recordException(e);
|
|
53
|
+
span.setStatus({ code: opentelemetry_1.SpanStatusCode.ERROR });
|
|
52
54
|
throw e;
|
|
53
55
|
}), (0, rxjs_1.tap)((data) => {
|
|
54
56
|
span.setAttribute('incoming.response.headers', this.stringify(res.headers));
|
|
@@ -63,11 +65,12 @@ let TracingInterceptor = class TracingInterceptor {
|
|
|
63
65
|
return next.handle();
|
|
64
66
|
}
|
|
65
67
|
intercept(context, next) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
return opentelemetry_1.trace.getTracer(this.constructor.name).startActiveSpan('incoming', (span) => {
|
|
69
|
+
if (!span)
|
|
70
|
+
return next.handle();
|
|
71
|
+
const type = context.getType();
|
|
72
|
+
return this[type](span, context, next).pipe((0, rxjs_1.finalize)(() => span.end()));
|
|
73
|
+
});
|
|
71
74
|
}
|
|
72
75
|
};
|
|
73
76
|
exports.TracingInterceptor = TracingInterceptor;
|
|
@@ -8,8 +8,8 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
9
|
};
|
|
10
10
|
import stringify from 'json-stringify-safe';
|
|
11
|
-
import { tap, catchError } from 'rxjs';
|
|
12
|
-
import { trace } from '@biorate/opentelemetry';
|
|
11
|
+
import { tap, catchError, finalize } from 'rxjs';
|
|
12
|
+
import { trace, SpanStatusCode } from '@biorate/opentelemetry';
|
|
13
13
|
import { Injectable, } from '@nestjs/common';
|
|
14
14
|
import { inject, Types } from '@biorate/inversion';
|
|
15
15
|
let TracingInterceptor = class TracingInterceptor {
|
|
@@ -43,6 +43,8 @@ let TracingInterceptor = class TracingInterceptor {
|
|
|
43
43
|
span.setAttribute('incoming.response.statusCode', this.stringify(res.statusCode));
|
|
44
44
|
span.setAttribute('incoming.response.errorCode', this.stringify(e.code));
|
|
45
45
|
span.setAttribute('incoming.response.data', this.stringify(e?.response?.data));
|
|
46
|
+
span.recordException(e);
|
|
47
|
+
span.setStatus({ code: SpanStatusCode.ERROR });
|
|
46
48
|
throw e;
|
|
47
49
|
}), tap((data) => {
|
|
48
50
|
span.setAttribute('incoming.response.headers', this.stringify(res.headers));
|
|
@@ -57,11 +59,12 @@ let TracingInterceptor = class TracingInterceptor {
|
|
|
57
59
|
return next.handle();
|
|
58
60
|
}
|
|
59
61
|
intercept(context, next) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
return trace.getTracer(this.constructor.name).startActiveSpan('incoming', (span) => {
|
|
63
|
+
if (!span)
|
|
64
|
+
return next.handle();
|
|
65
|
+
const type = context.getType();
|
|
66
|
+
return this[type](span, context, next).pipe(finalize(() => span.end()));
|
|
67
|
+
});
|
|
65
68
|
}
|
|
66
69
|
};
|
|
67
70
|
__decorate([
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@biorate/nestjs-tools",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "NestJS tools",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"keywords": [],
|
|
46
46
|
"author": "llevkin",
|
|
47
47
|
"license": "MIT",
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "e24019783b77fff5f6208b83a39055ab216c06b6",
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"@nestjs/common": ">=10.4.15",
|
|
51
51
|
"@nestjs/core": ">=10.4.15",
|
|
@@ -59,11 +59,11 @@
|
|
|
59
59
|
"ws": ">=8.18.0"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@biorate/axios": "^3.
|
|
62
|
+
"@biorate/axios": "^3.4.0",
|
|
63
63
|
"@biorate/config": "^3.2.3",
|
|
64
64
|
"@biorate/errors": "^3.1.2",
|
|
65
65
|
"@biorate/inversion": "^3.1.3",
|
|
66
|
-
"@biorate/opentelemetry": "^2.2.
|
|
66
|
+
"@biorate/opentelemetry": "^2.2.4",
|
|
67
67
|
"@biorate/prometheus": "^3.1.3",
|
|
68
68
|
"@biorate/tools": "^3.1.2",
|
|
69
69
|
"http-proxy": "1.18.1",
|
|
@@ -72,6 +72,8 @@
|
|
|
72
72
|
"on-headers": "1.0.2"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
|
+
"@opentelemetry/api": "1.9.0",
|
|
76
|
+
"@opentelemetry/sdk-trace-base": "2.6.0",
|
|
75
77
|
"@types/json-stringify-safe": "5.0.3"
|
|
76
78
|
}
|
|
77
79
|
}
|