@dex-monit/observability-sdk-node 1.0.11 → 1.0.13

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.
@@ -9,6 +9,7 @@ import { RemoteLogger, createRemoteLogger } from './remote-logger.js';
9
9
  import { DexLoggerService, DEX_LOGGER_TOKEN } from './dex-logger.service.js';
10
10
  import { startConsoleCapture, stopConsoleCapture } from './console-capture.js';
11
11
  import { startNestLoggerCapture, stopNestLoggerCapture, } from './nest-logger-capture.js';
12
+ import { HttpTraceInterceptor } from './http-interceptor.js';
12
13
  import { Logger, LOGGER_TOKEN, } from '@dex-monit/observability-logger';
13
14
  // Re-export LOGGER_TOKEN for convenience
14
15
  export { LOGGER_TOKEN };
@@ -59,14 +60,19 @@ let SdkNodeModule = (() => {
59
60
  SdkNodeModule.remoteLogger = logger;
60
61
  // Start captures if monitoring is configured
61
62
  if (monitoringClient) {
62
- // Console capture (default: true)
63
- if (config.captureConsole ?? true) {
64
- startConsoleCapture(monitoringClient);
65
- }
66
- // NestJS Logger capture (default: true)
67
- if (config.captureNestLogger ?? true) {
63
+ const captureConsole = config.captureConsole ?? true;
64
+ const captureNestLogger = config.captureNestLogger ?? true;
65
+ // NestJS Logger capture (default: true) - START FIRST
66
+ if (captureNestLogger) {
68
67
  startNestLoggerCapture(monitoringClient);
69
68
  }
69
+ // Console capture (default: true)
70
+ // Skip NestJS logs if we're also capturing NestJS Logger to avoid duplicates
71
+ if (captureConsole) {
72
+ startConsoleCapture(monitoringClient, {
73
+ skipNestJsLogs: captureNestLogger,
74
+ });
75
+ }
70
76
  }
71
77
  return {
72
78
  module: SdkNodeModule,
@@ -115,12 +121,22 @@ let SdkNodeModule = (() => {
115
121
  provide: APP_INTERCEPTOR,
116
122
  useFactory: () => new ErrorCaptureInterceptor(monitoringClient),
117
123
  },
124
+ // HTTP trace interceptor (captures all HTTP requests)
125
+ ...((config.captureHttpRequests ?? true)
126
+ ? [
127
+ {
128
+ provide: APP_INTERCEPTOR,
129
+ useFactory: () => new HttpTraceInterceptor(monitoringClient),
130
+ },
131
+ ]
132
+ : []),
118
133
  // Keep the filter as fallback for non-HTTP contexts
119
134
  {
120
135
  provide: APP_FILTER,
121
136
  useFactory: () => new GlobalExceptionFilter(logger, monitoringClient),
122
137
  },
123
138
  RequestIdMiddleware,
139
+ HttpTraceInterceptor,
124
140
  ],
125
141
  exports: [
126
142
  // Main exports
@@ -128,6 +144,7 @@ let SdkNodeModule = (() => {
128
144
  DEX_LOGGER_TOKEN,
129
145
  MONITORING_CLIENT_TOKEN,
130
146
  MonitoringClient,
147
+ HttpTraceInterceptor,
131
148
  // Legacy exports
132
149
  LOGGER_TOKEN,
133
150
  Logger,