@aztec/telemetry-client 3.0.0-nightly.20250921 → 3.0.0-nightly.20250923

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 +1 @@
1
- {"version":3,"file":"nodejs_metrics_monitor.d.ts","sourceRoot":"","sources":["../src/nodejs_metrics_monitor.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,KAAK,KAAK,EAIX,MAAM,gBAAgB,CAAC;AAExB;;GAEG;AACH,qBAAa,oBAAoB;IAuBnB,OAAO,CAAC,KAAK;IAtBzB,OAAO,CAAC,oBAAoB,CAQ1B;IAIF,OAAO,CAAC,YAAY,CAAoE;IAExF,OAAO,CAAC,mBAAmB,CAAkB;IAC7C,OAAO,CAAC,aAAa,CAAgB;IAErC,OAAO,CAAC,OAAO,CAAS;IAExB,OAAO,CAAC,OAAO,CAAmC;IAClD,OAAO,CAAC,cAAc,CAAoB;gBAEtB,KAAK,EAAE,KAAK;IAmDhC,KAAK,IAAI,IAAI;IAcb,IAAI,IAAI,IAAI;IAcZ,OAAO,CAAC,OAAO,CAGb;IAEF,OAAO,CAAC,kBAAkB,CAOxB;IAEF,OAAO,CAAC,qBAAqB,CAyB3B;CACH"}
1
+ {"version":3,"file":"nodejs_metrics_monitor.d.ts","sourceRoot":"","sources":["../src/nodejs_metrics_monitor.ts"],"names":[],"mappings":"AAKA,OAAO,EAEL,KAAK,KAAK,EAIX,MAAM,gBAAgB,CAAC;AAExB;;GAEG;AACH,qBAAa,oBAAoB;IAuBnB,OAAO,CAAC,KAAK;IAtBzB,OAAO,CAAC,oBAAoB,CAQ1B;IAIF,OAAO,CAAC,YAAY,CAAoE;IAExF,OAAO,CAAC,mBAAmB,CAAkB;IAC7C,OAAO,CAAC,aAAa,CAAgB;IAErC,OAAO,CAAC,OAAO,CAAS;IAExB,OAAO,CAAC,OAAO,CAAmC;IAClD,OAAO,CAAC,cAAc,CAAoB;gBAEtB,KAAK,EAAE,KAAK;IAmDhC,KAAK,IAAI,IAAI;IAcb,IAAI,IAAI,IAAI;IAcZ,OAAO,CAAC,OAAO,CAGb;IAEF,OAAO,CAAC,kBAAkB,CAOxB;IAEF,OAAO,CAAC,qBAAqB,CAyB3B;CACH"}
@@ -40,19 +40,19 @@ import { ValueType } from './telemetry.js';
40
40
  // - https://nodesource.com/blog/event-loop-utilization-nodejs
41
41
  // - https://youtu.be/WetXnEPraYM
42
42
  obs.observe(this.eventLoopUilization, delta.utilization);
43
- this.eventLoopTime.add(Math.floor(delta.idle), {
43
+ this.eventLoopTime.add(Math.trunc(delta.idle), {
44
44
  [Attributes.NODEJS_EVENT_LOOP_STATE]: 'idle'
45
45
  });
46
- this.eventLoopTime.add(Math.floor(delta.active), {
46
+ this.eventLoopTime.add(Math.trunc(delta.active), {
47
47
  [Attributes.NODEJS_EVENT_LOOP_STATE]: 'active'
48
48
  });
49
- obs.observe(this.eventLoopDelayGauges.min, Math.floor(this.eventLoopDelay.min));
50
- obs.observe(this.eventLoopDelayGauges.mean, Math.floor(this.eventLoopDelay.mean));
51
- obs.observe(this.eventLoopDelayGauges.max, Math.floor(this.eventLoopDelay.max));
52
- obs.observe(this.eventLoopDelayGauges.stddev, Math.floor(this.eventLoopDelay.stddev));
53
- obs.observe(this.eventLoopDelayGauges.p50, Math.floor(this.eventLoopDelay.percentile(50)));
54
- obs.observe(this.eventLoopDelayGauges.p90, Math.floor(this.eventLoopDelay.percentile(90)));
55
- obs.observe(this.eventLoopDelayGauges.p99, Math.floor(this.eventLoopDelay.percentile(99)));
49
+ safeObserveInt(obs, this.eventLoopDelayGauges.min, this.eventLoopDelay.min);
50
+ safeObserveInt(obs, this.eventLoopDelayGauges.mean, this.eventLoopDelay.mean);
51
+ safeObserveInt(obs, this.eventLoopDelayGauges.max, this.eventLoopDelay.max);
52
+ safeObserveInt(obs, this.eventLoopDelayGauges.stddev, this.eventLoopDelay.stddev);
53
+ safeObserveInt(obs, this.eventLoopDelayGauges.p50, this.eventLoopDelay.percentile(50));
54
+ safeObserveInt(obs, this.eventLoopDelayGauges.p90, this.eventLoopDelay.percentile(90));
55
+ safeObserveInt(obs, this.eventLoopDelayGauges.p99, this.eventLoopDelay.percentile(99));
56
56
  this.eventLoopDelay.reset();
57
57
  };
58
58
  const nsObsGauge = (name, description)=>meter.createObservableGauge(name, {
@@ -127,3 +127,10 @@ import { ValueType } from './telemetry.js';
127
127
  measureMemoryUsage;
128
128
  measureEventLoopDelay;
129
129
  }
130
+ function safeObserveInt(observer, metric, value, attrs) {
131
+ // discard NaN, Infinity, -Infinity
132
+ if (!Number.isFinite(value)) {
133
+ return;
134
+ }
135
+ observer.observe(metric, Math.trunc(value), attrs);
136
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/telemetry-client",
3
- "version": "3.0.0-nightly.20250921",
3
+ "version": "3.0.0-nightly.20250923",
4
4
  "inherits": [
5
5
  "../package.common.json"
6
6
  ],
@@ -25,8 +25,8 @@
25
25
  "!*.test.*"
26
26
  ],
27
27
  "dependencies": {
28
- "@aztec/foundation": "3.0.0-nightly.20250921",
29
- "@aztec/stdlib": "3.0.0-nightly.20250921",
28
+ "@aztec/foundation": "3.0.0-nightly.20250923",
29
+ "@aztec/stdlib": "3.0.0-nightly.20250923",
30
30
  "@opentelemetry/api": "^1.9.0",
31
31
  "@opentelemetry/api-logs": "^0.55.0",
32
32
  "@opentelemetry/core": "^1.28.0",
@@ -1,3 +1,4 @@
1
+ import type { Observable } from '@opentelemetry/api';
1
2
  import { type EventLoopUtilization, type IntervalHistogram, monitorEventLoopDelay, performance } from 'node:perf_hooks';
2
3
 
3
4
  import * as Attributes from './attributes.js';
@@ -142,17 +143,26 @@ export class NodejsMetricsMonitor {
142
143
  // - https://youtu.be/WetXnEPraYM
143
144
  obs.observe(this.eventLoopUilization, delta.utilization);
144
145
 
145
- this.eventLoopTime.add(Math.floor(delta.idle), { [Attributes.NODEJS_EVENT_LOOP_STATE]: 'idle' });
146
- this.eventLoopTime.add(Math.floor(delta.active), { [Attributes.NODEJS_EVENT_LOOP_STATE]: 'active' });
146
+ this.eventLoopTime.add(Math.trunc(delta.idle), { [Attributes.NODEJS_EVENT_LOOP_STATE]: 'idle' });
147
+ this.eventLoopTime.add(Math.trunc(delta.active), { [Attributes.NODEJS_EVENT_LOOP_STATE]: 'active' });
147
148
 
148
- obs.observe(this.eventLoopDelayGauges.min, Math.floor(this.eventLoopDelay.min));
149
- obs.observe(this.eventLoopDelayGauges.mean, Math.floor(this.eventLoopDelay.mean));
150
- obs.observe(this.eventLoopDelayGauges.max, Math.floor(this.eventLoopDelay.max));
151
- obs.observe(this.eventLoopDelayGauges.stddev, Math.floor(this.eventLoopDelay.stddev));
152
- obs.observe(this.eventLoopDelayGauges.p50, Math.floor(this.eventLoopDelay.percentile(50)));
153
- obs.observe(this.eventLoopDelayGauges.p90, Math.floor(this.eventLoopDelay.percentile(90)));
154
- obs.observe(this.eventLoopDelayGauges.p99, Math.floor(this.eventLoopDelay.percentile(99)));
149
+ safeObserveInt(obs, this.eventLoopDelayGauges.min, this.eventLoopDelay.min);
150
+ safeObserveInt(obs, this.eventLoopDelayGauges.mean, this.eventLoopDelay.mean);
151
+ safeObserveInt(obs, this.eventLoopDelayGauges.max, this.eventLoopDelay.max);
152
+ safeObserveInt(obs, this.eventLoopDelayGauges.stddev, this.eventLoopDelay.stddev);
153
+ safeObserveInt(obs, this.eventLoopDelayGauges.p50, this.eventLoopDelay.percentile(50));
154
+ safeObserveInt(obs, this.eventLoopDelayGauges.p90, this.eventLoopDelay.percentile(90));
155
+ safeObserveInt(obs, this.eventLoopDelayGauges.p99, this.eventLoopDelay.percentile(99));
155
156
 
156
157
  this.eventLoopDelay.reset();
157
158
  };
158
159
  }
160
+
161
+ function safeObserveInt(observer: BatchObservableResult, metric: Observable, value: number, attrs?: object) {
162
+ // discard NaN, Infinity, -Infinity
163
+ if (!Number.isFinite(value)) {
164
+ return;
165
+ }
166
+
167
+ observer.observe(metric, Math.trunc(value), attrs);
168
+ }