(profile: RawThreadCpuProfile)
| 292 | * @returns {boolean} |
| 293 | */ |
| 294 | export 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. |
no test coverage detected