@yolo-croket-dev/core 1.7.4-datadog.9 → 1.7.4

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.
@@ -28,6 +28,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
28
28
  __setModuleDefault(result, mod);
29
29
  return result;
30
30
  };
31
+ var __importDefault = (this && this.__importDefault) || function (mod) {
32
+ return (mod && mod.__esModule) ? mod : { "default": mod };
33
+ };
31
34
  Object.defineProperty(exports, "__esModule", { value: true });
32
35
  exports.LoggingServiceInterceptor = void 0;
33
36
  /* eslint-disable @typescript-eslint/no-explicit-any */
@@ -35,9 +38,11 @@ exports.LoggingServiceInterceptor = void 0;
35
38
  const common_1 = require("@nestjs/common");
36
39
  const msa_logger_1 = __importStar(require("@yolo-croket-dev/msa-logger"));
37
40
  const operators_1 = require("rxjs/operators");
41
+ const dd_trace_1 = __importDefault(require("dd-trace"));
38
42
  const { SERVER_NAME } = process.env;
39
43
  const msaLogger = new msa_logger_1.default(msa_logger_1.ServerTypeEnum.SERVICE);
40
44
  const MAX_CUT_LENGTH = 500;
45
+ dd_trace_1.default.init();
41
46
  let LoggingServiceInterceptor = class LoggingServiceInterceptor {
42
47
  keyCutter(data) {
43
48
  try {
@@ -101,6 +106,14 @@ let LoggingServiceInterceptor = class LoggingServiceInterceptor {
101
106
  froms: pastFroms,
102
107
  },
103
108
  });
109
+ const currentSpan = dd_trace_1.default.scope().active();
110
+ const loggingSpan = dd_trace_1.default.startSpan(`logging-service-interceptor-${content.pattern}`, {
111
+ childOf: currentSpan.context(),
112
+ });
113
+ if (loggingSpan) {
114
+ loggingSpan.setTag('traceId', traceId);
115
+ loggingSpan.setTag('messagePattern', content.pattern);
116
+ }
104
117
  return next.handle()
105
118
  .pipe((0, operators_1.tap)(() => {
106
119
  const elapsed = Date.now() - now;
@@ -119,7 +132,16 @@ let LoggingServiceInterceptor = class LoggingServiceInterceptor {
119
132
  froms: pastFroms,
120
133
  },
121
134
  });
135
+ loggingSpan.finish();
122
136
  })).pipe((0, operators_1.catchError)((error) => {
137
+ if (loggingSpan) {
138
+ loggingSpan.setTag('error', true);
139
+ loggingSpan.setTag('error.message', error.message);
140
+ loggingSpan.setTag('error.status', error.status);
141
+ loggingSpan.setTag('error.subMessage', error.subMessage);
142
+ loggingSpan.setTag('error.stack', error.stack);
143
+ loggingSpan.setTag('error.type', error.constructor.name);
144
+ }
123
145
  msaLogger.printExceptionFliterService({
124
146
  traceId,
125
147
  errInfo: {
@@ -153,11 +175,12 @@ let LoggingServiceInterceptor = class LoggingServiceInterceptor {
153
175
  froms: pastFroms,
154
176
  },
155
177
  });
178
+ loggingSpan.finish();
156
179
  throw error;
157
180
  }));
158
181
  }
159
182
  };
160
- exports.LoggingServiceInterceptor = LoggingServiceInterceptor;
161
- exports.LoggingServiceInterceptor = LoggingServiceInterceptor = __decorate([
183
+ LoggingServiceInterceptor = __decorate([
162
184
  (0, common_1.Injectable)()
163
185
  ], LoggingServiceInterceptor);
186
+ exports.LoggingServiceInterceptor = LoggingServiceInterceptor;
@@ -234,7 +234,6 @@ let RPCInterceptor = class RPCInterceptor {
234
234
  const messageContent = message.content.toString();
235
235
  /** 파일 객체 처리 */
236
236
  (0, functions_1.reWriteFileValue)((_a = messageContent === null || messageContent === void 0 ? void 0 : messageContent.data) === null || _a === void 0 ? void 0 : _a.file);
237
- msaLogger.traceError('RPCException error', { traceId: execInterceptor.traceId }, { error: { message: errMsg, stack: err.stack ? err.stack : '', type: 'RpcExceptionsHandler' } });
238
237
  // logger.debug(`<= (error:${traceId}): ${JSON.stringify(sendMessage.toString())}`, {
239
238
  // ...logParam,
240
239
  // duration,
@@ -305,9 +304,9 @@ let RPCInterceptor = class RPCInterceptor {
305
304
  }));
306
305
  }
307
306
  };
308
- exports.RPCInterceptor = RPCInterceptor;
309
- exports.RPCInterceptor = RPCInterceptor = __decorate([
307
+ RPCInterceptor = __decorate([
310
308
  (0, common_1.Injectable)(),
311
309
  __metadata("design:paramtypes", [core_1.Reflector,
312
310
  graceful_shutdown_service_1.GracefulShutdownService])
313
311
  ], RPCInterceptor);
312
+ exports.RPCInterceptor = RPCInterceptor;
@@ -18,10 +18,9 @@ var ErrActionTypeEnum;
18
18
  ErrActionTypeEnum["LEGACY_SHOW_TOAST"] = "LEGACY_SHOW_TOAST";
19
19
  ErrActionTypeEnum["FORCE_UPDATE"] = "FORCE_UPDATE";
20
20
  ErrActionTypeEnum["UPDATE_ACCESS_TOKEN"] = "UPDATE_ACCESS_TOKEN";
21
- })(ErrActionTypeEnum || (exports.ErrActionTypeEnum = ErrActionTypeEnum = {}));
21
+ })(ErrActionTypeEnum = exports.ErrActionTypeEnum || (exports.ErrActionTypeEnum = {}));
22
22
  class ErrAction {
23
23
  }
24
- exports.ErrAction = ErrAction;
25
24
  __decorate([
26
25
  (0, swagger_1.ApiProperty)({
27
26
  description: '액션 타입',
@@ -58,9 +57,9 @@ __decorate([
58
57
  }),
59
58
  __metadata("design:type", String)
60
59
  ], ErrAction.prototype, "webViewUrl", void 0);
60
+ exports.ErrAction = ErrAction;
61
61
  class ErrInfo {
62
62
  }
63
- exports.ErrInfo = ErrInfo;
64
63
  __decorate([
65
64
  (0, swagger_1.ApiProperty)({
66
65
  description: '에러 종류 식별자',
@@ -82,3 +81,4 @@ __decorate([
82
81
  }),
83
82
  __metadata("design:type", ErrAction)
84
83
  ], ErrInfo.prototype, "action", void 0);
84
+ exports.ErrInfo = ErrInfo;
@@ -11,11 +11,11 @@ const common_1 = require("@nestjs/common");
11
11
  const graceful_shutdown_service_1 = require("./graceful-shutdown.service");
12
12
  let GracefulShutdownModule = class GracefulShutdownModule {
13
13
  };
14
- exports.GracefulShutdownModule = GracefulShutdownModule;
15
- exports.GracefulShutdownModule = GracefulShutdownModule = __decorate([
14
+ GracefulShutdownModule = __decorate([
16
15
  (0, common_1.Global)(),
17
16
  (0, common_1.Module)({
18
17
  providers: [graceful_shutdown_service_1.GracefulShutdownService],
19
18
  exports: [graceful_shutdown_service_1.GracefulShutdownService],
20
19
  })
21
20
  ], GracefulShutdownModule);
21
+ exports.GracefulShutdownModule = GracefulShutdownModule;
@@ -1,7 +1,7 @@
1
1
  import { RmqOptions, ServerRMQ } from '@nestjs/microservices';
2
2
  import { Channel } from 'amqp-connection-manager';
3
3
  import { ConsumeMessage } from 'amqplib';
4
- export type GracefulRmqOptions = RmqOptions['options'] & {
4
+ export declare type GracefulRmqOptions = RmqOptions['options'] & {
5
5
  waitingEndingHandlersTimeoutMs?: number;
6
6
  waitingEndingHandlersIntervalMs?: number;
7
7
  };
@@ -88,7 +88,7 @@ let GracefulShutdownService = class GracefulShutdownService {
88
88
  }
89
89
  }
90
90
  };
91
- exports.GracefulShutdownService = GracefulShutdownService;
92
- exports.GracefulShutdownService = GracefulShutdownService = __decorate([
91
+ GracefulShutdownService = __decorate([
93
92
  (0, common_1.Injectable)()
94
93
  ], GracefulShutdownService);
94
+ exports.GracefulShutdownService = GracefulShutdownService;
@@ -15,10 +15,10 @@ const redisProvider = {
15
15
  };
16
16
  let RedisModule = class RedisModule {
17
17
  };
18
- exports.RedisModule = RedisModule;
19
- exports.RedisModule = RedisModule = __decorate([
18
+ RedisModule = __decorate([
20
19
  (0, common_1.Module)({
21
20
  providers: [redisProvider],
22
21
  exports: [redisProvider],
23
22
  })
24
23
  ], RedisModule);
24
+ exports.RedisModule = RedisModule;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yolo-croket-dev/core",
3
- "version": "1.7.4-datadog.9",
3
+ "version": "1.7.4",
4
4
  "author": "Yolo Co., Ltd.",
5
5
  "description": "Yolo commonization module",
6
6
  "main": "index.js",
@@ -17,10 +17,11 @@
17
17
  "@nestjs/common": "^8.2.3",
18
18
  "@nestjs/microservices": "9.0.8",
19
19
  "@yolo-croket-dev/logger": "^1.0.15",
20
- "@yolo-croket-dev/msa-logger": "3.0.2-datadog.0",
20
+ "@yolo-croket-dev/msa-logger": "^3.0.1",
21
21
  "@yolo-croket-dev/redis": "^1.0.23",
22
22
  "@yolo-croket-dev/swagger": "^0.0.7",
23
23
  "axios": "^1.1.3",
24
+ "dd-trace": "^5.25.0",
24
25
  "randomstring": "^1.2.2",
25
26
  "rxjs": "^7.4.0",
26
27
  "uuid": "^8.3.2"
@@ -31,8 +31,8 @@ let ValidationPipe = class ValidationPipe {
31
31
  return value;
32
32
  }
33
33
  };
34
- exports.ValidationPipe = ValidationPipe;
35
- exports.ValidationPipe = ValidationPipe = __decorate([
34
+ ValidationPipe = __decorate([
36
35
  (0, common_1.Injectable)(),
37
36
  __metadata("design:paramtypes", [Object])
38
37
  ], ValidationPipe);
38
+ exports.ValidationPipe = ValidationPipe;