@campxdev/server-shared 2.1.40 → 2.1.41
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/dist/common/filters/unhandled-exception.filter.d.ts +9 -5
- package/dist/common/filters/unhandled-exception.filter.d.ts.map +1 -1
- package/dist/common/filters/unhandled-exception.filter.js +9 -5
- package/dist/common/filters/unhandled-exception.filter.js.map +1 -1
- package/dist/common/guards/guard.d.ts +2 -0
- package/dist/common/guards/guard.d.ts.map +1 -1
- package/dist/common/guards/guard.js +6 -1
- package/dist/common/guards/guard.js.map +1 -1
- package/dist/common/interceptors/request.interceptor.d.ts +2 -0
- package/dist/common/interceptors/request.interceptor.d.ts.map +1 -1
- package/dist/common/interceptors/request.interceptor.js +20 -0
- package/dist/common/interceptors/request.interceptor.js.map +1 -1
- package/dist/common/interfaces/context.interface.d.ts +1 -0
- package/dist/common/interfaces/context.interface.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/microsoft/services/teams-meetings-graph.service.d.ts.map +1 -1
- package/dist/microsoft/services/teams-meetings-graph.service.js +0 -1
- package/dist/microsoft/services/teams-meetings-graph.service.js.map +1 -1
- package/dist/modules-handler/types/exams.types.d.ts +2 -0
- package/dist/modules-handler/types/exams.types.d.ts.map +1 -1
- package/dist/sentry/index.d.ts +6 -0
- package/dist/sentry/index.d.ts.map +1 -0
- package/dist/{observability → sentry}/index.js +5 -4
- package/dist/sentry/index.js.map +1 -0
- package/dist/sentry/sentry-http.filter.d.ts +6 -0
- package/dist/sentry/sentry-http.filter.d.ts.map +1 -0
- package/dist/sentry/sentry-http.filter.js +89 -0
- package/dist/sentry/sentry-http.filter.js.map +1 -0
- package/dist/sentry/sentry-rpc.filter.d.ts +13 -0
- package/dist/sentry/sentry-rpc.filter.d.ts.map +1 -0
- package/dist/sentry/sentry-rpc.filter.js +112 -0
- package/dist/sentry/sentry-rpc.filter.js.map +1 -0
- package/dist/sentry/sentry-sqs.util.d.ts +8 -0
- package/dist/sentry/sentry-sqs.util.d.ts.map +1 -0
- package/dist/sentry/sentry-sqs.util.js +67 -0
- package/dist/sentry/sentry-sqs.util.js.map +1 -0
- package/dist/sentry/sentry.module.d.ts +21 -0
- package/dist/sentry/sentry.module.d.ts.map +1 -0
- package/dist/sentry/sentry.module.js +103 -0
- package/dist/sentry/sentry.module.js.map +1 -0
- package/dist/sentry/sentry.service.d.ts +21 -0
- package/dist/sentry/sentry.service.d.ts.map +1 -0
- package/dist/{observability/telemetry.service.js → sentry/sentry.service.js} +45 -26
- package/dist/sentry/sentry.service.js.map +1 -0
- package/package.json +1 -1
- package/dist/observability/index.d.ts +0 -5
- package/dist/observability/index.d.ts.map +0 -1
- package/dist/observability/index.js.map +0 -1
- package/dist/observability/telemetry.module.d.ts +0 -4
- package/dist/observability/telemetry.module.d.ts.map +0 -1
- package/dist/observability/telemetry.module.js +0 -33
- package/dist/observability/telemetry.module.js.map +0 -1
- package/dist/observability/telemetry.service.d.ts +0 -10
- package/dist/observability/telemetry.service.d.ts.map +0 -1
- package/dist/observability/telemetry.service.js.map +0 -1
- package/dist/observability/traced.decorator.d.ts +0 -6
- package/dist/observability/traced.decorator.d.ts.map +0 -1
- package/dist/observability/traced.decorator.js +0 -51
- package/dist/observability/traced.decorator.js.map +0 -1
- package/dist/observability/tracing.interceptor.d.ts +0 -14
- package/dist/observability/tracing.interceptor.d.ts.map +0 -1
- package/dist/observability/tracing.interceptor.js +0 -119
- package/dist/observability/tracing.interceptor.js.map +0 -1
- package/dist/otel-sdk.d.ts +0 -10
- package/dist/otel-sdk.d.ts.map +0 -1
- package/dist/otel-sdk.js +0 -154
- package/dist/otel-sdk.js.map +0 -1
|
@@ -0,0 +1,112 @@
|
|
|
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
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
|
+
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
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
|
+
};
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.SentryRpcFilter = void 0;
|
|
43
|
+
const common_1 = require("@nestjs/common");
|
|
44
|
+
const microservices_1 = require("@nestjs/microservices");
|
|
45
|
+
const Sentry = __importStar(require("@sentry/nestjs"));
|
|
46
|
+
const tenant_context_1 = require("../request-store/contexts/tenant-context");
|
|
47
|
+
const user_context_1 = require("../request-store/contexts/user-context");
|
|
48
|
+
/**
|
|
49
|
+
* Enhanced Sentry RPC Filter that replaces the old UnhandledExceptionFilter.
|
|
50
|
+
* It captures 5xx exceptions to Sentry with full context and ensures the original
|
|
51
|
+
* status code and response are preserved for the API Gateway.
|
|
52
|
+
*
|
|
53
|
+
* IMPORTANT: Uses synchronous `throw` (not `throwError` Observable) so NestJS's
|
|
54
|
+
* RabbitMQ transport correctly serializes the RpcException back to the gateway.
|
|
55
|
+
*/
|
|
56
|
+
let SentryRpcFilter = class SentryRpcFilter {
|
|
57
|
+
catch(exception, host) {
|
|
58
|
+
/** 1. Extract status and response from the exception */
|
|
59
|
+
const status = exception instanceof common_1.HttpException
|
|
60
|
+
? exception.getStatus()
|
|
61
|
+
: (exception['status'] || 500);
|
|
62
|
+
const response = exception instanceof common_1.HttpException
|
|
63
|
+
? exception.getResponse()
|
|
64
|
+
: (exception['response'] || null);
|
|
65
|
+
/** 2. Report to Sentry for 3xx, 4xx, 5xx — ignore 2xx success responses */
|
|
66
|
+
if (status >= 300 || !(exception instanceof common_1.HttpException)) {
|
|
67
|
+
Sentry.withScope((scope) => {
|
|
68
|
+
const user = (0, user_context_1.getUserData)();
|
|
69
|
+
const tenant = (0, tenant_context_1.getTenantDetailsIfExists)();
|
|
70
|
+
if (user) {
|
|
71
|
+
scope.setUser({
|
|
72
|
+
id: String(user.userId || user.id),
|
|
73
|
+
email: user.email,
|
|
74
|
+
});
|
|
75
|
+
scope.setTag('user_db_id', String(user.id));
|
|
76
|
+
}
|
|
77
|
+
if (tenant) {
|
|
78
|
+
scope.setTag('tenant_id', tenant.id);
|
|
79
|
+
}
|
|
80
|
+
scope.setTag('transport', 'microservice');
|
|
81
|
+
Sentry.captureException(exception);
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
/** 3. Already an RpcException — re-throw as-is */
|
|
85
|
+
if (exception instanceof microservices_1.RpcException) {
|
|
86
|
+
throw exception;
|
|
87
|
+
}
|
|
88
|
+
/** 4. HttpException (400, 404, 422, 500, etc.) — wrap with statusCode + response preserved */
|
|
89
|
+
if (status && response) {
|
|
90
|
+
throw new microservices_1.RpcException({
|
|
91
|
+
statusCode: status,
|
|
92
|
+
response: response,
|
|
93
|
+
message: exception.message,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
/** 5. Unknown error fallback */
|
|
97
|
+
throw new microservices_1.RpcException({
|
|
98
|
+
statusCode: 500,
|
|
99
|
+
response: {
|
|
100
|
+
statusCode: 500,
|
|
101
|
+
error: 'Internal Server Error',
|
|
102
|
+
message: exception.message,
|
|
103
|
+
},
|
|
104
|
+
message: exception.message,
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
exports.SentryRpcFilter = SentryRpcFilter;
|
|
109
|
+
exports.SentryRpcFilter = SentryRpcFilter = __decorate([
|
|
110
|
+
(0, common_1.Catch)()
|
|
111
|
+
], SentryRpcFilter);
|
|
112
|
+
//# sourceMappingURL=sentry-rpc.filter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sentry-rpc.filter.js","sourceRoot":"","sources":["../../src/sentry/sentry-rpc.filter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAAsF;AACtF,yDAAqD;AACrD,uDAAyC;AACzC,6EAAoF;AACpF,yEAAqE;AAErE;;;;;;;GAOG;AAEI,IAAM,eAAe,GAArB,MAAM,eAAe;IAC1B,KAAK,CAAC,SAAc,EAAE,IAAmB;QACvC,wDAAwD;QACxD,MAAM,MAAM,GAAG,SAAS,YAAY,sBAAa;YAC/C,CAAC,CAAC,SAAS,CAAC,SAAS,EAAE;YACvB,CAAC,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,GAAG,CAAC,CAAC;QACjC,MAAM,QAAQ,GAAG,SAAS,YAAY,sBAAa;YACjD,CAAC,CAAC,SAAS,CAAC,WAAW,EAAE;YACzB,CAAC,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,IAAI,CAAC,CAAC;QAEpC,2EAA2E;QAC3E,IAAI,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,SAAS,YAAY,sBAAa,CAAC,EAAE,CAAC;YAC3D,MAAM,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE;gBACzB,MAAM,IAAI,GAAG,IAAA,0BAAW,GAAE,CAAC;gBAC3B,MAAM,MAAM,GAAG,IAAA,yCAAwB,GAAE,CAAC;gBAE1C,IAAI,IAAI,EAAE,CAAC;oBACT,KAAK,CAAC,OAAO,CAAC;wBACZ,EAAE,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,EAAE,CAAC;wBAClC,KAAK,EAAE,IAAI,CAAC,KAAK;qBAClB,CAAC,CAAC;oBACH,KAAK,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;gBAC9C,CAAC;gBAED,IAAI,MAAM,EAAE,CAAC;oBACX,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC;gBACvC,CAAC;gBAED,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;gBAC1C,MAAM,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;YACrC,CAAC,CAAC,CAAC;QACL,CAAC;QAED,kDAAkD;QAClD,IAAI,SAAS,YAAY,4BAAY,EAAE,CAAC;YACtC,MAAM,SAAS,CAAC;QAClB,CAAC;QAED,8FAA8F;QAC9F,IAAI,MAAM,IAAI,QAAQ,EAAE,CAAC;YACvB,MAAM,IAAI,4BAAY,CAAC;gBACrB,UAAU,EAAE,MAAM;gBAClB,QAAQ,EAAE,QAAQ;gBAClB,OAAO,EAAE,SAAS,CAAC,OAAO;aAC3B,CAAC,CAAC;QACL,CAAC;QAED,gCAAgC;QAChC,MAAM,IAAI,4BAAY,CAAC;YACrB,UAAU,EAAE,GAAG;YACf,QAAQ,EAAE;gBACR,UAAU,EAAE,GAAG;gBACf,KAAK,EAAE,uBAAuB;gBAC9B,OAAO,EAAE,SAAS,CAAC,OAAO;aAC3B;YACD,OAAO,EAAE,SAAS,CAAC,OAAO;SAC3B,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AA1DY,0CAAe;0BAAf,eAAe;IAD3B,IAAA,cAAK,GAAE;GACK,eAAe,CA0D3B"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility to wrap SQS message handlers with Sentry error capture.
|
|
3
|
+
* @param queueName - The name of the SQS queue.
|
|
4
|
+
* @param handler - The message processing logic.
|
|
5
|
+
* @returns A wrapped handler.
|
|
6
|
+
*/
|
|
7
|
+
export declare function withSentrySqs(queueName: string, handler: (...args: any[]) => Promise<any>): (...args: any[]) => Promise<any>;
|
|
8
|
+
//# sourceMappingURL=sentry-sqs.util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sentry-sqs.util.d.ts","sourceRoot":"","sources":["../../src/sentry/sentry-sqs.util.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,GAAG,CAAC,IAC1E,GAAG,MAAM,GAAG,EAAE,kBAuB7B"}
|
|
@@ -0,0 +1,67 @@
|
|
|
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
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.withSentrySqs = withSentrySqs;
|
|
37
|
+
const Sentry = __importStar(require("@sentry/nestjs"));
|
|
38
|
+
/**
|
|
39
|
+
* Utility to wrap SQS message handlers with Sentry error capture.
|
|
40
|
+
* @param queueName - The name of the SQS queue.
|
|
41
|
+
* @param handler - The message processing logic.
|
|
42
|
+
* @returns A wrapped handler.
|
|
43
|
+
*/
|
|
44
|
+
function withSentrySqs(queueName, handler) {
|
|
45
|
+
return async (...args) => {
|
|
46
|
+
try {
|
|
47
|
+
Sentry.addBreadcrumb({
|
|
48
|
+
category: 'sqs',
|
|
49
|
+
message: `Processing message from queue: ${queueName}`,
|
|
50
|
+
level: 'info',
|
|
51
|
+
});
|
|
52
|
+
return await handler(...args);
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
Sentry.withScope((scope) => {
|
|
56
|
+
scope.setTag('queue.name', queueName);
|
|
57
|
+
scope.setContext('sqs.message', {
|
|
58
|
+
queue: queueName,
|
|
59
|
+
payload: args[0], // Assumes message body is the first argument
|
|
60
|
+
});
|
|
61
|
+
Sentry.captureException(error);
|
|
62
|
+
});
|
|
63
|
+
throw error; // Re-throw so SQS can handle the retry/DLQ
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=sentry-sqs.util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sentry-sqs.util.js","sourceRoot":"","sources":["../../src/sentry/sentry-sqs.util.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,sCAwBC;AAhCD,uDAAyC;AAEzC;;;;;GAKG;AACH,SAAgB,aAAa,CAAC,SAAiB,EAAE,OAAyC;IACxF,OAAO,KAAK,EAAE,GAAG,IAAW,EAAE,EAAE;QAC9B,IAAI,CAAC;YACH,MAAM,CAAC,aAAa,CAAC;gBACnB,QAAQ,EAAE,KAAK;gBACf,OAAO,EAAE,kCAAkC,SAAS,EAAE;gBACtD,KAAK,EAAE,MAAM;aACd,CAAC,CAAC;YAEH,OAAO,MAAM,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC;QAChC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE;gBACzB,KAAK,CAAC,MAAM,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;gBACtC,KAAK,CAAC,UAAU,CAAC,aAAa,EAAE;oBAC9B,KAAK,EAAE,SAAS;oBAChB,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,6CAA6C;iBAChE,CAAC,CAAC;gBAEH,MAAM,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;YACjC,CAAC,CAAC,CAAC;YAEH,MAAM,KAAK,CAAC,CAAC,2CAA2C;QAC1D,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { DynamicModule } from '@nestjs/common';
|
|
2
|
+
export interface SentryModuleOptions {
|
|
3
|
+
dsn: string;
|
|
4
|
+
environment: string;
|
|
5
|
+
release?: string;
|
|
6
|
+
tracesSampleRate?: number;
|
|
7
|
+
}
|
|
8
|
+
export interface SentryModuleAsyncOptions {
|
|
9
|
+
imports?: any[];
|
|
10
|
+
inject?: any[];
|
|
11
|
+
useFactory: (...args: any[]) => Promise<SentryModuleOptions> | SentryModuleOptions;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Early initialization function to be called in instrument.ts
|
|
15
|
+
*/
|
|
16
|
+
export declare function initSentry(options: SentryModuleOptions): void;
|
|
17
|
+
export declare class SentryModule {
|
|
18
|
+
static forRoot(options: SentryModuleOptions): DynamicModule;
|
|
19
|
+
static forRootAsync(options: SentryModuleAsyncOptions): DynamicModule;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=sentry.module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sentry.module.d.ts","sourceRoot":"","sources":["../../src/sentry/sentry.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAA4B,MAAM,gBAAgB,CAAC;AAKzE,MAAM,WAAW,mBAAmB;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,wBAAwB;IACvC,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC;IAChB,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC;IACf,UAAU,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,mBAAmB,CAAC,GAAG,mBAAmB,CAAC;CACpF;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,mBAAmB,QAYtD;AAED,qBAKa,YAAY;IACvB,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,mBAAmB,GAAG,aAAa;IAc3D,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,wBAAwB,GAAG,aAAa;CAiBtE"}
|
|
@@ -0,0 +1,103 @@
|
|
|
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
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
|
+
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
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
|
+
};
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
var SentryModule_1;
|
|
42
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
|
+
exports.SentryModule = void 0;
|
|
44
|
+
exports.initSentry = initSentry;
|
|
45
|
+
const common_1 = require("@nestjs/common");
|
|
46
|
+
const Sentry = __importStar(require("@sentry/nestjs"));
|
|
47
|
+
const profiling_node_1 = require("@sentry/profiling-node");
|
|
48
|
+
const sentry_service_1 = require("./sentry.service");
|
|
49
|
+
/**
|
|
50
|
+
* Early initialization function to be called in instrument.ts
|
|
51
|
+
*/
|
|
52
|
+
function initSentry(options) {
|
|
53
|
+
console.log(`[Sentry] Initializing with DSN: ${options.dsn ? 'FOUND' : 'MISSING'} in environment: ${options.environment}`);
|
|
54
|
+
if (!options.dsn)
|
|
55
|
+
return;
|
|
56
|
+
Sentry.init({
|
|
57
|
+
dsn: options.dsn,
|
|
58
|
+
environment: options.environment,
|
|
59
|
+
release: options.release,
|
|
60
|
+
tracesSampleRate: options.tracesSampleRate ?? (options.environment === 'production' ? 0.05 : 1.0),
|
|
61
|
+
integrations: [(0, profiling_node_1.nodeProfilingIntegration)()],
|
|
62
|
+
profilesSampleRate: 1.0,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
let SentryModule = SentryModule_1 = class SentryModule {
|
|
66
|
+
static forRoot(options) {
|
|
67
|
+
initSentry(options);
|
|
68
|
+
return {
|
|
69
|
+
module: SentryModule_1,
|
|
70
|
+
providers: [
|
|
71
|
+
{
|
|
72
|
+
provide: 'SENTRY_OPTIONS',
|
|
73
|
+
useValue: options,
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
static forRootAsync(options) {
|
|
79
|
+
const provider = {
|
|
80
|
+
provide: 'SENTRY_OPTIONS',
|
|
81
|
+
useFactory: async (...args) => {
|
|
82
|
+
const config = await options.useFactory(...args);
|
|
83
|
+
initSentry(config);
|
|
84
|
+
return config;
|
|
85
|
+
},
|
|
86
|
+
inject: options.inject || [],
|
|
87
|
+
};
|
|
88
|
+
return {
|
|
89
|
+
module: SentryModule_1,
|
|
90
|
+
imports: options.imports || [],
|
|
91
|
+
providers: [provider],
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
exports.SentryModule = SentryModule;
|
|
96
|
+
exports.SentryModule = SentryModule = SentryModule_1 = __decorate([
|
|
97
|
+
(0, common_1.Global)(),
|
|
98
|
+
(0, common_1.Module)({
|
|
99
|
+
providers: [sentry_service_1.SentryService],
|
|
100
|
+
exports: [sentry_service_1.SentryService],
|
|
101
|
+
})
|
|
102
|
+
], SentryModule);
|
|
103
|
+
//# sourceMappingURL=sentry.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sentry.module.js","sourceRoot":"","sources":["../../src/sentry/sentry.module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,gCAYC;AAjCD,2CAAyE;AACzE,uDAAyC;AACzC,2DAAkE;AAClE,qDAAiD;AAejD;;GAEG;AACH,SAAgB,UAAU,CAAC,OAA4B;IACrD,OAAO,CAAC,GAAG,CAAC,mCAAmC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,oBAAoB,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;IAC3H,IAAI,CAAC,OAAO,CAAC,GAAG;QAAE,OAAO;IAEzB,MAAM,CAAC,IAAI,CAAC;QACV,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,gBAAgB,EAAE,OAAO,CAAC,gBAAgB,IAAI,CAAC,OAAO,CAAC,WAAW,KAAK,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC;QACjG,YAAY,EAAE,CAAC,IAAA,yCAAwB,GAAE,CAAC;QAC1C,kBAAkB,EAAE,GAAG;KACxB,CAAC,CAAC;AACL,CAAC;AAOM,IAAM,YAAY,oBAAlB,MAAM,YAAY;IACvB,MAAM,CAAC,OAAO,CAAC,OAA4B;QACzC,UAAU,CAAC,OAAO,CAAC,CAAC;QAEpB,OAAO;YACL,MAAM,EAAE,cAAY;YACpB,SAAS,EAAE;gBACT;oBACE,OAAO,EAAE,gBAAgB;oBACzB,QAAQ,EAAE,OAAO;iBAClB;aACF;SACF,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,YAAY,CAAC,OAAiC;QACnD,MAAM,QAAQ,GAAa;YACzB,OAAO,EAAE,gBAAgB;YACzB,UAAU,EAAE,KAAK,EAAE,GAAG,IAAW,EAAE,EAAE;gBACnC,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC,CAAC;gBACjD,UAAU,CAAC,MAAM,CAAC,CAAC;gBACnB,OAAO,MAAM,CAAC;YAChB,CAAC;YACD,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,EAAE;SAC7B,CAAC;QAEF,OAAO;YACL,MAAM,EAAE,cAAY;YACpB,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,EAAE;YAC9B,SAAS,EAAE,CAAC,QAAQ,CAAC;SACtB,CAAC;IACJ,CAAC;CACF,CAAA;AAhCY,oCAAY;uBAAZ,YAAY;IALxB,IAAA,eAAM,GAAE;IACR,IAAA,eAAM,EAAC;QACN,SAAS,EAAE,CAAC,8BAAa,CAAC;QAC1B,OAAO,EAAE,CAAC,8BAAa,CAAC;KACzB,CAAC;GACW,YAAY,CAgCxB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as Sentry from '@sentry/nestjs';
|
|
2
|
+
export declare class SentryService {
|
|
3
|
+
private readonly logger;
|
|
4
|
+
/**
|
|
5
|
+
* Capture an exception to Sentry
|
|
6
|
+
*/
|
|
7
|
+
captureException(exception: any, context?: string): void;
|
|
8
|
+
/**
|
|
9
|
+
* Add a breadcrumb to the current Sentry scope
|
|
10
|
+
*/
|
|
11
|
+
addBreadcrumb(message: string, data?: Record<string, any>, level?: Sentry.SeverityLevel): void;
|
|
12
|
+
/**
|
|
13
|
+
* Manually set user context for the current scope
|
|
14
|
+
*/
|
|
15
|
+
setUserContext(userId: string | number, tenantId?: string): void;
|
|
16
|
+
/**
|
|
17
|
+
* Set additional tags for the current scope
|
|
18
|
+
*/
|
|
19
|
+
setTags(tags: Record<string, string>): void;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=sentry.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sentry.service.d.ts","sourceRoot":"","sources":["../../src/sentry/sentry.service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAC;AAEzC,qBACa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkC;IAEzD;;OAEG;IACH,gBAAgB,CAAC,SAAS,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI;IAWxD;;OAEG;IACH,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,KAAK,GAAE,MAAM,CAAC,aAAsB,GAAG,IAAI;IAQtG;;OAEG;IACH,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI;IAOhE;;OAEG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI;CAG5C"}
|
|
@@ -38,36 +38,55 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
38
38
|
return result;
|
|
39
39
|
};
|
|
40
40
|
})();
|
|
41
|
-
var
|
|
41
|
+
var SentryService_1;
|
|
42
42
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
|
-
exports.
|
|
43
|
+
exports.SentryService = void 0;
|
|
44
44
|
const common_1 = require("@nestjs/common");
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
})
|
|
57
|
-
if (!otelSDK)
|
|
58
|
-
return;
|
|
59
|
-
this.logger.log('Shutting down OpenTelemetry SDK...');
|
|
60
|
-
/** Flush all pending spans before process termination */
|
|
61
|
-
await otelSDK.shutdown();
|
|
62
|
-
this.logger.log('OpenTelemetry SDK shutdown complete');
|
|
45
|
+
const Sentry = __importStar(require("@sentry/nestjs"));
|
|
46
|
+
let SentryService = SentryService_1 = class SentryService {
|
|
47
|
+
logger = new common_1.Logger(SentryService_1.name);
|
|
48
|
+
/**
|
|
49
|
+
* Capture an exception to Sentry
|
|
50
|
+
*/
|
|
51
|
+
captureException(exception, context) {
|
|
52
|
+
if (context) {
|
|
53
|
+
Sentry.withScope((scope) => {
|
|
54
|
+
scope.setTag('context', context);
|
|
55
|
+
Sentry.captureException(exception);
|
|
56
|
+
});
|
|
63
57
|
}
|
|
64
|
-
|
|
65
|
-
|
|
58
|
+
else {
|
|
59
|
+
Sentry.captureException(exception);
|
|
66
60
|
}
|
|
67
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* Add a breadcrumb to the current Sentry scope
|
|
64
|
+
*/
|
|
65
|
+
addBreadcrumb(message, data, level = 'info') {
|
|
66
|
+
Sentry.addBreadcrumb({
|
|
67
|
+
message,
|
|
68
|
+
data,
|
|
69
|
+
level,
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Manually set user context for the current scope
|
|
74
|
+
*/
|
|
75
|
+
setUserContext(userId, tenantId) {
|
|
76
|
+
Sentry.setUser({
|
|
77
|
+
id: String(userId),
|
|
78
|
+
tenant: tenantId,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Set additional tags for the current scope
|
|
83
|
+
*/
|
|
84
|
+
setTags(tags) {
|
|
85
|
+
Sentry.setTags(tags);
|
|
86
|
+
}
|
|
68
87
|
};
|
|
69
|
-
exports.
|
|
70
|
-
exports.
|
|
88
|
+
exports.SentryService = SentryService;
|
|
89
|
+
exports.SentryService = SentryService = SentryService_1 = __decorate([
|
|
71
90
|
(0, common_1.Injectable)()
|
|
72
|
-
],
|
|
73
|
-
//# sourceMappingURL=
|
|
91
|
+
], SentryService);
|
|
92
|
+
//# sourceMappingURL=sentry.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sentry.service.js","sourceRoot":"","sources":["../../src/sentry/sentry.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAAoD;AACpD,uDAAyC;AAGlC,IAAM,aAAa,qBAAnB,MAAM,aAAa;IACP,MAAM,GAAG,IAAI,eAAM,CAAC,eAAa,CAAC,IAAI,CAAC,CAAC;IAEzD;;OAEG;IACH,gBAAgB,CAAC,SAAc,EAAE,OAAgB;QAC/C,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE;gBACzB,KAAK,CAAC,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;gBACjC,MAAM,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;YACrC,CAAC,CAAC,CAAC;QACL,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;QACrC,CAAC;IACH,CAAC;IAED;;OAEG;IACH,aAAa,CAAC,OAAe,EAAE,IAA0B,EAAE,QAA8B,MAAM;QAC7F,MAAM,CAAC,aAAa,CAAC;YACnB,OAAO;YACP,IAAI;YACJ,KAAK;SACN,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,cAAc,CAAC,MAAuB,EAAE,QAAiB;QACvD,MAAM,CAAC,OAAO,CAAC;YACb,EAAE,EAAE,MAAM,CAAC,MAAM,CAAC;YAClB,MAAM,EAAE,QAAQ;SACjB,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,OAAO,CAAC,IAA4B;QAClC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,CAAC;CACF,CAAA;AA5CY,sCAAa;wBAAb,aAAa;IADzB,IAAA,mBAAU,GAAE;GACA,aAAa,CA4CzB"}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/observability/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/observability/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,sDAAoC;AACpC,wDAAsC;AACtC,qDAAmC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"telemetry.module.d.ts","sourceRoot":"","sources":["../../src/observability/telemetry.module.ts"],"names":[],"mappings":"AAMA,4EAA4E;AAC5E,qBAaa,eAAe;CAAG"}
|
|
@@ -1,33 +0,0 @@
|
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.TelemetryModule = void 0;
|
|
10
|
-
const common_1 = require("@nestjs/common");
|
|
11
|
-
const core_1 = require("@nestjs/core");
|
|
12
|
-
const telemetry_service_1 = require("./telemetry.service");
|
|
13
|
-
const tracing_interceptor_1 = require("./tracing.interceptor");
|
|
14
|
-
/** Global NestJS module for managing OpenTelemetry lifecycle and tracing */
|
|
15
|
-
let TelemetryModule = class TelemetryModule {
|
|
16
|
-
};
|
|
17
|
-
exports.TelemetryModule = TelemetryModule;
|
|
18
|
-
exports.TelemetryModule = TelemetryModule = __decorate([
|
|
19
|
-
(0, common_1.Global)(),
|
|
20
|
-
(0, common_1.Module)({
|
|
21
|
-
providers: [
|
|
22
|
-
/** Provide service for graceful shutdown */
|
|
23
|
-
telemetry_service_1.TelemetryService,
|
|
24
|
-
/** Register global interceptor for automated span creation */
|
|
25
|
-
{
|
|
26
|
-
provide: core_1.APP_INTERCEPTOR,
|
|
27
|
-
useClass: tracing_interceptor_1.TracingInterceptor,
|
|
28
|
-
},
|
|
29
|
-
],
|
|
30
|
-
exports: [telemetry_service_1.TelemetryService],
|
|
31
|
-
})
|
|
32
|
-
], TelemetryModule);
|
|
33
|
-
//# sourceMappingURL=telemetry.module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"telemetry.module.js","sourceRoot":"","sources":["../../src/observability/telemetry.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAgD;AAChD,uCAA+C;AAE/C,2DAAuD;AACvD,+DAA2D;AAE3D,4EAA4E;AAcrE,IAAM,eAAe,GAArB,MAAM,eAAe;CAAG,CAAA;AAAlB,0CAAe;0BAAf,eAAe;IAb3B,IAAA,eAAM,GAAE;IACR,IAAA,eAAM,EAAC;QACN,SAAS,EAAE;YACT,4CAA4C;YAC5C,oCAAgB;YAChB,8DAA8D;YAC9D;gBACE,OAAO,EAAE,sBAAe;gBACxB,QAAQ,EAAE,wCAAkB;aAC7B;SACF;QACD,OAAO,EAAE,CAAC,oCAAgB,CAAC;KAC5B,CAAC;GACW,eAAe,CAAG"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { OnModuleDestroy } from '@nestjs/common';
|
|
2
|
-
/**
|
|
3
|
-
* Service to manage the graceful shutdown of OpenTelemetry.
|
|
4
|
-
*/
|
|
5
|
-
export declare class TelemetryService implements OnModuleDestroy {
|
|
6
|
-
private readonly logger;
|
|
7
|
-
/** Triggered when the NestJS module is being destroyed */
|
|
8
|
-
onModuleDestroy(): Promise<void>;
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=telemetry.service.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"telemetry.service.d.ts","sourceRoot":"","sources":["../../src/observability/telemetry.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,eAAe,EAAU,MAAM,gBAAgB,CAAC;AAErE;;GAEG;AACH,qBACa,gBAAiB,YAAW,eAAe;IACtD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAqC;IAE5D,0DAA0D;IACpD,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;CAgBvC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"telemetry.service.js","sourceRoot":"","sources":["../../src/observability/telemetry.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAAqE;AAErE;;GAEG;AAEI,IAAM,gBAAgB,wBAAtB,MAAM,gBAAgB;IACV,MAAM,GAAG,IAAI,eAAM,CAAC,kBAAgB,CAAC,IAAI,CAAC,CAAC;IAE5D,0DAA0D;IAC1D,KAAK,CAAC,eAAe;QACnB,IAAI,CAAC;YACH,+DAA+D;YAC/D,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,kDAAO,aAAa,IAAE,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC;gBAC3D,OAAO,EAAE,IAAI;aACd,CAAC,CAAC,CAAC;YACJ,IAAI,CAAC,OAAO;gBAAE,OAAO;YAErB,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAC;YACtD,yDAAyD;YACzD,MAAM,OAAO,CAAC,QAAQ,EAAE,CAAC;YACzB,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAC;QACzD,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,8BAA8B,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC;QAC/D,CAAC;IACH,CAAC;CACF,CAAA;AApBY,4CAAgB;2BAAhB,gBAAgB;IAD5B,IAAA,mBAAU,GAAE;GACA,gBAAgB,CAoB5B"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Method decorator to wrap methods in an OpenTelemetry Span.
|
|
3
|
-
* Captures duration, parameters, and errors automatically.
|
|
4
|
-
*/
|
|
5
|
-
export declare function Traced(spanName?: string): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
6
|
-
//# sourceMappingURL=traced.decorator.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"traced.decorator.d.ts","sourceRoot":"","sources":["../../src/observability/traced.decorator.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,MAAM,CAAC,QAAQ,CAAC,EAAE,MAAM,IACrB,QAAQ,GAAG,EAAE,aAAa,MAAM,EAAE,YAAY,kBAAkB,wBA4ClF"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Traced = Traced;
|
|
4
|
-
const api_1 = require("@opentelemetry/api");
|
|
5
|
-
/**
|
|
6
|
-
* Method decorator to wrap methods in an OpenTelemetry Span.
|
|
7
|
-
* Captures duration, parameters, and errors automatically.
|
|
8
|
-
*/
|
|
9
|
-
function Traced(spanName) {
|
|
10
|
-
return function (target, propertyKey, descriptor) {
|
|
11
|
-
/** Keep reference to the original method */
|
|
12
|
-
const originalMethod = descriptor.value;
|
|
13
|
-
/** Initialize tracer with service metadata */
|
|
14
|
-
const tracer = api_1.trace.getTracer(process.env.OTEL_SERVICE_NAME || 'service', process.env.OTEL_SERVICE_VERSION || '1.0.0');
|
|
15
|
-
/** Override descriptor with traced logic */
|
|
16
|
-
descriptor.value = async function (...args) {
|
|
17
|
-
/** Use provided name or default to Class.Method */
|
|
18
|
-
const name = spanName || `${target.constructor.name}.${propertyKey}`;
|
|
19
|
-
/** Start an internal span for the method execution */
|
|
20
|
-
return tracer.startActiveSpan(name, { kind: api_1.SpanKind.INTERNAL }, async (span) => {
|
|
21
|
-
try {
|
|
22
|
-
/** Tag span with class and function details */
|
|
23
|
-
span.setAttributes({
|
|
24
|
-
'code.class': target.constructor.name,
|
|
25
|
-
'code.function': propertyKey,
|
|
26
|
-
});
|
|
27
|
-
/** Execute the original logic */
|
|
28
|
-
const result = await originalMethod.apply(this, args);
|
|
29
|
-
/** Mark span status as OK on success */
|
|
30
|
-
span.setStatus({ code: api_1.SpanStatusCode.OK });
|
|
31
|
-
return result;
|
|
32
|
-
}
|
|
33
|
-
catch (error) {
|
|
34
|
-
/** Record the exception and set error status on failure */
|
|
35
|
-
span.recordException(error);
|
|
36
|
-
span.setStatus({
|
|
37
|
-
code: api_1.SpanStatusCode.ERROR,
|
|
38
|
-
message: error.message,
|
|
39
|
-
});
|
|
40
|
-
throw error;
|
|
41
|
-
}
|
|
42
|
-
finally {
|
|
43
|
-
/** Ensure span is ended in all cases */
|
|
44
|
-
span.end();
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
|
-
return descriptor;
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
//# sourceMappingURL=traced.decorator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"traced.decorator.js","sourceRoot":"","sources":["../../src/observability/traced.decorator.ts"],"names":[],"mappings":";;AAMA,wBA6CC;AAnDD,4CAAqE;AAErE;;;GAGG;AACH,SAAgB,MAAM,CAAC,QAAiB;IACtC,OAAO,UAAU,MAAW,EAAE,WAAmB,EAAE,UAA8B;QAC/E,4CAA4C;QAC5C,MAAM,cAAc,GAAG,UAAU,CAAC,KAAK,CAAC;QACxC,8CAA8C;QAC9C,MAAM,MAAM,GAAG,WAAK,CAAC,SAAS,CAC5B,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,SAAS,EAC1C,OAAO,CAAC,GAAG,CAAC,oBAAoB,IAAI,OAAO,CAC5C,CAAC;QAEF,4CAA4C;QAC5C,UAAU,CAAC,KAAK,GAAG,KAAK,WAAW,GAAG,IAAW;YAC/C,mDAAmD;YACnD,MAAM,IAAI,GAAG,QAAQ,IAAI,GAAG,MAAM,CAAC,WAAW,CAAC,IAAI,IAAI,WAAW,EAAE,CAAC;YAErE,sDAAsD;YACtD,OAAO,MAAM,CAAC,eAAe,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,cAAQ,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;gBAC9E,IAAI,CAAC;oBACH,+CAA+C;oBAC/C,IAAI,CAAC,aAAa,CAAC;wBACjB,YAAY,EAAE,MAAM,CAAC,WAAW,CAAC,IAAI;wBACrC,eAAe,EAAE,WAAW;qBAC7B,CAAC,CAAC;oBACH,iCAAiC;oBACjC,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;oBACtD,wCAAwC;oBACxC,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,oBAAc,CAAC,EAAE,EAAE,CAAC,CAAC;oBAC5C,OAAO,MAAM,CAAC;gBAChB,CAAC;gBAAC,OAAO,KAAU,EAAE,CAAC;oBACpB,2DAA2D;oBAC3D,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;oBAC5B,IAAI,CAAC,SAAS,CAAC;wBACb,IAAI,EAAE,oBAAc,CAAC,KAAK;wBAC1B,OAAO,EAAE,KAAK,CAAC,OAAO;qBACvB,CAAC,CAAC;oBACH,MAAM,KAAK,CAAC;gBACd,CAAC;wBAAS,CAAC;oBACT,wCAAwC;oBACxC,IAAI,CAAC,GAAG,EAAE,CAAC;gBACb,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;QAEF,OAAO,UAAU,CAAC;IACpB,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { CallHandler, ExecutionContext, NestInterceptor } from '@nestjs/common';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
/**
|
|
4
|
-
* Interceptor to automatically create spans for NestJS handlers.
|
|
5
|
-
*/
|
|
6
|
-
export declare class TracingInterceptor implements NestInterceptor {
|
|
7
|
-
/** Initialize the tracer with service metadata */
|
|
8
|
-
private readonly tracer;
|
|
9
|
-
/** Initialize a meter for tracking request metrics */
|
|
10
|
-
private readonly meter;
|
|
11
|
-
private readonly requestCounter;
|
|
12
|
-
intercept(context: ExecutionContext, next: CallHandler): Observable<any>;
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=tracing.interceptor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tracing.interceptor.d.ts","sourceRoot":"","sources":["../../src/observability/tracing.interceptor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAc,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAE5F,OAAO,EAAE,UAAU,EAAc,MAAM,MAAM,CAAC;AAM9C;;GAEG;AACH,qBACa,kBAAmB,YAAW,eAAe;IACxD,kDAAkD;IAClD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAGrB;IAEF,sDAAsD;IACtD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA2C;IACjE,OAAO,CAAC,QAAQ,CAAC,cAAc,CAE5B;IAEH,SAAS,CAAC,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,WAAW,GAAG,UAAU,CAAC,GAAG,CAAC;CA0FzE"}
|