@sentry/node-cpu-profiler 2.4.3 → 2.4.5

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.
Files changed (40) hide show
  1. package/README.md +5 -1
  2. package/bindings/cpu_profiler.cc +31 -9
  3. package/lib/index.d.ts.map +1 -1
  4. package/lib/index.js +3 -1
  5. package/lib/sentry_cpu_profiler-darwin-arm64-108.node +0 -0
  6. package/lib/sentry_cpu_profiler-darwin-arm64-115.node +0 -0
  7. package/lib/sentry_cpu_profiler-darwin-arm64-127.node +0 -0
  8. package/lib/sentry_cpu_profiler-darwin-arm64-137.node +0 -0
  9. package/lib/sentry_cpu_profiler-darwin-arm64-147.node +0 -0
  10. package/lib/sentry_cpu_profiler-darwin-x64-108.node +0 -0
  11. package/lib/sentry_cpu_profiler-darwin-x64-115.node +0 -0
  12. package/lib/sentry_cpu_profiler-darwin-x64-127.node +0 -0
  13. package/lib/sentry_cpu_profiler-darwin-x64-137.node +0 -0
  14. package/lib/sentry_cpu_profiler-darwin-x64-147.node +0 -0
  15. package/lib/sentry_cpu_profiler-linux-arm64-glibc-108.node +0 -0
  16. package/lib/sentry_cpu_profiler-linux-arm64-glibc-115.node +0 -0
  17. package/lib/sentry_cpu_profiler-linux-arm64-glibc-127.node +0 -0
  18. package/lib/sentry_cpu_profiler-linux-arm64-glibc-137.node +0 -0
  19. package/lib/sentry_cpu_profiler-linux-arm64-glibc-147.node +0 -0
  20. package/lib/sentry_cpu_profiler-linux-arm64-musl-108.node +0 -0
  21. package/lib/sentry_cpu_profiler-linux-arm64-musl-115.node +0 -0
  22. package/lib/sentry_cpu_profiler-linux-arm64-musl-127.node +0 -0
  23. package/lib/sentry_cpu_profiler-linux-arm64-musl-137.node +0 -0
  24. package/lib/sentry_cpu_profiler-linux-arm64-musl-147.node +0 -0
  25. package/lib/sentry_cpu_profiler-linux-x64-glibc-108.node +0 -0
  26. package/lib/sentry_cpu_profiler-linux-x64-glibc-115.node +0 -0
  27. package/lib/sentry_cpu_profiler-linux-x64-glibc-127.node +0 -0
  28. package/lib/sentry_cpu_profiler-linux-x64-glibc-137.node +0 -0
  29. package/lib/sentry_cpu_profiler-linux-x64-glibc-147.node +0 -0
  30. package/lib/sentry_cpu_profiler-linux-x64-musl-108.node +0 -0
  31. package/lib/sentry_cpu_profiler-linux-x64-musl-115.node +0 -0
  32. package/lib/sentry_cpu_profiler-linux-x64-musl-127.node +0 -0
  33. package/lib/sentry_cpu_profiler-linux-x64-musl-137.node +0 -0
  34. package/lib/sentry_cpu_profiler-linux-x64-musl-147.node +0 -0
  35. package/lib/sentry_cpu_profiler-win32-x64-108.node +0 -0
  36. package/lib/sentry_cpu_profiler-win32-x64-115.node +0 -0
  37. package/lib/sentry_cpu_profiler-win32-x64-127.node +0 -0
  38. package/lib/sentry_cpu_profiler-win32-x64-137.node +0 -0
  39. package/lib/sentry_cpu_profiler-win32-x64-147.node +0 -0
  40. package/package.json +2 -2
package/README.md CHANGED
@@ -1,6 +1,10 @@
1
1
  <p align="center">
2
2
  <a href="https://sentry.io/?utm_source=github&utm_medium=logo" target="_blank">
3
- <img src="https://sentry-brand.storage.googleapis.com/sentry-wordmark-dark-280x84.png" alt="Sentry" width="280" height="84">
3
+ <picture>
4
+ <source srcset="https://sentry-brand.storage.googleapis.com/sentry-logo-white.png" media="(prefers-color-scheme: dark)" />
5
+ <source srcset="https://sentry-brand.storage.googleapis.com/sentry-wordmark-dark-280x84.png" media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)" />
6
+ <img src="https://sentry-brand.storage.googleapis.com/sentry-wordmark-dark-280x84.png" alt="Sentry" width="280">
7
+ </picture>
4
8
  </a>
5
9
  </p>
6
10
 
@@ -162,6 +162,32 @@ void MeasurementsTicker::remove_heap_listener(
162
162
 
163
163
  // CPU tickers
164
164
  void MeasurementsTicker::cpu_callback() {
165
+ uint64_t total = 0;
166
+ uint64_t idle_total = 0;
167
+
168
+ #ifdef __linux__
169
+ // uv_cpu_info() also reads the cpufreq file of each CPU. On some kernels
170
+ // that read sleeps for each CPU, which blocks the event loop for more than
171
+ // a second on hosts with many CPUs. The first line of /proc/stat has the
172
+ // times of all CPUs together.
173
+ FILE *proc_stat = fopen("/proc/stat", "r");
174
+
175
+ if (proc_stat == nullptr) {
176
+ return;
177
+ }
178
+
179
+ unsigned long long user, nice, sys, idle, iowait, irq;
180
+ int fields = fscanf(proc_stat, "cpu %llu %llu %llu %llu %llu %llu", &user,
181
+ &nice, &sys, &idle, &iowait, &irq);
182
+ fclose(proc_stat);
183
+
184
+ if (fields != 6) {
185
+ return;
186
+ }
187
+
188
+ total = user + nice + sys + idle + irq;
189
+ idle_total = idle;
190
+ #else
165
191
  uv_cpu_info_t *cpu = &cpu_stats;
166
192
  int count;
167
193
  int err = uv_cpu_info(&cpu, &count);
@@ -174,10 +200,6 @@ void MeasurementsTicker::cpu_callback() {
174
200
  return;
175
201
  }
176
202
 
177
- uint64_t ts = uv_hrtime();
178
- uint64_t total = 0;
179
- uint64_t idle_total = 0;
180
-
181
203
  for (int i = 0; i < count; i++) {
182
204
  uv_cpu_info_t *core = cpu + i;
183
205
 
@@ -190,9 +212,11 @@ void MeasurementsTicker::cpu_callback() {
190
212
  idle_total += core->cpu_times.idle;
191
213
  }
192
214
 
193
- double idle_avg = static_cast<double>(idle_total) / count;
194
- double total_avg = static_cast<double>(total) / count;
195
- double rate = 1.0 - idle_avg / total_avg;
215
+ uv_free_cpu_info(cpu, count);
216
+ #endif
217
+
218
+ uint64_t ts = uv_hrtime();
219
+ double rate = 1.0 - static_cast<double>(idle_total) / total;
196
220
 
197
221
  if (rate < 0.0 || isinf(rate) || isnan(rate)) {
198
222
  rate = 0.0;
@@ -206,8 +230,6 @@ void MeasurementsTicker::cpu_callback() {
206
230
  ++it;
207
231
  }
208
232
  };
209
-
210
- uv_free_cpu_info(cpu, count);
211
233
  };
212
234
 
213
235
  void MeasurementsTicker::ticker(uv_timer_t *handle) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,4BAA4B,EAC5B,aAAa,EACb,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACtB,MAAM,SAAS,CAAC;AAQjB;;GAEG;AAEH,wBAAgB,uBAAuB,IAAI,4BAA4B,GAAG,SAAS,CAqKlF;AAED,eAAO,MAAM,0BAA0B,EAAE,4BAA4B,GAAG,SAAqC,CAAC;AAE9G,cAAM,QAAS,YAAW,qBAAqB;IACtC,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAclC,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,CAAC,MAAM,GAAG,mBAAmB,GAAG,IAAI;IACrF,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,CAAC,KAAK,GAAG,kBAAkB,GAAG,IAAI;CAsB3F;AAED,eAAO,MAAM,mBAAmB,UAAiB,CAAC;AAElD,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,4BAA4B,EAC5B,aAAa,EACb,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACtB,MAAM,SAAS,CAAC;AAQjB;;GAEG;AAEH,wBAAgB,uBAAuB,IAAI,4BAA4B,GAAG,SAAS,CAqKlF;AAED,eAAO,MAAM,0BAA0B,EAAE,4BAA4B,GAAG,SAAqC,CAAC;AAE9G,cAAM,QAAS,YAAW,qBAAqB;IACtC,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAclC,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,CAAC,MAAM,GAAG,mBAAmB,GAAG,IAAI;IACrF,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,CAAC,KAAK,GAAG,kBAAkB,GAAG,IAAI;CAuB3F;AAED,eAAO,MAAM,mBAAmB,UAAiB,CAAC;AAElD,cAAc,SAAS,CAAC"}
package/lib/index.js CHANGED
@@ -216,7 +216,9 @@ var Bindings = /** @class */ (function () {
216
216
  console.log('[Profiling] Native stopProfiling function is not available, ignoring call to stopProfiling.');
217
217
  return null;
218
218
  }
219
- return exports.PrivateCpuProfilerBindings.stopProfiling(name, format, node_worker_threads_1.threadId, !!global._sentryDebugIds);
219
+ return exports.PrivateCpuProfilerBindings.stopProfiling(name, format, node_worker_threads_1.threadId,
220
+ // Bundlers with native debug ID support (e.g. Turbopack) only write `_debugIds`; the SDK resolves both globals.
221
+ !!(global._sentryDebugIds || global._debugIds));
220
222
  };
221
223
  return Bindings;
222
224
  }());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/node-cpu-profiler",
3
- "version": "2.4.3",
3
+ "version": "2.4.5",
4
4
  "description": "Binaries for Sentry Node Profiling",
5
5
  "repository": "git://github.com/getsentry/sentry-javascript-profiling-node-binaries.git",
6
6
  "homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/profiling-node",
@@ -62,7 +62,7 @@
62
62
  },
63
63
  "sideEffects": false,
64
64
  "volta": {
65
- "node": "24.0.0",
65
+ "node": "24.22.1",
66
66
  "yarn": "1.22.22"
67
67
  }
68
68
  }