MCPcopy Index your code
hub / github.com/getsentry/sentry-javascript / isValidProfile

Function isValidProfile

packages/browser/src/profiling/utils.ts:559–578  ·  view source on GitHub ↗
(profile: JSSelfProfile)

Source from the content-addressed store, hash-verified

557}
558
559function isValidProfile(profile: JSSelfProfile): profile is JSSelfProfile & { profile_id: string } {
560 if (profile.samples.length < 2) {
561 if (DEBUG_BUILD) {
562 // Log a warning if the profile has less than 2 samples so users can know why
563 // they are not seeing any profiling data and we cant avoid the back and forth
564 // of asking them to provide us with a dump of the profile data.
565 debug.log('[Profiling] Discarding profile because it contains less than 2 samples');
566 }
567 return false;
568 }
569
570 if (!profile.frames.length) {
571 if (DEBUG_BUILD) {
572 debug.log('[Profiling] Discarding profile because it contains no frames');
573 }
574 return false;
575 }
576
577 return true;
578}
579
580// Keep a flag value to avoid re-initializing the profiler constructor. If it fails
581// once, it will always fail and this allows us to early return.

Callers 1

createProfilingEventFunction · 0.70

Calls 1

logMethod · 0.65

Tested by

no test coverage detected