@sentry/profiling-node 8.22.0 → 8.23.0

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 (38) hide show
  1. package/bindings/cpu_profiler.cc +1 -0
  2. package/lib/cjs/index.js +25 -10
  3. package/lib/cjs/index.js.map +1 -1
  4. package/lib/esm/index.js +25 -10
  5. package/lib/esm/index.js.map +1 -1
  6. package/lib/sentry_cpu_profiler-darwin-arm64-108.node +0 -0
  7. package/lib/sentry_cpu_profiler-darwin-arm64-115.node +0 -0
  8. package/lib/sentry_cpu_profiler-darwin-arm64-127.node +0 -0
  9. package/lib/sentry_cpu_profiler-darwin-arm64-93.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-93.node +0 -0
  14. package/lib/sentry_cpu_profiler-linux-arm64-glibc-108.node +0 -0
  15. package/lib/sentry_cpu_profiler-linux-arm64-glibc-115.node +0 -0
  16. package/lib/sentry_cpu_profiler-linux-arm64-glibc-127.node +0 -0
  17. package/lib/sentry_cpu_profiler-linux-arm64-glibc-93.node +0 -0
  18. package/lib/sentry_cpu_profiler-linux-arm64-musl-108.node +0 -0
  19. package/lib/sentry_cpu_profiler-linux-arm64-musl-115.node +0 -0
  20. package/lib/sentry_cpu_profiler-linux-arm64-musl-127.node +0 -0
  21. package/lib/sentry_cpu_profiler-linux-arm64-musl-93.node +0 -0
  22. package/lib/sentry_cpu_profiler-linux-x64-glibc-108.node +0 -0
  23. package/lib/sentry_cpu_profiler-linux-x64-glibc-115.node +0 -0
  24. package/lib/sentry_cpu_profiler-linux-x64-glibc-127.node +0 -0
  25. package/lib/sentry_cpu_profiler-linux-x64-glibc-93.node +0 -0
  26. package/lib/sentry_cpu_profiler-linux-x64-musl-108.node +0 -0
  27. package/lib/sentry_cpu_profiler-linux-x64-musl-115.node +0 -0
  28. package/lib/sentry_cpu_profiler-linux-x64-musl-127.node +0 -0
  29. package/lib/sentry_cpu_profiler-linux-x64-musl-93.node +0 -0
  30. package/lib/sentry_cpu_profiler-win32-x64-108.node +0 -0
  31. package/lib/sentry_cpu_profiler-win32-x64-115.node +0 -0
  32. package/lib/sentry_cpu_profiler-win32-x64-127.node +0 -0
  33. package/lib/sentry_cpu_profiler-win32-x64-93.node +0 -0
  34. package/lib/types/integration.d.ts.map +1 -1
  35. package/lib/types/utils.d.ts +1 -1
  36. package/lib/types/utils.d.ts.map +1 -1
  37. package/lib/types-ts3.8/utils.d.ts +1 -1
  38. package/package.json +5 -5
@@ -28,6 +28,7 @@ enum ProfileFormat {
28
28
  kFormatThread = 0,
29
29
  kFormatChunk = 1,
30
30
  };
31
+
31
32
  // Allow users to override the default logging mode via env variable. This is
32
33
  // useful because sometimes the flow of the profiled program can be to execute
33
34
  // many sequential transaction - in that case, it may be preferable to set eager
package/lib/cjs/index.js CHANGED
@@ -366,6 +366,7 @@ function createProfileChunkPayload(
366
366
  trace_id,
367
367
  profiler_id,
368
368
  chunk_id,
369
+ sdk,
369
370
  }
370
371
 
371
372
  ,
@@ -381,6 +382,10 @@ function createProfileChunkPayload(
381
382
 
382
383
  const profile = {
383
384
  chunk_id: chunk_id,
385
+ client_sdk: {
386
+ name: _nullishCoalesce$1(_optionalChain$1([sdk, 'optionalAccess', _4 => _4.name]), () => ( 'sentry.javascript.node')),
387
+ version: _nullishCoalesce$1(_optionalChain$1([sdk, 'optionalAccess', _5 => _5.version]), () => ( '0.0.0')),
388
+ },
384
389
  profiler_id: profiler_id,
385
390
  platform: 'node',
386
391
  version: CONTINUOUS_FORMAT_VERSION,
@@ -403,6 +408,7 @@ function createProfilingChunkEvent(
403
408
  client,
404
409
  options,
405
410
  profile,
411
+ sdk,
406
412
  identifiers,
407
413
  ) {
408
414
  if (!isValidProfileChunk(profile)) {
@@ -415,6 +421,7 @@ function createProfilingChunkEvent(
415
421
  trace_id: _nullishCoalesce$1(identifiers.trace_id, () => ( '')),
416
422
  chunk_id: identifiers.chunk_id,
417
423
  profiler_id: identifiers.profiler_id,
424
+ sdk,
418
425
  });
419
426
  }
420
427
 
@@ -529,7 +536,7 @@ function findProfiledTransactionsFromEnvelope(envelope) {
529
536
  }
530
537
 
531
538
  // @ts-expect-error profile_id is not part of the metadata type
532
- const profile_id = _optionalChain$1([(event.contexts ), 'optionalAccess', _4 => _4['profile'], 'optionalAccess', _5 => _5['profile_id']]);
539
+ const profile_id = _optionalChain$1([(event.contexts ), 'optionalAccess', _6 => _6['profile'], 'optionalAccess', _7 => _7['profile_id']]);
533
540
 
534
541
  if (event && profile_id) {
535
542
  events.push(item[j] );
@@ -771,6 +778,8 @@ var ProfileFormat;(function (ProfileFormat) {
771
778
  const CHUNK = 1; ProfileFormat[ProfileFormat["CHUNK"] = CHUNK] = "CHUNK";
772
779
  })(ProfileFormat || (ProfileFormat = {}));
773
780
 
781
+ /* eslint-disable max-lines */
782
+
774
783
  const CHUNK_INTERVAL_MS = 5000;
775
784
  const PROFILE_MAP = new utils.LRUMap(50);
776
785
  const PROFILE_TIMEOUTS = {};
@@ -969,11 +978,17 @@ class ContinuousProfiler {constructor() { ContinuousProfiler.prototype.__init.ca
969
978
  }
970
979
 
971
980
  DEBUG_BUILD && utils.logger.log(`[Profiling] Profile chunk ${this._chunkData.id} sent to Sentry.`);
972
- const chunk = createProfilingChunkEvent(this._client, this._client.getOptions(), profile, {
973
- chunk_id: this._chunkData.id,
974
- trace_id: this._chunkData.startTraceID,
975
- profiler_id: this._profilerId,
976
- });
981
+ const chunk = createProfilingChunkEvent(
982
+ this._client,
983
+ this._client.getOptions(),
984
+ profile,
985
+ _optionalChain([this, 'access', _12 => _12._client, 'access', _13 => _13.getSdkMetadata, 'call', _14 => _14(), 'optionalAccess', _15 => _15.sdk]),
986
+ {
987
+ chunk_id: this._chunkData.id,
988
+ trace_id: this._chunkData.startTraceID,
989
+ profiler_id: this._profilerId,
990
+ },
991
+ );
977
992
 
978
993
  if (!chunk) {
979
994
  DEBUG_BUILD && utils.logger.log(`[Profiling] Failed to create profile chunk for: ${this._chunkData.id}`);
@@ -1010,7 +1025,7 @@ class ContinuousProfiler {constructor() { ContinuousProfiler.prototype.__init.ca
1010
1025
  const metadata = this._client.getSdkMetadata();
1011
1026
  const tunnel = this._client.getOptions().tunnel;
1012
1027
 
1013
- const envelope = makeProfileChunkEnvelope(chunk, _optionalChain([metadata, 'optionalAccess', _12 => _12.sdk]), tunnel, dsn);
1028
+ const envelope = makeProfileChunkEnvelope(chunk, _optionalChain([metadata, 'optionalAccess', _16 => _16.sdk]), tunnel, dsn);
1014
1029
  transport.send(envelope).then(null, reason => {
1015
1030
  DEBUG_BUILD && utils.logger.error('Error while sending profile chunk envelope:', reason);
1016
1031
  });
@@ -1086,7 +1101,7 @@ class ContinuousProfiler {constructor() { ContinuousProfiler.prototype.__init.ca
1086
1101
  * Assigns thread_id and thread name context to a profiled event.
1087
1102
  */
1088
1103
  _assignThreadIdContext(event) {
1089
- if (!_optionalChain([event, 'optionalAccess', _13 => _13['contexts'], 'optionalAccess', _14 => _14['profile']])) {
1104
+ if (!_optionalChain([event, 'optionalAccess', _17 => _17['contexts'], 'optionalAccess', _18 => _18['profile']])) {
1090
1105
  return;
1091
1106
  }
1092
1107
 
@@ -1097,9 +1112,9 @@ class ContinuousProfiler {constructor() { ContinuousProfiler.prototype.__init.ca
1097
1112
  // @ts-expect-error the trace fallback value is wrong, though it should never happen
1098
1113
  // and in case it does, we dont want to override whatever was passed initially.
1099
1114
  event.contexts['trace'] = {
1100
- ...(_nullishCoalesce(_optionalChain([event, 'access', _15 => _15.contexts, 'optionalAccess', _16 => _16['trace']]), () => ( {}))),
1115
+ ...(_nullishCoalesce(_optionalChain([event, 'access', _19 => _19.contexts, 'optionalAccess', _20 => _20['trace']]), () => ( {}))),
1101
1116
  data: {
1102
- ...(_nullishCoalesce(_optionalChain([event, 'access', _17 => _17.contexts, 'optionalAccess', _18 => _18['trace'], 'optionalAccess', _19 => _19['data']]), () => ( {}))),
1117
+ ...(_nullishCoalesce(_optionalChain([event, 'access', _21 => _21.contexts, 'optionalAccess', _22 => _22['trace'], 'optionalAccess', _23 => _23['data']]), () => ( {}))),
1103
1118
  ['thread.id']: PROFILER_THREAD_ID_STRING,
1104
1119
  ['thread.name']: PROFILER_THREAD_NAME,
1105
1120
  },