@ngn-net/nestjs-telescope 0.3.8 → 0.3.9

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.
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@ngn-net/nestjs-telescope",
3
- "version": "0.3.8",
4
- "builtAt": "2026-06-13T11:10:47.835Z"
3
+ "version": "0.3.9",
4
+ "builtAt": "2026-06-13T11:13:25.789Z"
5
5
  }
@@ -50,16 +50,22 @@ let RabbitMQWatcher = RabbitMQWatcher_1 = class RabbitMQWatcher {
50
50
  }).catch(() => { });
51
51
  return result;
52
52
  };
53
+ this.logger.log('Patched AmqpConnection.publish');
54
+ }
55
+ catch (e) {
56
+ this.logger.warn('Failed to patch AmqpConnection.publish: ' + (e?.message || e));
53
57
  }
54
- catch { }
55
58
  }
56
59
  patchAmqplibConnect() {
57
60
  try {
58
61
  const amqplib = require('amqplib');
59
- if (!amqplib || typeof amqplib.connect !== 'function')
62
+ if (!amqplib || typeof amqplib.connect !== 'function') {
63
+ this.logger.warn('amqplib.connect not found');
60
64
  return;
65
+ }
61
66
  const originalConnect = amqplib.connect;
62
67
  const self = this;
68
+ let patched = false;
63
69
  amqplib.connect = async function (...args) {
64
70
  const conn = await originalConnect.apply(this, args);
65
71
  if (conn && typeof conn.createChannel === 'function') {
@@ -68,14 +74,19 @@ let RabbitMQWatcher = RabbitMQWatcher_1 = class RabbitMQWatcher {
68
74
  const channel = await originalCreateChannel(...channelArgs);
69
75
  if (channel && typeof channel.consume === 'function') {
70
76
  self.instrumentChannel(channel);
77
+ self.logger.log('Patched amqplib channel.consume');
71
78
  }
72
79
  return channel;
73
80
  };
74
81
  }
75
82
  return conn;
76
83
  };
84
+ patched = true;
85
+ this.logger.log('Patched amqplib.connect');
86
+ }
87
+ catch (e) {
88
+ this.logger.warn('Failed to patch amqplib.connect: ' + (e?.message || e));
77
89
  }
78
- catch { }
79
90
  }
80
91
  instrumentChannel(channel) {
81
92
  const self = this;
@@ -86,9 +97,11 @@ let RabbitMQWatcher = RabbitMQWatcher_1 = class RabbitMQWatcher {
86
97
  if (!originalConsume)
87
98
  return;
88
99
  channel.consume = function (queue, onMessage, options) {
100
+ self.logger.log(`Intercepting consume for queue: ${queue}`);
89
101
  const wrappedOnMessage = (msg) => {
90
102
  if (!msg || !msg.content)
91
103
  return onMessage(msg);
104
+ self.logger.log(`Incoming message on queue: ${queue}`);
92
105
  const startTime = Date.now();
93
106
  let parsed;
94
107
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ngn-net/nestjs-telescope",
3
- "version": "0.3.8",
3
+ "version": "0.3.9",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },