@sentry/profiling-node 9.38.0 → 9.39.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.
- package/build/cjs/index.js +56 -58
- package/build/cjs/index.js.map +1 -1
- package/build/esm/index.js +57 -59
- package/build/esm/index.js.map +1 -1
- package/build/esm/package.json +1 -1
- package/build/types/integration.d.ts.map +1 -1
- package/package.json +3 -3
package/build/cjs/index.js
CHANGED
|
@@ -115,7 +115,7 @@ function createProfilePayload(
|
|
|
115
115
|
// All profiles and transactions are rejected if this is the case and we want to
|
|
116
116
|
// warn users that this is happening if they enable debug flag
|
|
117
117
|
if (trace_id?.length !== 32) {
|
|
118
|
-
DEBUG_BUILD && core.
|
|
118
|
+
DEBUG_BUILD && core.debug.log(`[Profiling] Invalid traceId: ${trace_id} on profiled event`);
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
const enrichedThreadProfile = enrichWithThreadInformation(cpuProfile);
|
|
@@ -183,7 +183,7 @@ function createProfileChunkPayload(
|
|
|
183
183
|
// All profiles and transactions are rejected if this is the case and we want to
|
|
184
184
|
// warn users that this is happening if they enable debug flag
|
|
185
185
|
if (trace_id?.length !== 32) {
|
|
186
|
-
DEBUG_BUILD && core.
|
|
186
|
+
DEBUG_BUILD && core.debug.log(`[Profiling] Invalid traceId: ${trace_id} on profiled event`);
|
|
187
187
|
}
|
|
188
188
|
|
|
189
189
|
const enrichedThreadProfile = enrichWithThreadInformation(cpuProfile);
|
|
@@ -242,7 +242,7 @@ function isValidSampleRate(rate) {
|
|
|
242
242
|
// we need to check NaN explicitly because it's of type 'number' and therefore wouldn't get caught by this typecheck
|
|
243
243
|
if ((typeof rate !== 'number' && typeof rate !== 'boolean') || (typeof rate === 'number' && isNaN(rate))) {
|
|
244
244
|
DEBUG_BUILD &&
|
|
245
|
-
core.
|
|
245
|
+
core.debug.warn(
|
|
246
246
|
`[Profiling] Invalid sample rate. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(
|
|
247
247
|
rate,
|
|
248
248
|
)} of type ${JSON.stringify(typeof rate)}.`,
|
|
@@ -257,7 +257,7 @@ function isValidSampleRate(rate) {
|
|
|
257
257
|
|
|
258
258
|
// in case sampleRate is a boolean, it will get automatically cast to 1 if it's true and 0 if it's false
|
|
259
259
|
if (rate < 0 || rate > 1) {
|
|
260
|
-
DEBUG_BUILD && core.
|
|
260
|
+
DEBUG_BUILD && core.debug.warn(`[Profiling] Invalid sample rate. Sample rate must be between 0 and 1. Got ${rate}.`);
|
|
261
261
|
return false;
|
|
262
262
|
}
|
|
263
263
|
return true;
|
|
@@ -274,7 +274,7 @@ function isValidProfile(profile) {
|
|
|
274
274
|
// Log a warning if the profile has less than 2 samples so users can know why
|
|
275
275
|
// they are not seeing any profiling data and we cant avoid the back and forth
|
|
276
276
|
// of asking them to provide us with a dump of the profile data.
|
|
277
|
-
core.
|
|
277
|
+
core.debug.log('[Profiling] Discarding profile because it contains less than 2 samples');
|
|
278
278
|
return false;
|
|
279
279
|
}
|
|
280
280
|
|
|
@@ -296,7 +296,7 @@ function isValidProfileChunk(profile) {
|
|
|
296
296
|
// Log a warning if the profile has less than 2 samples so users can know why
|
|
297
297
|
// they are not seeing any profiling data and we cant avoid the back and forth
|
|
298
298
|
// of asking them to provide us with a dump of the profile data.
|
|
299
|
-
core.
|
|
299
|
+
core.debug.log('[Profiling] Discarding profile chunk because it contains less than 2 samples');
|
|
300
300
|
return false;
|
|
301
301
|
}
|
|
302
302
|
|
|
@@ -426,13 +426,13 @@ function maybeProfileSpan(
|
|
|
426
426
|
|
|
427
427
|
// Client and options are required for profiling
|
|
428
428
|
if (!client) {
|
|
429
|
-
DEBUG_BUILD && core.
|
|
429
|
+
DEBUG_BUILD && core.debug.log('[Profiling] Profiling disabled, no client found.');
|
|
430
430
|
return;
|
|
431
431
|
}
|
|
432
432
|
|
|
433
433
|
const options = client.getOptions();
|
|
434
434
|
if (!options) {
|
|
435
|
-
DEBUG_BUILD && core.
|
|
435
|
+
DEBUG_BUILD && core.debug.log('[Profiling] Profiling disabled, no options found.');
|
|
436
436
|
return;
|
|
437
437
|
}
|
|
438
438
|
|
|
@@ -456,14 +456,14 @@ function maybeProfileSpan(
|
|
|
456
456
|
// Since this is coming from the user (or from a function provided by the user), who knows what we might get. (The
|
|
457
457
|
// only valid values are booleans or numbers between 0 and 1.)
|
|
458
458
|
if (!isValidSampleRate(profilesSampleRate)) {
|
|
459
|
-
DEBUG_BUILD && core.
|
|
459
|
+
DEBUG_BUILD && core.debug.warn('[Profiling] Discarding profile because of invalid sample rate.');
|
|
460
460
|
return;
|
|
461
461
|
}
|
|
462
462
|
|
|
463
463
|
// if the function returned 0 (or false), or if `profileSampleRate` is 0, it's a sign the profile should be dropped
|
|
464
464
|
if (!profilesSampleRate) {
|
|
465
465
|
DEBUG_BUILD &&
|
|
466
|
-
core.
|
|
466
|
+
core.debug.log(
|
|
467
467
|
`[Profiling] Discarding profile because ${
|
|
468
468
|
typeof profilesSampler === 'function'
|
|
469
469
|
? 'profileSampler returned 0 or false'
|
|
@@ -479,7 +479,7 @@ function maybeProfileSpan(
|
|
|
479
479
|
// Check if we should sample this profile
|
|
480
480
|
if (!sampled) {
|
|
481
481
|
DEBUG_BUILD &&
|
|
482
|
-
core.
|
|
482
|
+
core.debug.log(
|
|
483
483
|
`[Profiling] Discarding profile because it's not included in the random sample (sampling rate = ${Number(
|
|
484
484
|
profilesSampleRate,
|
|
485
485
|
)})`,
|
|
@@ -489,7 +489,7 @@ function maybeProfileSpan(
|
|
|
489
489
|
|
|
490
490
|
const profile_id = core.uuid4();
|
|
491
491
|
nodeCpuProfiler.CpuProfilerBindings.startProfiling(profile_id);
|
|
492
|
-
DEBUG_BUILD && core.
|
|
492
|
+
DEBUG_BUILD && core.debug.log(`[Profiling] started profiling transaction: ${core.spanToJSON(span).description}`);
|
|
493
493
|
|
|
494
494
|
// set transaction context - do this regardless if profiling fails down the line
|
|
495
495
|
// so that we can still see the profile_id in the transaction context
|
|
@@ -509,12 +509,12 @@ function stopSpanProfile(span, profile_id) {
|
|
|
509
509
|
}
|
|
510
510
|
|
|
511
511
|
const profile = nodeCpuProfiler.CpuProfilerBindings.stopProfiling(profile_id, 0);
|
|
512
|
-
DEBUG_BUILD && core.
|
|
512
|
+
DEBUG_BUILD && core.debug.log(`[Profiling] stopped profiling of transaction: ${core.spanToJSON(span).description}`);
|
|
513
513
|
|
|
514
514
|
// In case of an overlapping span, stopProfiling may return null and silently ignore the overlapping profile.
|
|
515
515
|
if (!profile) {
|
|
516
516
|
DEBUG_BUILD &&
|
|
517
|
-
core.
|
|
517
|
+
core.debug.log(
|
|
518
518
|
`[Profiling] profiler returned null profile for: ${core.spanToJSON(span).description}`,
|
|
519
519
|
'this may indicate an overlapping span or a call to stopProfiling with a profile title that was never started',
|
|
520
520
|
);
|
|
@@ -568,7 +568,7 @@ class ContinuousProfiler {constructor() { ContinuousProfiler.prototype.__init.ca
|
|
|
568
568
|
this._legacyProfilerMode =
|
|
569
569
|
'profilesSampleRate' in options || 'profilesSampler' in options ? 'span' : 'continuous';
|
|
570
570
|
|
|
571
|
-
DEBUG_BUILD && core.
|
|
571
|
+
DEBUG_BUILD && core.debug.log(`[Profiling] Profiling mode is ${this._legacyProfilerMode}.`);
|
|
572
572
|
|
|
573
573
|
switch (this._legacyProfilerMode) {
|
|
574
574
|
case 'span': {
|
|
@@ -581,7 +581,7 @@ class ContinuousProfiler {constructor() { ContinuousProfiler.prototype.__init.ca
|
|
|
581
581
|
}
|
|
582
582
|
default: {
|
|
583
583
|
DEBUG_BUILD &&
|
|
584
|
-
core.
|
|
584
|
+
core.debug.warn(
|
|
585
585
|
`[Profiling] Unknown profiler mode: ${this._legacyProfilerMode}, profiler was not initialized`,
|
|
586
586
|
);
|
|
587
587
|
break;
|
|
@@ -593,7 +593,7 @@ class ContinuousProfiler {constructor() { ContinuousProfiler.prototype.__init.ca
|
|
|
593
593
|
case 'current': {
|
|
594
594
|
this._setupSpanChunkInstrumentation();
|
|
595
595
|
|
|
596
|
-
DEBUG_BUILD && core.
|
|
596
|
+
DEBUG_BUILD && core.debug.log(`[Profiling] Profiling mode is ${this._profileLifecycle}.`);
|
|
597
597
|
|
|
598
598
|
switch (this._profileLifecycle) {
|
|
599
599
|
case 'trace': {
|
|
@@ -606,14 +606,14 @@ class ContinuousProfiler {constructor() { ContinuousProfiler.prototype.__init.ca
|
|
|
606
606
|
}
|
|
607
607
|
default: {
|
|
608
608
|
DEBUG_BUILD &&
|
|
609
|
-
core.
|
|
609
|
+
core.debug.warn(`[Profiling] Unknown profiler mode: ${this._profileLifecycle}, profiler was not initialized`);
|
|
610
610
|
break;
|
|
611
611
|
}
|
|
612
612
|
}
|
|
613
613
|
break;
|
|
614
614
|
}
|
|
615
615
|
default: {
|
|
616
|
-
DEBUG_BUILD && core.
|
|
616
|
+
DEBUG_BUILD && core.debug.warn(`[Profiling] Unknown profiler mode: ${this._mode}, profiler was not initialized`);
|
|
617
617
|
break;
|
|
618
618
|
}
|
|
619
619
|
}
|
|
@@ -635,17 +635,17 @@ class ContinuousProfiler {constructor() { ContinuousProfiler.prototype.__init.ca
|
|
|
635
635
|
}
|
|
636
636
|
|
|
637
637
|
if (!this._client) {
|
|
638
|
-
DEBUG_BUILD && core.
|
|
638
|
+
DEBUG_BUILD && core.debug.log('[Profiling] Failed to start, sentry client was never attached to the profiler.');
|
|
639
639
|
return;
|
|
640
640
|
}
|
|
641
641
|
|
|
642
642
|
if (this._mode !== 'legacy') {
|
|
643
|
-
DEBUG_BUILD && core.
|
|
643
|
+
DEBUG_BUILD && core.debug.log('[Profiling] Continuous profiling is not supported in the current mode.');
|
|
644
644
|
return;
|
|
645
645
|
}
|
|
646
646
|
|
|
647
647
|
if (this._legacyProfilerMode === 'span') {
|
|
648
|
-
DEBUG_BUILD && core.
|
|
648
|
+
DEBUG_BUILD && core.debug.log('[Profiling] Calls to profiler.start() are not supported in span profiling mode.');
|
|
649
649
|
return;
|
|
650
650
|
}
|
|
651
651
|
|
|
@@ -669,17 +669,17 @@ class ContinuousProfiler {constructor() { ContinuousProfiler.prototype.__init.ca
|
|
|
669
669
|
}
|
|
670
670
|
|
|
671
671
|
if (!this._client) {
|
|
672
|
-
DEBUG_BUILD && core.
|
|
672
|
+
DEBUG_BUILD && core.debug.log('[Profiling] Failed to stop, sentry client was never attached to the profiler.');
|
|
673
673
|
return;
|
|
674
674
|
}
|
|
675
675
|
|
|
676
676
|
if (this._mode !== 'legacy') {
|
|
677
|
-
DEBUG_BUILD && core.
|
|
677
|
+
DEBUG_BUILD && core.debug.log('[Profiling] Continuous profiling is not supported in the current mode.');
|
|
678
678
|
return;
|
|
679
679
|
}
|
|
680
680
|
|
|
681
681
|
if (this._legacyProfilerMode === 'span') {
|
|
682
|
-
DEBUG_BUILD && core.
|
|
682
|
+
DEBUG_BUILD && core.debug.log('[Profiling] Calls to profiler.stop() are not supported in span profiling mode.');
|
|
683
683
|
return;
|
|
684
684
|
}
|
|
685
685
|
|
|
@@ -689,25 +689,25 @@ class ContinuousProfiler {constructor() { ContinuousProfiler.prototype.__init.ca
|
|
|
689
689
|
|
|
690
690
|
_startProfiler() {
|
|
691
691
|
if (this._mode !== 'current') {
|
|
692
|
-
DEBUG_BUILD && core.
|
|
692
|
+
DEBUG_BUILD && core.debug.log('[Profiling] Continuous profiling is not supported in the current mode.');
|
|
693
693
|
return;
|
|
694
694
|
}
|
|
695
695
|
|
|
696
696
|
if (this._chunkData !== undefined) {
|
|
697
|
-
DEBUG_BUILD && core.
|
|
697
|
+
DEBUG_BUILD && core.debug.log('[Profiling] Profile session already running, no-op.');
|
|
698
698
|
return;
|
|
699
699
|
}
|
|
700
700
|
|
|
701
701
|
if (this._mode === 'current') {
|
|
702
702
|
if (!this._sampled) {
|
|
703
|
-
DEBUG_BUILD && core.
|
|
703
|
+
DEBUG_BUILD && core.debug.log('[Profiling] Profile session not sampled, no-op.');
|
|
704
704
|
return;
|
|
705
705
|
}
|
|
706
706
|
}
|
|
707
707
|
|
|
708
708
|
if (this._profileLifecycle === 'trace') {
|
|
709
709
|
DEBUG_BUILD &&
|
|
710
|
-
core.
|
|
710
|
+
core.debug.log(
|
|
711
711
|
'[Profiling] You are using the trace profile lifecycle, manual calls to profiler.startProfiler() and profiler.stopProfiler() will be ignored.',
|
|
712
712
|
);
|
|
713
713
|
return;
|
|
@@ -718,20 +718,20 @@ class ContinuousProfiler {constructor() { ContinuousProfiler.prototype.__init.ca
|
|
|
718
718
|
|
|
719
719
|
_stopProfiler() {
|
|
720
720
|
if (this._mode !== 'current') {
|
|
721
|
-
DEBUG_BUILD && core.
|
|
721
|
+
DEBUG_BUILD && core.debug.log('[Profiling] Continuous profiling is not supported in the current mode.');
|
|
722
722
|
return;
|
|
723
723
|
}
|
|
724
724
|
|
|
725
725
|
if (this._profileLifecycle === 'trace') {
|
|
726
726
|
DEBUG_BUILD &&
|
|
727
|
-
core.
|
|
727
|
+
core.debug.log(
|
|
728
728
|
'[Profiling] You are using the trace profile lifecycle, manual calls to profiler.startProfiler() and profiler.stopProfiler() will be ignored.',
|
|
729
729
|
);
|
|
730
730
|
return;
|
|
731
731
|
}
|
|
732
732
|
|
|
733
733
|
if (!this._chunkData) {
|
|
734
|
-
DEBUG_BUILD && core.
|
|
734
|
+
DEBUG_BUILD && core.debug.log('[Profiling] No profile session running, no-op.');
|
|
735
735
|
return;
|
|
736
736
|
}
|
|
737
737
|
|
|
@@ -744,7 +744,7 @@ class ContinuousProfiler {constructor() { ContinuousProfiler.prototype.__init.ca
|
|
|
744
744
|
_startTraceLifecycleProfiling() {
|
|
745
745
|
if (!this._client) {
|
|
746
746
|
DEBUG_BUILD &&
|
|
747
|
-
core.
|
|
747
|
+
core.debug.log(
|
|
748
748
|
'[Profiling] Failed to start trace lifecycle profiling, sentry client was never attached to the profiler.',
|
|
749
749
|
);
|
|
750
750
|
return;
|
|
@@ -769,7 +769,7 @@ class ContinuousProfiler {constructor() { ContinuousProfiler.prototype.__init.ca
|
|
|
769
769
|
_setupAutomaticSpanProfiling() {
|
|
770
770
|
if (!this._client) {
|
|
771
771
|
DEBUG_BUILD &&
|
|
772
|
-
core.
|
|
772
|
+
core.debug.log(
|
|
773
773
|
'[Profiling] Failed to setup automatic span profiling, sentry client was never attached to the profiler.',
|
|
774
774
|
);
|
|
775
775
|
return;
|
|
@@ -800,7 +800,7 @@ class ContinuousProfiler {constructor() { ContinuousProfiler.prototype.__init.ca
|
|
|
800
800
|
// Enqueue a timeout to prevent profiles from running over max duration.
|
|
801
801
|
const timeout = global.setTimeout(() => {
|
|
802
802
|
DEBUG_BUILD &&
|
|
803
|
-
core.
|
|
803
|
+
core.debug.log(
|
|
804
804
|
'[Profiling] max profile duration elapsed, stopping profiling for:',
|
|
805
805
|
core.spanToJSON(span).description,
|
|
806
806
|
);
|
|
@@ -864,7 +864,7 @@ class ContinuousProfiler {constructor() { ContinuousProfiler.prototype.__init.ca
|
|
|
864
864
|
|
|
865
865
|
const cpuProfile = takeFromProfileQueue(profile_id);
|
|
866
866
|
if (!cpuProfile) {
|
|
867
|
-
DEBUG_BUILD && core.
|
|
867
|
+
DEBUG_BUILD && core.debug.log(`[Profiling] Could not retrieve profile for transaction: ${profile_id}`);
|
|
868
868
|
continue;
|
|
869
869
|
}
|
|
870
870
|
|
|
@@ -899,13 +899,13 @@ class ContinuousProfiler {constructor() { ContinuousProfiler.prototype.__init.ca
|
|
|
899
899
|
// The client is not attached to the profiler if the user has not enabled continuous profiling.
|
|
900
900
|
// In this case, calling start() and stop() is a noop action.The reason this exists is because
|
|
901
901
|
// it makes the types easier to work with and avoids users having to do null checks.
|
|
902
|
-
DEBUG_BUILD && core.
|
|
902
|
+
DEBUG_BUILD && core.debug.log('[Profiling] Profiler was never attached to the client.');
|
|
903
903
|
return;
|
|
904
904
|
}
|
|
905
905
|
|
|
906
906
|
if (this._chunkData) {
|
|
907
907
|
DEBUG_BUILD &&
|
|
908
|
-
core.
|
|
908
|
+
core.debug.log(
|
|
909
909
|
`[Profiling] Chunk with chunk_id ${this._chunkData.id} is still running, current chunk will be stopped a new chunk will be started.`,
|
|
910
910
|
);
|
|
911
911
|
this._stopChunkProfiling();
|
|
@@ -919,26 +919,26 @@ class ContinuousProfiler {constructor() { ContinuousProfiler.prototype.__init.ca
|
|
|
919
919
|
*/
|
|
920
920
|
_stopChunkProfiling() {
|
|
921
921
|
if (!this._chunkData) {
|
|
922
|
-
DEBUG_BUILD && core.
|
|
922
|
+
DEBUG_BUILD && core.debug.log('[Profiling] No chunk data found, no-op.');
|
|
923
923
|
return;
|
|
924
924
|
}
|
|
925
925
|
|
|
926
926
|
if (this._chunkData?.timer) {
|
|
927
927
|
global.clearTimeout(this._chunkData.timer);
|
|
928
928
|
this._chunkData.timer = undefined;
|
|
929
|
-
DEBUG_BUILD && core.
|
|
929
|
+
DEBUG_BUILD && core.debug.log(`[Profiling] Stopping profiling chunk: ${this._chunkData.id}`);
|
|
930
930
|
}
|
|
931
931
|
|
|
932
932
|
if (!this._client) {
|
|
933
933
|
DEBUG_BUILD &&
|
|
934
|
-
core.
|
|
934
|
+
core.debug.log('[Profiling] Failed to collect profile, sentry client was never attached to the profiler.');
|
|
935
935
|
this._resetChunkData();
|
|
936
936
|
return;
|
|
937
937
|
}
|
|
938
938
|
|
|
939
939
|
if (!this._chunkData?.id) {
|
|
940
940
|
DEBUG_BUILD &&
|
|
941
|
-
core.
|
|
941
|
+
core.debug.log(`[Profiling] Failed to collect profile for: ${this._chunkData?.id}, the chunk_id is missing.`);
|
|
942
942
|
this._resetChunkData();
|
|
943
943
|
return;
|
|
944
944
|
}
|
|
@@ -946,22 +946,22 @@ class ContinuousProfiler {constructor() { ContinuousProfiler.prototype.__init.ca
|
|
|
946
946
|
const profile = nodeCpuProfiler.CpuProfilerBindings.stopProfiling(this._chunkData.id, nodeCpuProfiler.ProfileFormat.CHUNK);
|
|
947
947
|
|
|
948
948
|
if (!profile) {
|
|
949
|
-
DEBUG_BUILD && core.
|
|
949
|
+
DEBUG_BUILD && core.debug.log(`[Profiling] Failed to collect profile for: ${this._chunkData.id}`);
|
|
950
950
|
this._resetChunkData();
|
|
951
951
|
return;
|
|
952
952
|
}
|
|
953
953
|
|
|
954
954
|
if (!this._profilerId) {
|
|
955
955
|
DEBUG_BUILD &&
|
|
956
|
-
core.
|
|
956
|
+
core.debug.log('[Profiling] Profile chunk does not contain a valid profiler_id, this is a bug in the SDK');
|
|
957
957
|
this._resetChunkData();
|
|
958
958
|
return;
|
|
959
959
|
}
|
|
960
960
|
if (profile) {
|
|
961
|
-
DEBUG_BUILD && core.
|
|
961
|
+
DEBUG_BUILD && core.debug.log(`[Profiling] Sending profile chunk ${this._chunkData.id}.`);
|
|
962
962
|
}
|
|
963
963
|
|
|
964
|
-
DEBUG_BUILD && core.
|
|
964
|
+
DEBUG_BUILD && core.debug.log(`[Profiling] Profile chunk ${this._chunkData.id} sent to Sentry.`);
|
|
965
965
|
const chunk = createProfilingChunkEvent(
|
|
966
966
|
this._client,
|
|
967
967
|
this._client.getOptions(),
|
|
@@ -975,7 +975,7 @@ class ContinuousProfiler {constructor() { ContinuousProfiler.prototype.__init.ca
|
|
|
975
975
|
);
|
|
976
976
|
|
|
977
977
|
if (!chunk) {
|
|
978
|
-
DEBUG_BUILD && core.
|
|
978
|
+
DEBUG_BUILD && core.debug.log(`[Profiling] Failed to create profile chunk for: ${this._chunkData.id}`);
|
|
979
979
|
this._resetChunkData();
|
|
980
980
|
return;
|
|
981
981
|
}
|
|
@@ -995,13 +995,13 @@ class ContinuousProfiler {constructor() { ContinuousProfiler.prototype.__init.ca
|
|
|
995
995
|
_flush(chunk) {
|
|
996
996
|
if (!this._client) {
|
|
997
997
|
DEBUG_BUILD &&
|
|
998
|
-
core.
|
|
998
|
+
core.debug.log('[Profiling] Failed to collect profile, sentry client was never attached to the profiler.');
|
|
999
999
|
return;
|
|
1000
1000
|
}
|
|
1001
1001
|
|
|
1002
1002
|
const transport = this._client.getTransport();
|
|
1003
1003
|
if (!transport) {
|
|
1004
|
-
DEBUG_BUILD && core.
|
|
1004
|
+
DEBUG_BUILD && core.debug.log('[Profiling] No transport available to send profile chunk.');
|
|
1005
1005
|
return;
|
|
1006
1006
|
}
|
|
1007
1007
|
|
|
@@ -1011,7 +1011,7 @@ class ContinuousProfiler {constructor() { ContinuousProfiler.prototype.__init.ca
|
|
|
1011
1011
|
|
|
1012
1012
|
const envelope = makeProfileChunkEnvelope('node', chunk, metadata?.sdk, tunnel, dsn);
|
|
1013
1013
|
transport.send(envelope).then(null, reason => {
|
|
1014
|
-
DEBUG_BUILD && core.
|
|
1014
|
+
DEBUG_BUILD && core.debug.error('Error while sending profile chunk envelope:', reason);
|
|
1015
1015
|
});
|
|
1016
1016
|
}
|
|
1017
1017
|
|
|
@@ -1021,7 +1021,7 @@ class ContinuousProfiler {constructor() { ContinuousProfiler.prototype.__init.ca
|
|
|
1021
1021
|
*/
|
|
1022
1022
|
_startChunkProfiling() {
|
|
1023
1023
|
if (this._chunkData) {
|
|
1024
|
-
DEBUG_BUILD && core.
|
|
1024
|
+
DEBUG_BUILD && core.debug.log('[Profiling] Chunk is already running, no-op.');
|
|
1025
1025
|
return;
|
|
1026
1026
|
}
|
|
1027
1027
|
|
|
@@ -1030,12 +1030,12 @@ class ContinuousProfiler {constructor() { ContinuousProfiler.prototype.__init.ca
|
|
|
1030
1030
|
const chunk = this._initializeChunk(traceId);
|
|
1031
1031
|
|
|
1032
1032
|
nodeCpuProfiler.CpuProfilerBindings.startProfiling(chunk.id);
|
|
1033
|
-
DEBUG_BUILD && core.
|
|
1033
|
+
DEBUG_BUILD && core.debug.log(`[Profiling] starting profiling chunk: ${chunk.id}`);
|
|
1034
1034
|
|
|
1035
1035
|
chunk.timer = global.setTimeout(() => {
|
|
1036
|
-
DEBUG_BUILD && core.
|
|
1036
|
+
DEBUG_BUILD && core.debug.log(`[Profiling] Stopping profiling chunk: ${chunk.id}`);
|
|
1037
1037
|
this._stopChunkProfiling();
|
|
1038
|
-
DEBUG_BUILD && core.
|
|
1038
|
+
DEBUG_BUILD && core.debug.log('[Profiling] Starting new profiling chunk.');
|
|
1039
1039
|
setImmediate(this._restartChunkProfiling.bind(this));
|
|
1040
1040
|
}, CHUNK_INTERVAL_MS);
|
|
1041
1041
|
|
|
@@ -1050,9 +1050,7 @@ class ContinuousProfiler {constructor() { ContinuousProfiler.prototype.__init.ca
|
|
|
1050
1050
|
_setupSpanChunkInstrumentation() {
|
|
1051
1051
|
if (!this._client) {
|
|
1052
1052
|
DEBUG_BUILD &&
|
|
1053
|
-
core.
|
|
1054
|
-
'[Profiling] Failed to initialize span profiling, sentry client was never attached to the profiler.',
|
|
1055
|
-
);
|
|
1053
|
+
core.debug.log('[Profiling] Failed to initialize span profiling, sentry client was never attached to the profiler.');
|
|
1056
1054
|
return;
|
|
1057
1055
|
}
|
|
1058
1056
|
|
|
@@ -1141,7 +1139,7 @@ const _nodeProfilingIntegration = (() => {
|
|
|
1141
1139
|
name: 'ProfilingIntegration',
|
|
1142
1140
|
_profiler: new ContinuousProfiler(),
|
|
1143
1141
|
setup(client) {
|
|
1144
|
-
DEBUG_BUILD && core.
|
|
1142
|
+
DEBUG_BUILD && core.debug.log('[Profiling] Profiling integration setup.');
|
|
1145
1143
|
this._profiler.initialize(client);
|
|
1146
1144
|
return;
|
|
1147
1145
|
},
|