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

Function isValidProfile

packages/profiling-node/src/utils.ts:294–309  ·  view source on GitHub ↗
(profile: RawThreadCpuProfile)

Source from the content-addressed store, hash-verified

292 * @returns {boolean}
293 */
294export function isValidProfile(profile: RawThreadCpuProfile): profile is RawThreadCpuProfile & { profile_id: string } {
295 if (profile.samples.length <= 1) {
296 DEBUG_BUILD &&
297 // Log a warning if the profile has less than 2 samples so users can know why
298 // they are not seeing any profiling data and we cant avoid the back and forth
299 // of asking them to provide us with a dump of the profile data.
300 debug.log('[Profiling] Discarding profile because it contains less than 2 samples');
301 return false;
302 }
303
304 if (!profile.profile_id) {
305 return false;
306 }
307
308 return true;
309}
310
311/**
312 * Checks if the profile chunk is valid and can be sent to Sentry.

Callers 2

utils.test.tsFile · 0.90
createProfilingEventFunction · 0.70

Calls 1

logMethod · 0.65

Tested by

no test coverage detected