package.build.cjs.profiling.js.map Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of core Show documentation
Show all versions of core Show documentation
Base implementation for all Sentry JavaScript SDKs
{"version":3,"file":"profiling.js","sources":["../../src/profiling.ts"],"sourcesContent":["import type { Profiler, ProfilingIntegration } from '@sentry/types';\nimport { logger } from '@sentry/utils';\n\nimport { getClient } from './currentScopes';\nimport { DEBUG_BUILD } from './debug-build';\n\nfunction isProfilingIntegrationWithProfiler(\n integration: ProfilingIntegration | undefined,\n): integration is ProfilingIntegration {\n return (\n !!integration &&\n typeof integration['_profiler'] !== 'undefined' &&\n typeof integration['_profiler']['start'] === 'function' &&\n typeof integration['_profiler']['stop'] === 'function'\n );\n}\n/**\n * Starts the Sentry continuous profiler.\n * This mode is exclusive with the transaction profiler and will only work if the profilesSampleRate is set to a falsy value.\n * In continuous profiling mode, the profiler will keep reporting profile chunks to Sentry until it is stopped, which allows for continuous profiling of the application.\n */\nfunction startProfiler(): void {\n const client = getClient();\n if (!client) {\n DEBUG_BUILD && logger.warn('No Sentry client available, profiling is not started');\n return;\n }\n\n const integration = client.getIntegrationByName>('ProfilingIntegration');\n\n if (!integration) {\n DEBUG_BUILD && logger.warn('ProfilingIntegration is not available');\n return;\n }\n\n if (!isProfilingIntegrationWithProfiler(integration)) {\n DEBUG_BUILD && logger.warn('Profiler is not available on profiling integration.');\n return;\n }\n\n integration._profiler.start();\n}\n\n/**\n * Stops the Sentry continuous profiler.\n * Calls to stop will stop the profiler and flush the currently collected profile data to Sentry.\n */\nfunction stopProfiler(): void {\n const client = getClient();\n if (!client) {\n DEBUG_BUILD && logger.warn('No Sentry client available, profiling is not started');\n return;\n }\n\n const integration = client.getIntegrationByName>('ProfilingIntegration');\n if (!integration) {\n DEBUG_BUILD && logger.warn('ProfilingIntegration is not available');\n return;\n }\n\n if (!isProfilingIntegrationWithProfiler(integration)) {\n DEBUG_BUILD && logger.warn('Profiler is not available on profiling integration.');\n return;\n }\n\n integration._profiler.stop();\n}\n\nexport const profiler: Profiler = {\n startProfiler,\n stopProfiler,\n};\n"],"names":["getClient","DEBUG_BUILD","logger"],"mappings":";;;;;;AAMA,SAAS,kCAAkC;AAC3C,EAAE,WAAW;AACb,EAA4C;AAC5C,EAAE;AACF,IAAI,CAAC,CAAC,WAAY;AAClB,IAAI,OAAO,WAAW,CAAC,WAAW,CAAA,KAAM,WAAY;AACpD,IAAI,OAAO,WAAW,CAAC,WAAW,CAAC,CAAC,OAAO,CAAE,KAAI,UAAW;AAC5D,IAAI,OAAO,WAAW,CAAC,WAAW,CAAC,CAAC,MAAM,MAAM,UAAA;AAChD,IAAG;AACH,CAAA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,aAAa,GAAS;AAC/B,EAAE,MAAM,MAAA,GAASA,uBAAS,EAAE,CAAA;AAC5B,EAAE,IAAI,CAAC,MAAM,EAAE;AACf,IAAIC,0BAAeC,YAAM,CAAC,IAAI,CAAC,sDAAsD,CAAC,CAAA;AACtF,IAAI,OAAM;AACV,GAAE;AACF;AACA,EAAE,MAAM,cAAc,MAAM,CAAC,oBAAoB,CAA4B,sBAAsB,CAAC,CAAA;AACpG;AACA,EAAE,IAAI,CAAC,WAAW,EAAE;AACpB,IAAID,0BAAeC,YAAM,CAAC,IAAI,CAAC,uCAAuC,CAAC,CAAA;AACvE,IAAI,OAAM;AACV,GAAE;AACF;AACA,EAAE,IAAI,CAAC,kCAAkC,CAAC,WAAW,CAAC,EAAE;AACxD,IAAID,0BAAeC,YAAM,CAAC,IAAI,CAAC,qDAAqD,CAAC,CAAA;AACrF,IAAI,OAAM;AACV,GAAE;AACF;AACA,EAAE,WAAW,CAAC,SAAS,CAAC,KAAK,EAAE,CAAA;AAC/B,CAAA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,YAAY,GAAS;AAC9B,EAAE,MAAM,MAAA,GAASF,uBAAS,EAAE,CAAA;AAC5B,EAAE,IAAI,CAAC,MAAM,EAAE;AACf,IAAIC,0BAAeC,YAA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