@sentry/profiling-node 11.1.0 → 11.3.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
CHANGED
|
@@ -309,16 +309,11 @@ class ContinuousProfiler {
|
|
|
309
309
|
DEBUG_BUILD && core.debug.log("[Profiling] Failed to collect profile, sentry client was never attached to the profiler.");
|
|
310
310
|
return;
|
|
311
311
|
}
|
|
312
|
-
const transport = this._client.getTransport();
|
|
313
|
-
if (!transport) {
|
|
314
|
-
DEBUG_BUILD && core.debug.log("[Profiling] No transport available to send profile chunk.");
|
|
315
|
-
return;
|
|
316
|
-
}
|
|
317
312
|
const dsn = this._client.getDsn();
|
|
318
313
|
const metadata = this._client.getSdkMetadata();
|
|
319
314
|
const tunnel = this._client.getOptions().tunnel;
|
|
320
315
|
const envelope = makeProfileChunkEnvelope("node", chunk, metadata?.sdk, tunnel, dsn);
|
|
321
|
-
|
|
316
|
+
this._client.sendEnvelope(envelope).then(null, (reason) => {
|
|
322
317
|
DEBUG_BUILD && core.debug.error("Error while sending profile chunk envelope:", reason);
|
|
323
318
|
});
|
|
324
319
|
}
|
package/build/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/debug-build.ts","../../src/nodeVersion.ts","../../src/utils.ts","../../src/integration.ts"],"sourcesContent":["declare const __DEBUG_BUILD__: boolean;\n\n/**\n * This serves as a build time flag that will be true by default, but false in non-debug builds or if users replace `__SENTRY_DEBUG__` in their generated code.\n *\n * ATTENTION: This constant must never cross package boundaries (i.e. be exported) to guarantee that it can be used for tree shaking.\n */\nexport const DEBUG_BUILD = __DEBUG_BUILD__;\n","import { parseSemver } from '@sentry/core';\n\nexport const NODE_VERSION = parseSemver(process.versions.node) as { major: number; minor: number; patch: number };\nexport const NODE_MAJOR = NODE_VERSION.major;\n","import type {\n Client,\n ContinuousThreadCpuProfile,\n DebugImage,\n DsnComponents,\n EventEnvelopeHeaders,\n ProfileChunk,\n ProfileChunkEnvelope,\n ProfileChunkItem,\n SdkInfo,\n} from '@sentry/core';\nimport { createEnvelope, debug, dsnToString, getDebugImagesForResources, uuid4 } from '@sentry/core';\nimport type { RawChunkCpuProfile } from '@sentry/node-cpu-profiler';\nimport { isMainThread, threadId } from 'worker_threads';\nimport { DEBUG_BUILD } from './debug-build';\n\n// We require the file because if we import it, it will be included in the bundle.\n// I guess tsc does not check file contents when it's imported.\nexport const PROFILER_THREAD_ID_STRING = String(threadId);\nexport const PROFILER_THREAD_NAME = isMainThread ? 'main' : 'worker';\nconst CONTINUOUS_FORMAT_VERSION = '2';\n\n/**\n * Checks if the profile is a raw profile or a profile enriched with thread information.\n * @param {ContinuousThreadCpuProfile | RawChunkCpuProfile} profile\n * @returns {boolean}\n */\nfunction isRawThreadCpuProfile(\n profile: ContinuousThreadCpuProfile | RawChunkCpuProfile,\n): profile is RawChunkCpuProfile {\n return !('thread_metadata' in profile);\n}\n\n/**\n * Enriches the profile with threadId of the current thread.\n * This is done in node as we seem to not be able to get the info from C native code.\n *\n * @param {ContinuousThreadCpuProfile | RawChunkCpuProfile} profile\n * @returns {ContinuousThreadCpuProfile}\n */\nexport function enrichWithThreadInformation(\n profile: ContinuousThreadCpuProfile | RawChunkCpuProfile,\n): ContinuousThreadCpuProfile {\n if (!isRawThreadCpuProfile(profile)) {\n return profile;\n }\n\n return {\n samples: profile.samples,\n frames: profile.frames,\n stacks: profile.stacks,\n thread_metadata: {\n [PROFILER_THREAD_ID_STRING]: {\n name: PROFILER_THREAD_NAME,\n },\n },\n };\n}\n\n/**\n * Create a profile chunk from raw thread profile\n * @param {RawChunkCpuProfile} cpuProfile\n * @returns {ProfileChunk}\n */\nfunction createProfileChunkPayload(\n client: Client,\n cpuProfile: RawChunkCpuProfile,\n {\n release,\n environment,\n trace_id,\n profiler_id,\n chunk_id,\n sdk,\n }: {\n release: string;\n environment: string;\n trace_id: string | undefined;\n chunk_id: string;\n profiler_id: string;\n sdk: SdkInfo | undefined;\n },\n): ProfileChunk {\n // Log a warning if the profile has an invalid traceId (should be uuidv4).\n // All profiles and transactions are rejected if this is the case and we want to\n // warn users that this is happening if they enable debug flag\n if (trace_id?.length !== 32) {\n DEBUG_BUILD && debug.log(`[Profiling] Invalid traceId: ${trace_id} on profiled event`);\n }\n\n const enrichedThreadProfile = enrichWithThreadInformation(cpuProfile);\n\n const profile: ProfileChunk = {\n chunk_id: chunk_id,\n client_sdk: {\n name: sdk?.name ?? 'sentry.javascript.node',\n version: sdk?.version ?? '0.0.0',\n },\n profiler_id: profiler_id,\n platform: 'node',\n version: CONTINUOUS_FORMAT_VERSION,\n release: release,\n environment: environment,\n measurements: cpuProfile.measurements,\n debug_meta: {\n images: applyDebugMetadata(client, cpuProfile.resources),\n },\n profile: enrichedThreadProfile,\n };\n\n return profile;\n}\n\n/**\n * Creates a profiling chunk envelope item, if the profile does not pass validation, returns null.\n */\nexport function createProfilingChunkEvent(\n client: Client,\n options: { release?: string; environment?: string },\n profile: RawChunkCpuProfile,\n sdk: SdkInfo | undefined,\n identifiers: { trace_id: string | undefined; chunk_id: string; profiler_id: string },\n): ProfileChunk | null {\n if (!isValidProfileChunk(profile)) {\n return null;\n }\n\n return createProfileChunkPayload(client, profile, {\n release: options.release ?? '',\n environment: options.environment ?? '',\n trace_id: identifiers.trace_id ?? '',\n chunk_id: identifiers.chunk_id,\n profiler_id: identifiers.profiler_id,\n sdk,\n });\n}\n\n/**\n * Checks if the profile chunk is valid and can be sent to Sentry.\n * @param profile\n * @returns\n */\nexport function isValidProfileChunk(profile: RawChunkCpuProfile): profile is RawChunkCpuProfile {\n if (profile.samples.length <= 1) {\n DEBUG_BUILD &&\n // Log a warning if the profile has less than 2 samples so users can know why\n // they are not seeing any profiling data and we cant avoid the back and forth\n // of asking them to provide us with a dump of the profile data.\n debug.log('[Profiling] Discarding profile chunk because it contains less than 2 samples');\n return false;\n }\n\n return true;\n}\n\n/**\n * Creates event envelope headers for a profile chunk. This is separate from createEventEnvelopeHeaders util\n * as the profile chunk does not conform to the sentry event type\n */\nexport function createEventEnvelopeHeaders(\n sdkInfo: SdkInfo | undefined,\n tunnel: string | undefined,\n dsn?: DsnComponents,\n): EventEnvelopeHeaders {\n return {\n event_id: uuid4(),\n sent_at: new Date().toISOString(),\n ...(sdkInfo && { sdk: sdkInfo }),\n ...(!!tunnel && dsn && { dsn: dsnToString(dsn) }),\n };\n}\n\n/**\n * Creates a standalone profile_chunk envelope.\n */\nexport function makeProfileChunkEnvelope(\n platform: 'node',\n chunk: ProfileChunk,\n sdkInfo: SdkInfo | undefined,\n tunnel: string | undefined,\n dsn?: DsnComponents,\n): ProfileChunkEnvelope {\n const profileChunkHeader: ProfileChunkItem[0] = {\n type: 'profile_chunk',\n platform,\n };\n\n return createEnvelope<ProfileChunkEnvelope>(createEventEnvelopeHeaders(sdkInfo, tunnel, dsn), [\n [profileChunkHeader, chunk],\n ]);\n}\n\n/**\n * Cross reference profile collected resources with debug_ids and return a list of debug images.\n * @param {string[]} resource_paths\n * @returns {DebugImage[]}\n */\nexport function applyDebugMetadata(client: Client, resource_paths: ReadonlyArray<string>): DebugImage[] {\n const options = client.getOptions();\n\n if (!options?.stackParser) {\n return [];\n }\n\n return getDebugImagesForResources(options.stackParser, resource_paths);\n}\n","/* eslint-disable max-lines */\nimport type { Event, IntegrationFn, ProfileChunk, ProfilingIntegration } from '@sentry/core';\nimport { consoleSandbox, debug, defineIntegration, getCurrentScope, getGlobalScope, uuid4 } from '@sentry/core';\nimport type { NodeClient } from '@sentry/node';\nimport { CpuProfilerBindings, ProfileFormat } from '@sentry/node-cpu-profiler';\nimport { isMainThread } from 'worker_threads';\nimport { DEBUG_BUILD } from './debug-build';\nimport { NODE_MAJOR } from './nodeVersion';\nimport {\n createProfilingChunkEvent,\n makeProfileChunkEnvelope,\n PROFILER_THREAD_ID_STRING,\n PROFILER_THREAD_NAME,\n} from './utils';\n\nconst CHUNK_INTERVAL_MS = 1000 * 60;\ninterface ChunkData {\n id: string;\n timer: NodeJS.Timeout | undefined;\n startTraceID: string;\n}\n\nclass ContinuousProfiler {\n private _profilerId: string | undefined;\n private _client: NodeClient | undefined = undefined;\n private _chunkData: ChunkData | undefined = undefined;\n private _profileLifecycle: 'manual' | 'trace' | undefined = undefined;\n private _sampled: boolean | undefined = undefined;\n private _sessionSamplingRate: number | undefined = undefined;\n /**\n * Called when the profiler is attached to the client (continuous mode is enabled). If of the profiler\n * methods called before the profiler is initialized will result in a noop action with debug logs.\n * @param client\n */\n public initialize(client: NodeClient): void {\n if (!isMainThread) {\n DEBUG_BUILD &&\n debug.warn(\n '[Profiling] nodeProfilingIntegration() does not support worker threads — profiling will be disabled for this thread.',\n );\n return;\n }\n\n this._client = client;\n const options = client.getOptions();\n\n this._sessionSamplingRate = Math.random();\n this._sampled = this._sessionSamplingRate < (options.profileSessionSampleRate ?? 0);\n this._profileLifecycle = options.profileLifecycle ?? 'manual';\n\n this._setupSpanChunkInstrumentation();\n\n DEBUG_BUILD && debug.log(`[Profiling] Profiling mode is ${this._profileLifecycle}.`);\n\n switch (this._profileLifecycle) {\n case 'trace': {\n this._startTraceLifecycleProfiling();\n break;\n }\n case 'manual': {\n // Manual mode requires manual calls to profiler.startProfiler() and profiler.stopProfiler().\n break;\n }\n default: {\n DEBUG_BUILD &&\n debug.warn(`[Profiling] Unknown profiler mode: ${this._profileLifecycle}, profiler was not initialized`);\n break;\n }\n }\n\n // Attaches a listener to beforeSend which will add the threadId data to the event being sent.\n // This adds a constant overhead to all events being sent which could be improved to only attach\n // and detach the listener during a profiler session\n this._client.on('beforeSendEvent', this._onBeforeSendThreadContextAssignment.bind(this));\n }\n\n /**\n * Initializes a new profilerId session and schedules chunk profiling.\n * @returns void\n */\n public start(): void {\n if (!this._client) {\n DEBUG_BUILD && debug.log('[Profiling] Failed to start, Sentry client was never attached to the profiler.');\n return;\n }\n\n this._startProfiler();\n }\n\n /**\n * Stops the current chunk and flushes the profile to Sentry.\n */\n public stop(): void {\n this._stopProfiler();\n }\n\n private _startProfiler(): void {\n if (this._chunkData !== undefined) {\n DEBUG_BUILD && debug.log('[Profiling] Profile session already running, no-op.');\n return;\n }\n\n if (!this._sampled) {\n DEBUG_BUILD && debug.log('[Profiling] Profile session not sampled, no-op.');\n return;\n }\n\n if (this._profileLifecycle === 'trace') {\n DEBUG_BUILD &&\n debug.log(\n '[Profiling] You are using the trace profile lifecycle, manual calls to profiler.startProfiler() and profiler.stopProfiler() will be ignored.',\n );\n return;\n }\n\n this._startChunkProfiling();\n }\n\n private _stopProfiler(): void {\n if (this._profileLifecycle === 'trace') {\n DEBUG_BUILD &&\n debug.log(\n '[Profiling] You are using the trace profile lifecycle, manual calls to profiler.startProfiler() and profiler.stopProfiler() will be ignored.',\n );\n return;\n }\n\n if (!this._chunkData) {\n DEBUG_BUILD && debug.log('[Profiling] No profile session running, no-op.');\n return;\n }\n\n this._stopChunkProfiling();\n }\n\n /**\n * Starts trace lifecycle profiling. Profiling will remain active as long as there is an active span.\n */\n private _startTraceLifecycleProfiling(): void {\n if (!this._sampled) {\n DEBUG_BUILD &&\n debug.log('[Profiling] Profile session not sampled, trace lifecycle profiling will not be started.');\n return;\n }\n\n if (!this._client) {\n DEBUG_BUILD &&\n debug.log(\n '[Profiling] Failed to start trace lifecycle profiling, sentry client was never attached to the profiler.',\n );\n return;\n }\n\n let activeSpanCounter = 0;\n this._client.on('spanStart', _span => {\n if (activeSpanCounter === 0) {\n this._startChunkProfiling();\n }\n activeSpanCounter++;\n });\n\n this._client.on('spanEnd', _span => {\n if (activeSpanCounter === 1) {\n this._stopChunkProfiling();\n }\n activeSpanCounter--;\n });\n }\n\n /**\n * Stop profiler and initializes profiling of the next chunk\n */\n private _restartChunkProfiling(): void {\n if (!this._client) {\n // The client is not attached to the profiler if the user has not enabled continuous profiling.\n // In this case, calling start() and stop() is a noop action.The reason this exists is because\n // it makes the types easier to work with and avoids users having to do null checks.\n DEBUG_BUILD && debug.log('[Profiling] Profiler was never attached to the client.');\n return;\n }\n\n if (this._chunkData) {\n DEBUG_BUILD &&\n debug.log(\n `[Profiling] Chunk with chunk_id ${this._chunkData.id} is still running, current chunk will be stopped a new chunk will be started.`,\n );\n this._stopChunkProfiling();\n }\n\n this._startChunkProfiling();\n }\n\n /**\n * Stops profiling of the current chunks and flushes the profile to Sentry\n */\n private _stopChunkProfiling(): void {\n if (!this._chunkData) {\n DEBUG_BUILD && debug.log('[Profiling] No chunk data found, no-op.');\n return;\n }\n\n if (this._chunkData?.timer) {\n global.clearTimeout(this._chunkData.timer);\n this._chunkData.timer = undefined;\n DEBUG_BUILD && debug.log(`[Profiling] Stopping profiling chunk: ${this._chunkData.id}`);\n }\n\n if (!this._client) {\n DEBUG_BUILD &&\n debug.log('[Profiling] Failed to collect profile, sentry client was never attached to the profiler.');\n this._resetChunkData();\n return;\n }\n\n if (!this._chunkData?.id) {\n DEBUG_BUILD &&\n debug.log(`[Profiling] Failed to collect profile for: ${this._chunkData?.id}, the chunk_id is missing.`);\n this._resetChunkData();\n return;\n }\n\n const profile = CpuProfilerBindings.stopProfiling(this._chunkData.id, ProfileFormat.CHUNK);\n\n if (!profile) {\n DEBUG_BUILD && debug.log(`[Profiling] Failed to collect profile for: ${this._chunkData.id}`);\n this._resetChunkData();\n return;\n }\n\n if (!this._profilerId) {\n DEBUG_BUILD &&\n debug.log('[Profiling] Profile chunk does not contain a valid profiler_id, this is a bug in the SDK');\n this._resetChunkData();\n return;\n }\n if (profile) {\n DEBUG_BUILD && debug.log(`[Profiling] Sending profile chunk ${this._chunkData.id}.`);\n }\n\n DEBUG_BUILD && debug.log(`[Profiling] Profile chunk ${this._chunkData.id} sent to Sentry.`);\n const chunk = createProfilingChunkEvent(\n this._client,\n this._client.getOptions(),\n profile,\n this._client.getSdkMetadata()?.sdk,\n {\n chunk_id: this._chunkData.id,\n trace_id: this._chunkData.startTraceID,\n profiler_id: this._profilerId,\n },\n );\n\n if (!chunk) {\n DEBUG_BUILD && debug.log(`[Profiling] Failed to create profile chunk for: ${this._chunkData.id}`);\n this._resetChunkData();\n return;\n }\n\n this._flush(chunk);\n // Depending on the profile and stack sizes, stopping the profile and converting\n // the format may negatively impact the performance of the application. To avoid\n // blocking for too long, enqueue the next chunk start inside the next macrotask.\n // clear current chunk\n this._resetChunkData();\n }\n\n /**\n * Flushes the profile chunk to Sentry.\n * @param chunk\n */\n private _flush(chunk: ProfileChunk): void {\n if (!this._client) {\n DEBUG_BUILD &&\n debug.log('[Profiling] Failed to collect profile, sentry client was never attached to the profiler.');\n return;\n }\n\n const transport = this._client.getTransport();\n if (!transport) {\n DEBUG_BUILD && debug.log('[Profiling] No transport available to send profile chunk.');\n return;\n }\n\n const dsn = this._client.getDsn();\n const metadata = this._client.getSdkMetadata();\n const tunnel = this._client.getOptions().tunnel;\n\n const envelope = makeProfileChunkEnvelope('node', chunk, metadata?.sdk, tunnel, dsn);\n transport.send(envelope).then(null, reason => {\n DEBUG_BUILD && debug.error('Error while sending profile chunk envelope:', reason);\n });\n }\n\n /**\n * Starts the profiler and registers the flush timer for a given chunk.\n * @param chunk\n */\n private _startChunkProfiling(): void {\n if (this._chunkData) {\n DEBUG_BUILD && debug.log('[Profiling] Chunk is already running, no-op.');\n return;\n }\n\n const traceId = getCurrentScope().getPropagationContext().traceId;\n const chunk = this._initializeChunk(traceId);\n\n CpuProfilerBindings.startProfiling(chunk.id);\n DEBUG_BUILD && debug.log(`[Profiling] starting profiling chunk: ${chunk.id}`);\n\n chunk.timer = global.setTimeout(() => {\n DEBUG_BUILD && debug.log(`[Profiling] Stopping profiling chunk: ${chunk.id}`);\n this._stopChunkProfiling();\n DEBUG_BUILD && debug.log('[Profiling] Starting new profiling chunk.');\n setImmediate(this._restartChunkProfiling.bind(this));\n }, CHUNK_INTERVAL_MS);\n\n // Unref timeout so it doesn't keep the process alive.\n chunk.timer.unref();\n }\n\n /**\n * Attaches profiling information to spans that were started\n * during a profiling session.\n */\n private _setupSpanChunkInstrumentation(): void {\n if (!this._client) {\n DEBUG_BUILD &&\n debug.log('[Profiling] Failed to initialize span profiling, sentry client was never attached to the profiler.');\n return;\n }\n\n this._profilerId = uuid4();\n getGlobalScope().setContext('profile', {\n profiler_id: this._profilerId,\n });\n }\n\n /**\n * Assigns thread_id and thread name context to a profiled event if there is an active profiler session\n */\n private _onBeforeSendThreadContextAssignment(event: Event): void {\n if (!this._client || !this._profilerId) return;\n this._assignThreadIdContext(event);\n }\n\n /**\n * Clear profiling information from global context when a profile is not running.\n */\n private _teardownSpanChunkInstrumentation(): void {\n this._profilerId = undefined;\n const globalScope = getGlobalScope();\n globalScope.setContext('profile', {});\n }\n\n /**\n * Initializes new profile chunk metadata\n */\n private _initializeChunk(traceId: string): ChunkData {\n this._chunkData = {\n id: uuid4(),\n startTraceID: traceId,\n timer: undefined,\n };\n return this._chunkData;\n }\n\n /**\n * Assigns thread_id and thread name context to a profiled event.\n */\n private _assignThreadIdContext(event: Event): void {\n if (!event?.contexts?.profile) {\n return;\n }\n\n if (!event.contexts) {\n return;\n }\n\n // @ts-expect-error the trace fallback value is wrong, though it should never happen\n // and in case it does, we dont want to override whatever was passed initially.\n event.contexts.trace = {\n ...(event.contexts?.trace ?? {}),\n data: {\n ...(event.contexts?.trace?.data ?? {}),\n ['thread.id']: PROFILER_THREAD_ID_STRING,\n ['thread.name']: PROFILER_THREAD_NAME,\n },\n };\n }\n\n /**\n * Resets the current chunk state.\n */\n private _resetChunkData(): void {\n this._chunkData = undefined;\n }\n}\n\n/** Exported only for tests. */\nexport const _nodeProfilingIntegration = ((): ProfilingIntegration<NodeClient> => {\n if (![16, 18, 20, 22, 24, 26].includes(NODE_MAJOR)) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn(\n `[Sentry Profiling] You are using a Node.js version that does not have prebuilt binaries (${NODE_MAJOR}).`,\n 'The @sentry/profiling-node package only has prebuilt support for the following LTS versions of Node.js: 16, 18, 20, 22, 24, 26.',\n 'To use the @sentry/profiling-node package with this version of Node.js, you will need to compile the native addon from source.',\n 'See: https://github.com/getsentry/sentry-javascript/tree/develop/packages/profiling-node#building-the-package-from-source',\n );\n });\n }\n\n return {\n name: 'ProfilingIntegration' as const,\n _profiler: new ContinuousProfiler(),\n setup(client: NodeClient) {\n DEBUG_BUILD && debug.log('[Profiling] Profiling integration setup.');\n this._profiler.initialize(client);\n return;\n },\n };\n}) satisfies IntegrationFn;\n\nexport const nodeProfilingIntegration = defineIntegration(_nodeProfilingIntegration);\n"],"names":["parseSemver","threadId","isMainThread","debug","uuid4","dsnToString","createEnvelope","getDebugImagesForResources","CpuProfilerBindings","ProfileFormat","getCurrentScope","getGlobalScope","consoleSandbox","defineIntegration"],"mappings":";;;;;;AAOO,MAAM,WAAA,IAAc,OAAA,gBAAA,KAAA,WAAA,IAAA,gBAAA,CAAA;;ACLpB,MAAM,YAAA,GAAeA,gBAAA,CAAY,OAAA,CAAQ,QAAA,CAAS,IAAI,CAAA;AACtD,MAAM,aAAa,YAAA,CAAa,KAAA;;ACehC,MAAM,yBAAA,GAA4B,OAAOC,uBAAQ,CAAA;AACjD,MAAM,oBAAA,GAAuBC,8BAAe,MAAA,GAAS,QAAA;AAC5D,MAAM,yBAAA,GAA4B,GAAA;AAOlC,SAAS,sBACP,OAAA,EAC+B;AAC/B,EAAA,OAAO,EAAE,iBAAA,IAAqB,OAAA,CAAA;AAChC;AASO,SAAS,4BACd,OAAA,EAC4B;AAC5B,EAAA,IAAI,CAAC,qBAAA,CAAsB,OAAO,CAAA,EAAG;AACnC,IAAA,OAAO,OAAA;AAAA,EACT;AAEA,EAAA,OAAO;AAAA,IACL,SAAS,OAAA,CAAQ,OAAA;AAAA,IACjB,QAAQ,OAAA,CAAQ,MAAA;AAAA,IAChB,QAAQ,OAAA,CAAQ,MAAA;AAAA,IAChB,eAAA,EAAiB;AAAA,MACf,CAAC,yBAAyB,GAAG;AAAA,QAC3B,IAAA,EAAM;AAAA;AACR;AACF,GACF;AACF;AAOA,SAAS,yBAAA,CACP,QACA,UAA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oB;AACxB,MAAA,WAAA,IAAeT,UAAA,CAAM,IAAI,0CAA0C,CAAA;AACnE,MAAA,IAAA,CAAK,SAAA,CAAU,WAAW,MAAM,CAAA;AAChC,MAAA;AAAA,IACF;AAAA,GACF;AACF,CAAA,CAAA;AAEO,MAAM,wBAAA,GAA2BU,uBAAkB,yBAAyB;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/debug-build.ts","../../src/nodeVersion.ts","../../src/utils.ts","../../src/integration.ts"],"sourcesContent":["declare const __DEBUG_BUILD__: boolean;\n\n/**\n * This serves as a build time flag that will be true by default, but false in non-debug builds or if users replace `__SENTRY_DEBUG__` in their generated code.\n *\n * ATTENTION: This constant must never cross package boundaries (i.e. be exported) to guarantee that it can be used for tree shaking.\n */\nexport const DEBUG_BUILD = __DEBUG_BUILD__;\n","import { parseSemver } from '@sentry/core';\n\nexport const NODE_VERSION = parseSemver(process.versions.node) as { major: number; minor: number; patch: number };\nexport const NODE_MAJOR = NODE_VERSION.major;\n","import type {\n Client,\n ContinuousThreadCpuProfile,\n DebugImage,\n DsnComponents,\n EventEnvelopeHeaders,\n ProfileChunk,\n ProfileChunkEnvelope,\n ProfileChunkItem,\n SdkInfo,\n} from '@sentry/core';\nimport { createEnvelope, debug, dsnToString, getDebugImagesForResources, uuid4 } from '@sentry/core';\nimport type { RawChunkCpuProfile } from '@sentry/node-cpu-profiler';\nimport { isMainThread, threadId } from 'worker_threads';\nimport { DEBUG_BUILD } from './debug-build';\n\n// We require the file because if we import it, it will be included in the bundle.\n// I guess tsc does not check file contents when it's imported.\nexport const PROFILER_THREAD_ID_STRING = String(threadId);\nexport const PROFILER_THREAD_NAME = isMainThread ? 'main' : 'worker';\nconst CONTINUOUS_FORMAT_VERSION = '2';\n\n/**\n * Checks if the profile is a raw profile or a profile enriched with thread information.\n * @param {ContinuousThreadCpuProfile | RawChunkCpuProfile} profile\n * @returns {boolean}\n */\nfunction isRawThreadCpuProfile(\n profile: ContinuousThreadCpuProfile | RawChunkCpuProfile,\n): profile is RawChunkCpuProfile {\n return !('thread_metadata' in profile);\n}\n\n/**\n * Enriches the profile with threadId of the current thread.\n * This is done in node as we seem to not be able to get the info from C native code.\n *\n * @param {ContinuousThreadCpuProfile | RawChunkCpuProfile} profile\n * @returns {ContinuousThreadCpuProfile}\n */\nexport function enrichWithThreadInformation(\n profile: ContinuousThreadCpuProfile | RawChunkCpuProfile,\n): ContinuousThreadCpuProfile {\n if (!isRawThreadCpuProfile(profile)) {\n return profile;\n }\n\n return {\n samples: profile.samples,\n frames: profile.frames,\n stacks: profile.stacks,\n thread_metadata: {\n [PROFILER_THREAD_ID_STRING]: {\n name: PROFILER_THREAD_NAME,\n },\n },\n };\n}\n\n/**\n * Create a profile chunk from raw thread profile\n * @param {RawChunkCpuProfile} cpuProfile\n * @returns {ProfileChunk}\n */\nfunction createProfileChunkPayload(\n client: Client,\n cpuProfile: RawChunkCpuProfile,\n {\n release,\n environment,\n trace_id,\n profiler_id,\n chunk_id,\n sdk,\n }: {\n release: string;\n environment: string;\n trace_id: string | undefined;\n chunk_id: string;\n profiler_id: string;\n sdk: SdkInfo | undefined;\n },\n): ProfileChunk {\n // Log a warning if the profile has an invalid traceId (should be uuidv4).\n // All profiles and transactions are rejected if this is the case and we want to\n // warn users that this is happening if they enable debug flag\n if (trace_id?.length !== 32) {\n DEBUG_BUILD && debug.log(`[Profiling] Invalid traceId: ${trace_id} on profiled event`);\n }\n\n const enrichedThreadProfile = enrichWithThreadInformation(cpuProfile);\n\n const profile: ProfileChunk = {\n chunk_id: chunk_id,\n client_sdk: {\n name: sdk?.name ?? 'sentry.javascript.node',\n version: sdk?.version ?? '0.0.0',\n },\n profiler_id: profiler_id,\n platform: 'node',\n version: CONTINUOUS_FORMAT_VERSION,\n release: release,\n environment: environment,\n measurements: cpuProfile.measurements,\n debug_meta: {\n images: applyDebugMetadata(client, cpuProfile.resources),\n },\n profile: enrichedThreadProfile,\n };\n\n return profile;\n}\n\n/**\n * Creates a profiling chunk envelope item, if the profile does not pass validation, returns null.\n */\nexport function createProfilingChunkEvent(\n client: Client,\n options: { release?: string; environment?: string },\n profile: RawChunkCpuProfile,\n sdk: SdkInfo | undefined,\n identifiers: { trace_id: string | undefined; chunk_id: string; profiler_id: string },\n): ProfileChunk | null {\n if (!isValidProfileChunk(profile)) {\n return null;\n }\n\n return createProfileChunkPayload(client, profile, {\n release: options.release ?? '',\n environment: options.environment ?? '',\n trace_id: identifiers.trace_id ?? '',\n chunk_id: identifiers.chunk_id,\n profiler_id: identifiers.profiler_id,\n sdk,\n });\n}\n\n/**\n * Checks if the profile chunk is valid and can be sent to Sentry.\n * @param profile\n * @returns\n */\nexport function isValidProfileChunk(profile: RawChunkCpuProfile): profile is RawChunkCpuProfile {\n if (profile.samples.length <= 1) {\n DEBUG_BUILD &&\n // Log a warning if the profile has less than 2 samples so users can know why\n // they are not seeing any profiling data and we cant avoid the back and forth\n // of asking them to provide us with a dump of the profile data.\n debug.log('[Profiling] Discarding profile chunk because it contains less than 2 samples');\n return false;\n }\n\n return true;\n}\n\n/**\n * Creates event envelope headers for a profile chunk. This is separate from createEventEnvelopeHeaders util\n * as the profile chunk does not conform to the sentry event type\n */\nexport function createEventEnvelopeHeaders(\n sdkInfo: SdkInfo | undefined,\n tunnel: string | undefined,\n dsn?: DsnComponents,\n): EventEnvelopeHeaders {\n return {\n event_id: uuid4(),\n sent_at: new Date().toISOString(),\n ...(sdkInfo && { sdk: sdkInfo }),\n ...(!!tunnel && dsn && { dsn: dsnToString(dsn) }),\n };\n}\n\n/**\n * Creates a standalone profile_chunk envelope.\n */\nexport function makeProfileChunkEnvelope(\n platform: 'node',\n chunk: ProfileChunk,\n sdkInfo: SdkInfo | undefined,\n tunnel: string | undefined,\n dsn?: DsnComponents,\n): ProfileChunkEnvelope {\n const profileChunkHeader: ProfileChunkItem[0] = {\n type: 'profile_chunk',\n platform,\n };\n\n return createEnvelope<ProfileChunkEnvelope>(createEventEnvelopeHeaders(sdkInfo, tunnel, dsn), [\n [profileChunkHeader, chunk],\n ]);\n}\n\n/**\n * Cross reference profile collected resources with debug_ids and return a list of debug images.\n * @param {string[]} resource_paths\n * @returns {DebugImage[]}\n */\nexport function applyDebugMetadata(client: Client, resource_paths: ReadonlyArray<string>): DebugImage[] {\n const options = client.getOptions();\n\n if (!options?.stackParser) {\n return [];\n }\n\n return getDebugImagesForResources(options.stackParser, resource_paths);\n}\n","/* eslint-disable max-lines */\nimport type { Event, IntegrationFn, ProfileChunk, ProfilingIntegration } from '@sentry/core';\nimport { consoleSandbox, debug, defineIntegration, getCurrentScope, getGlobalScope, uuid4 } from '@sentry/core';\nimport type { NodeClient } from '@sentry/node';\nimport { CpuProfilerBindings, ProfileFormat } from '@sentry/node-cpu-profiler';\nimport { isMainThread } from 'worker_threads';\nimport { DEBUG_BUILD } from './debug-build';\nimport { NODE_MAJOR } from './nodeVersion';\nimport {\n createProfilingChunkEvent,\n makeProfileChunkEnvelope,\n PROFILER_THREAD_ID_STRING,\n PROFILER_THREAD_NAME,\n} from './utils';\n\nconst CHUNK_INTERVAL_MS = 1000 * 60;\ninterface ChunkData {\n id: string;\n timer: NodeJS.Timeout | undefined;\n startTraceID: string;\n}\n\nclass ContinuousProfiler {\n private _profilerId: string | undefined;\n private _client: NodeClient | undefined = undefined;\n private _chunkData: ChunkData | undefined = undefined;\n private _profileLifecycle: 'manual' | 'trace' | undefined = undefined;\n private _sampled: boolean | undefined = undefined;\n private _sessionSamplingRate: number | undefined = undefined;\n /**\n * Called when the profiler is attached to the client (continuous mode is enabled). If of the profiler\n * methods called before the profiler is initialized will result in a noop action with debug logs.\n * @param client\n */\n public initialize(client: NodeClient): void {\n if (!isMainThread) {\n DEBUG_BUILD &&\n debug.warn(\n '[Profiling] nodeProfilingIntegration() does not support worker threads — profiling will be disabled for this thread.',\n );\n return;\n }\n\n this._client = client;\n const options = client.getOptions();\n\n this._sessionSamplingRate = Math.random();\n this._sampled = this._sessionSamplingRate < (options.profileSessionSampleRate ?? 0);\n this._profileLifecycle = options.profileLifecycle ?? 'manual';\n\n this._setupSpanChunkInstrumentation();\n\n DEBUG_BUILD && debug.log(`[Profiling] Profiling mode is ${this._profileLifecycle}.`);\n\n switch (this._profileLifecycle) {\n case 'trace': {\n this._startTraceLifecycleProfiling();\n break;\n }\n case 'manual': {\n // Manual mode requires manual calls to profiler.startProfiler() and profiler.stopProfiler().\n break;\n }\n default: {\n DEBUG_BUILD &&\n debug.warn(`[Profiling] Unknown profiler mode: ${this._profileLifecycle}, profiler was not initialized`);\n break;\n }\n }\n\n // Attaches a listener to beforeSend which will add the threadId data to the event being sent.\n // This adds a constant overhead to all events being sent which could be improved to only attach\n // and detach the listener during a profiler session\n this._client.on('beforeSendEvent', this._onBeforeSendThreadContextAssignment.bind(this));\n }\n\n /**\n * Initializes a new profilerId session and schedules chunk profiling.\n * @returns void\n */\n public start(): void {\n if (!this._client) {\n DEBUG_BUILD && debug.log('[Profiling] Failed to start, Sentry client was never attached to the profiler.');\n return;\n }\n\n this._startProfiler();\n }\n\n /**\n * Stops the current chunk and flushes the profile to Sentry.\n */\n public stop(): void {\n this._stopProfiler();\n }\n\n private _startProfiler(): void {\n if (this._chunkData !== undefined) {\n DEBUG_BUILD && debug.log('[Profiling] Profile session already running, no-op.');\n return;\n }\n\n if (!this._sampled) {\n DEBUG_BUILD && debug.log('[Profiling] Profile session not sampled, no-op.');\n return;\n }\n\n if (this._profileLifecycle === 'trace') {\n DEBUG_BUILD &&\n debug.log(\n '[Profiling] You are using the trace profile lifecycle, manual calls to profiler.startProfiler() and profiler.stopProfiler() will be ignored.',\n );\n return;\n }\n\n this._startChunkProfiling();\n }\n\n private _stopProfiler(): void {\n if (this._profileLifecycle === 'trace') {\n DEBUG_BUILD &&\n debug.log(\n '[Profiling] You are using the trace profile lifecycle, manual calls to profiler.startProfiler() and profiler.stopProfiler() will be ignored.',\n );\n return;\n }\n\n if (!this._chunkData) {\n DEBUG_BUILD && debug.log('[Profiling] No profile session running, no-op.');\n return;\n }\n\n this._stopChunkProfiling();\n }\n\n /**\n * Starts trace lifecycle profiling. Profiling will remain active as long as there is an active span.\n */\n private _startTraceLifecycleProfiling(): void {\n if (!this._sampled) {\n DEBUG_BUILD &&\n debug.log('[Profiling] Profile session not sampled, trace lifecycle profiling will not be started.');\n return;\n }\n\n if (!this._client) {\n DEBUG_BUILD &&\n debug.log(\n '[Profiling] Failed to start trace lifecycle profiling, sentry client was never attached to the profiler.',\n );\n return;\n }\n\n let activeSpanCounter = 0;\n this._client.on('spanStart', _span => {\n if (activeSpanCounter === 0) {\n this._startChunkProfiling();\n }\n activeSpanCounter++;\n });\n\n this._client.on('spanEnd', _span => {\n if (activeSpanCounter === 1) {\n this._stopChunkProfiling();\n }\n activeSpanCounter--;\n });\n }\n\n /**\n * Stop profiler and initializes profiling of the next chunk\n */\n private _restartChunkProfiling(): void {\n if (!this._client) {\n // The client is not attached to the profiler if the user has not enabled continuous profiling.\n // In this case, calling start() and stop() is a noop action.The reason this exists is because\n // it makes the types easier to work with and avoids users having to do null checks.\n DEBUG_BUILD && debug.log('[Profiling] Profiler was never attached to the client.');\n return;\n }\n\n if (this._chunkData) {\n DEBUG_BUILD &&\n debug.log(\n `[Profiling] Chunk with chunk_id ${this._chunkData.id} is still running, current chunk will be stopped a new chunk will be started.`,\n );\n this._stopChunkProfiling();\n }\n\n this._startChunkProfiling();\n }\n\n /**\n * Stops profiling of the current chunks and flushes the profile to Sentry\n */\n private _stopChunkProfiling(): void {\n if (!this._chunkData) {\n DEBUG_BUILD && debug.log('[Profiling] No chunk data found, no-op.');\n return;\n }\n\n if (this._chunkData?.timer) {\n global.clearTimeout(this._chunkData.timer);\n this._chunkData.timer = undefined;\n DEBUG_BUILD && debug.log(`[Profiling] Stopping profiling chunk: ${this._chunkData.id}`);\n }\n\n if (!this._client) {\n DEBUG_BUILD &&\n debug.log('[Profiling] Failed to collect profile, sentry client was never attached to the profiler.');\n this._resetChunkData();\n return;\n }\n\n if (!this._chunkData?.id) {\n DEBUG_BUILD &&\n debug.log(`[Profiling] Failed to collect profile for: ${this._chunkData?.id}, the chunk_id is missing.`);\n this._resetChunkData();\n return;\n }\n\n const profile = CpuProfilerBindings.stopProfiling(this._chunkData.id, ProfileFormat.CHUNK);\n\n if (!profile) {\n DEBUG_BUILD && debug.log(`[Profiling] Failed to collect profile for: ${this._chunkData.id}`);\n this._resetChunkData();\n return;\n }\n\n if (!this._profilerId) {\n DEBUG_BUILD &&\n debug.log('[Profiling] Profile chunk does not contain a valid profiler_id, this is a bug in the SDK');\n this._resetChunkData();\n return;\n }\n if (profile) {\n DEBUG_BUILD && debug.log(`[Profiling] Sending profile chunk ${this._chunkData.id}.`);\n }\n\n DEBUG_BUILD && debug.log(`[Profiling] Profile chunk ${this._chunkData.id} sent to Sentry.`);\n const chunk = createProfilingChunkEvent(\n this._client,\n this._client.getOptions(),\n profile,\n this._client.getSdkMetadata()?.sdk,\n {\n chunk_id: this._chunkData.id,\n trace_id: this._chunkData.startTraceID,\n profiler_id: this._profilerId,\n },\n );\n\n if (!chunk) {\n DEBUG_BUILD && debug.log(`[Profiling] Failed to create profile chunk for: ${this._chunkData.id}`);\n this._resetChunkData();\n return;\n }\n\n this._flush(chunk);\n // Depending on the profile and stack sizes, stopping the profile and converting\n // the format may negatively impact the performance of the application. To avoid\n // blocking for too long, enqueue the next chunk start inside the next macrotask.\n // clear current chunk\n this._resetChunkData();\n }\n\n /**\n * Flushes the profile chunk to Sentry.\n * @param chunk\n */\n private _flush(chunk: ProfileChunk): void {\n if (!this._client) {\n DEBUG_BUILD &&\n debug.log('[Profiling] Failed to collect profile, sentry client was never attached to the profiler.');\n return;\n }\n\n const dsn = this._client.getDsn();\n const metadata = this._client.getSdkMetadata();\n const tunnel = this._client.getOptions().tunnel;\n\n const envelope = makeProfileChunkEnvelope('node', chunk, metadata?.sdk, tunnel, dsn);\n this._client.sendEnvelope(envelope).then(null, reason => {\n DEBUG_BUILD && debug.error('Error while sending profile chunk envelope:', reason);\n });\n }\n\n /**\n * Starts the profiler and registers the flush timer for a given chunk.\n * @param chunk\n */\n private _startChunkProfiling(): void {\n if (this._chunkData) {\n DEBUG_BUILD && debug.log('[Profiling] Chunk is already running, no-op.');\n return;\n }\n\n const traceId = getCurrentScope().getPropagationContext().traceId;\n const chunk = this._initializeChunk(traceId);\n\n CpuProfilerBindings.startProfiling(chunk.id);\n DEBUG_BUILD && debug.log(`[Profiling] starting profiling chunk: ${chunk.id}`);\n\n chunk.timer = global.setTimeout(() => {\n DEBUG_BUILD && debug.log(`[Profiling] Stopping profiling chunk: ${chunk.id}`);\n this._stopChunkProfiling();\n DEBUG_BUILD && debug.log('[Profiling] Starting new profiling chunk.');\n setImmediate(this._restartChunkProfiling.bind(this));\n }, CHUNK_INTERVAL_MS);\n\n // Unref timeout so it doesn't keep the process alive.\n chunk.timer.unref();\n }\n\n /**\n * Attaches profiling information to spans that were started\n * during a profiling session.\n */\n private _setupSpanChunkInstrumentation(): void {\n if (!this._client) {\n DEBUG_BUILD &&\n debug.log('[Profiling] Failed to initialize span profiling, sentry client was never attached to the profiler.');\n return;\n }\n\n this._profilerId = uuid4();\n getGlobalScope().setContext('profile', {\n profiler_id: this._profilerId,\n });\n }\n\n /**\n * Assigns thread_id and thread name context to a profiled event if there is an active profiler session\n */\n private _onBeforeSendThreadContextAssignment(event: Event): void {\n if (!this._client || !this._profilerId) return;\n this._assignThreadIdContext(event);\n }\n\n /**\n * Clear profiling information from global context when a profile is not running.\n */\n private _teardownSpanChunkInstrumentation(): void {\n this._profilerId = undefined;\n const globalScope = getGlobalScope();\n globalScope.setContext('profile', {});\n }\n\n /**\n * Initializes new profile chunk metadata\n */\n private _initializeChunk(traceId: string): ChunkData {\n this._chunkData = {\n id: uuid4(),\n startTraceID: traceId,\n timer: undefined,\n };\n return this._chunkData;\n }\n\n /**\n * Assigns thread_id and thread name context to a profiled event.\n */\n private _assignThreadIdContext(event: Event): void {\n if (!event?.contexts?.profile) {\n return;\n }\n\n if (!event.contexts) {\n return;\n }\n\n // @ts-expect-error the trace fallback value is wrong, though it should never happen\n // and in case it does, we dont want to override whatever was passed initially.\n event.contexts.trace = {\n ...(event.contexts?.trace ?? {}),\n data: {\n ...(event.contexts?.trace?.data ?? {}),\n ['thread.id']: PROFILER_THREAD_ID_STRING,\n ['thread.name']: PROFILER_THREAD_NAME,\n },\n };\n }\n\n /**\n * Resets the current chunk state.\n */\n private _resetChunkData(): void {\n this._chunkData = undefined;\n }\n}\n\n/** Exported only for tests. */\nexport const _nodeProfilingIntegration = ((): ProfilingIntegration<NodeClient> => {\n if (![16, 18, 20, 22, 24, 26].includes(NODE_MAJOR)) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn(\n `[Sentry Profiling] You are using a Node.js version that does not have prebuilt binaries (${NODE_MAJOR}).`,\n 'The @sentry/profiling-node package only has prebuilt support for the following LTS versions of Node.js: 16, 18, 20, 22, 24, 26.',\n 'To use the @sentry/profiling-node package with this version of Node.js, you will need to compile the native addon from source.',\n 'See: https://github.com/getsentry/sentry-javascript/tree/develop/packages/profiling-node#building-the-package-from-source',\n );\n });\n }\n\n return {\n name: 'ProfilingIntegration' as const,\n _profiler: new ContinuousProfiler(),\n setup(client: NodeClient) {\n DEBUG_BUILD && debug.log('[Profiling] Profiling integration setup.');\n this._profiler.initialize(client);\n return;\n },\n };\n}) satisfies IntegrationFn;\n\nexport const nodeProfilingIntegration = defineIntegration(_nodeProfilingIntegration);\n"],"names":["parseSemver","threadId","isMainThread","debug","uuid4","dsnToString","createEnvelope","getDebugImagesForResources","CpuProfilerBindings","ProfileFormat","getCurrentScope","getGlobalScope","consoleSandbox","defineIntegration"],"mappings":";;;;;;AAOO,MAAM,WAAA,IAAc,OAAA,gBAAA,KAAA,WAAA,IAAA,gBAAA,CAAA;;ACLpB,MAAM,YAAA,GAAeA,gBAAA,CAAY,OAAA,CAAQ,QAAA,CAAS,IAAI,CAAA;AACtD,MAAM,aAAa,YAAA,CAAa,KAAA;;ACehC,MAAM,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AAA,EAAI,EAAA,EAAI,EAAA,EAAI,EAAA,EAAI,EAAA,EAAI,EAAE,CAAA,CAAE,QAAA,CAAS,UAAU,CAAA,EAAG;AAClD,IAAAQ,mBAAA,CAAe,MAAM;AAEnB,MAAA,OAAA,CAAQ,IAAA;AAAA,QACN,4FAA4F,UAAU,CAAA,EAAA,CAAA;AAAA,QACtG,iIAAA;AAAA,QACA,gIAAA;AAAA,QACA;AAAA,OACF;AAAA,IACF,CAAC,CAAA;AAAA,EACH;AAEA,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,sBAAA;AAAA,IACN,SAAA,EAAW,IAAI,kBAAA,EAAmB;AAAA,IAClC,MAAM,MAAA,EAAoB;AACxB,MAAA,WAAA,IAAeT,UAAA,CAAM,IAAI,0CAA0C,CAAA;AACnE,MAAA,IAAA,CAAK,SAAA,CAAU,WAAW,MAAM,CAAA;AAChC,MAAA;AAAA,IACF;AAAA,GACF;AACF,CAAA,CAAA;AAEO,MAAM,wBAAA,GAA2BU,uBAAkB,yBAAyB;;;;"}
|
package/build/esm/index.js
CHANGED
|
@@ -307,16 +307,11 @@ class ContinuousProfiler {
|
|
|
307
307
|
DEBUG_BUILD && debug.log("[Profiling] Failed to collect profile, sentry client was never attached to the profiler.");
|
|
308
308
|
return;
|
|
309
309
|
}
|
|
310
|
-
const transport = this._client.getTransport();
|
|
311
|
-
if (!transport) {
|
|
312
|
-
DEBUG_BUILD && debug.log("[Profiling] No transport available to send profile chunk.");
|
|
313
|
-
return;
|
|
314
|
-
}
|
|
315
310
|
const dsn = this._client.getDsn();
|
|
316
311
|
const metadata = this._client.getSdkMetadata();
|
|
317
312
|
const tunnel = this._client.getOptions().tunnel;
|
|
318
313
|
const envelope = makeProfileChunkEnvelope("node", chunk, metadata?.sdk, tunnel, dsn);
|
|
319
|
-
|
|
314
|
+
this._client.sendEnvelope(envelope).then(null, (reason) => {
|
|
320
315
|
DEBUG_BUILD && debug.error("Error while sending profile chunk envelope:", reason);
|
|
321
316
|
});
|
|
322
317
|
}
|
package/build/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/debug-build.ts","../../src/nodeVersion.ts","../../src/utils.ts","../../src/integration.ts"],"sourcesContent":["declare const __DEBUG_BUILD__: boolean;\n\n/**\n * This serves as a build time flag that will be true by default, but false in non-debug builds or if users replace `__SENTRY_DEBUG__` in their generated code.\n *\n * ATTENTION: This constant must never cross package boundaries (i.e. be exported) to guarantee that it can be used for tree shaking.\n */\nexport const DEBUG_BUILD = __DEBUG_BUILD__;\n","import { parseSemver } from '@sentry/core';\n\nexport const NODE_VERSION = parseSemver(process.versions.node) as { major: number; minor: number; patch: number };\nexport const NODE_MAJOR = NODE_VERSION.major;\n","import type {\n Client,\n ContinuousThreadCpuProfile,\n DebugImage,\n DsnComponents,\n EventEnvelopeHeaders,\n ProfileChunk,\n ProfileChunkEnvelope,\n ProfileChunkItem,\n SdkInfo,\n} from '@sentry/core';\nimport { createEnvelope, debug, dsnToString, getDebugImagesForResources, uuid4 } from '@sentry/core';\nimport type { RawChunkCpuProfile } from '@sentry/node-cpu-profiler';\nimport { isMainThread, threadId } from 'worker_threads';\nimport { DEBUG_BUILD } from './debug-build';\n\n// We require the file because if we import it, it will be included in the bundle.\n// I guess tsc does not check file contents when it's imported.\nexport const PROFILER_THREAD_ID_STRING = String(threadId);\nexport const PROFILER_THREAD_NAME = isMainThread ? 'main' : 'worker';\nconst CONTINUOUS_FORMAT_VERSION = '2';\n\n/**\n * Checks if the profile is a raw profile or a profile enriched with thread information.\n * @param {ContinuousThreadCpuProfile | RawChunkCpuProfile} profile\n * @returns {boolean}\n */\nfunction isRawThreadCpuProfile(\n profile: ContinuousThreadCpuProfile | RawChunkCpuProfile,\n): profile is RawChunkCpuProfile {\n return !('thread_metadata' in profile);\n}\n\n/**\n * Enriches the profile with threadId of the current thread.\n * This is done in node as we seem to not be able to get the info from C native code.\n *\n * @param {ContinuousThreadCpuProfile | RawChunkCpuProfile} profile\n * @returns {ContinuousThreadCpuProfile}\n */\nexport function enrichWithThreadInformation(\n profile: ContinuousThreadCpuProfile | RawChunkCpuProfile,\n): ContinuousThreadCpuProfile {\n if (!isRawThreadCpuProfile(profile)) {\n return profile;\n }\n\n return {\n samples: profile.samples,\n frames: profile.frames,\n stacks: profile.stacks,\n thread_metadata: {\n [PROFILER_THREAD_ID_STRING]: {\n name: PROFILER_THREAD_NAME,\n },\n },\n };\n}\n\n/**\n * Create a profile chunk from raw thread profile\n * @param {RawChunkCpuProfile} cpuProfile\n * @returns {ProfileChunk}\n */\nfunction createProfileChunkPayload(\n client: Client,\n cpuProfile: RawChunkCpuProfile,\n {\n release,\n environment,\n trace_id,\n profiler_id,\n chunk_id,\n sdk,\n }: {\n release: string;\n environment: string;\n trace_id: string | undefined;\n chunk_id: string;\n profiler_id: string;\n sdk: SdkInfo | undefined;\n },\n): ProfileChunk {\n // Log a warning if the profile has an invalid traceId (should be uuidv4).\n // All profiles and transactions are rejected if this is the case and we want to\n // warn users that this is happening if they enable debug flag\n if (trace_id?.length !== 32) {\n DEBUG_BUILD && debug.log(`[Profiling] Invalid traceId: ${trace_id} on profiled event`);\n }\n\n const enrichedThreadProfile = enrichWithThreadInformation(cpuProfile);\n\n const profile: ProfileChunk = {\n chunk_id: chunk_id,\n client_sdk: {\n name: sdk?.name ?? 'sentry.javascript.node',\n version: sdk?.version ?? '0.0.0',\n },\n profiler_id: profiler_id,\n platform: 'node',\n version: CONTINUOUS_FORMAT_VERSION,\n release: release,\n environment: environment,\n measurements: cpuProfile.measurements,\n debug_meta: {\n images: applyDebugMetadata(client, cpuProfile.resources),\n },\n profile: enrichedThreadProfile,\n };\n\n return profile;\n}\n\n/**\n * Creates a profiling chunk envelope item, if the profile does not pass validation, returns null.\n */\nexport function createProfilingChunkEvent(\n client: Client,\n options: { release?: string; environment?: string },\n profile: RawChunkCpuProfile,\n sdk: SdkInfo | undefined,\n identifiers: { trace_id: string | undefined; chunk_id: string; profiler_id: string },\n): ProfileChunk | null {\n if (!isValidProfileChunk(profile)) {\n return null;\n }\n\n return createProfileChunkPayload(client, profile, {\n release: options.release ?? '',\n environment: options.environment ?? '',\n trace_id: identifiers.trace_id ?? '',\n chunk_id: identifiers.chunk_id,\n profiler_id: identifiers.profiler_id,\n sdk,\n });\n}\n\n/**\n * Checks if the profile chunk is valid and can be sent to Sentry.\n * @param profile\n * @returns\n */\nexport function isValidProfileChunk(profile: RawChunkCpuProfile): profile is RawChunkCpuProfile {\n if (profile.samples.length <= 1) {\n DEBUG_BUILD &&\n // Log a warning if the profile has less than 2 samples so users can know why\n // they are not seeing any profiling data and we cant avoid the back and forth\n // of asking them to provide us with a dump of the profile data.\n debug.log('[Profiling] Discarding profile chunk because it contains less than 2 samples');\n return false;\n }\n\n return true;\n}\n\n/**\n * Creates event envelope headers for a profile chunk. This is separate from createEventEnvelopeHeaders util\n * as the profile chunk does not conform to the sentry event type\n */\nexport function createEventEnvelopeHeaders(\n sdkInfo: SdkInfo | undefined,\n tunnel: string | undefined,\n dsn?: DsnComponents,\n): EventEnvelopeHeaders {\n return {\n event_id: uuid4(),\n sent_at: new Date().toISOString(),\n ...(sdkInfo && { sdk: sdkInfo }),\n ...(!!tunnel && dsn && { dsn: dsnToString(dsn) }),\n };\n}\n\n/**\n * Creates a standalone profile_chunk envelope.\n */\nexport function makeProfileChunkEnvelope(\n platform: 'node',\n chunk: ProfileChunk,\n sdkInfo: SdkInfo | undefined,\n tunnel: string | undefined,\n dsn?: DsnComponents,\n): ProfileChunkEnvelope {\n const profileChunkHeader: ProfileChunkItem[0] = {\n type: 'profile_chunk',\n platform,\n };\n\n return createEnvelope<ProfileChunkEnvelope>(createEventEnvelopeHeaders(sdkInfo, tunnel, dsn), [\n [profileChunkHeader, chunk],\n ]);\n}\n\n/**\n * Cross reference profile collected resources with debug_ids and return a list of debug images.\n * @param {string[]} resource_paths\n * @returns {DebugImage[]}\n */\nexport function applyDebugMetadata(client: Client, resource_paths: ReadonlyArray<string>): DebugImage[] {\n const options = client.getOptions();\n\n if (!options?.stackParser) {\n return [];\n }\n\n return getDebugImagesForResources(options.stackParser, resource_paths);\n}\n","/* eslint-disable max-lines */\nimport type { Event, IntegrationFn, ProfileChunk, ProfilingIntegration } from '@sentry/core';\nimport { consoleSandbox, debug, defineIntegration, getCurrentScope, getGlobalScope, uuid4 } from '@sentry/core';\nimport type { NodeClient } from '@sentry/node';\nimport { CpuProfilerBindings, ProfileFormat } from '@sentry/node-cpu-profiler';\nimport { isMainThread } from 'worker_threads';\nimport { DEBUG_BUILD } from './debug-build';\nimport { NODE_MAJOR } from './nodeVersion';\nimport {\n createProfilingChunkEvent,\n makeProfileChunkEnvelope,\n PROFILER_THREAD_ID_STRING,\n PROFILER_THREAD_NAME,\n} from './utils';\n\nconst CHUNK_INTERVAL_MS = 1000 * 60;\ninterface ChunkData {\n id: string;\n timer: NodeJS.Timeout | undefined;\n startTraceID: string;\n}\n\nclass ContinuousProfiler {\n private _profilerId: string | undefined;\n private _client: NodeClient | undefined = undefined;\n private _chunkData: ChunkData | undefined = undefined;\n private _profileLifecycle: 'manual' | 'trace' | undefined = undefined;\n private _sampled: boolean | undefined = undefined;\n private _sessionSamplingRate: number | undefined = undefined;\n /**\n * Called when the profiler is attached to the client (continuous mode is enabled). If of the profiler\n * methods called before the profiler is initialized will result in a noop action with debug logs.\n * @param client\n */\n public initialize(client: NodeClient): void {\n if (!isMainThread) {\n DEBUG_BUILD &&\n debug.warn(\n '[Profiling] nodeProfilingIntegration() does not support worker threads — profiling will be disabled for this thread.',\n );\n return;\n }\n\n this._client = client;\n const options = client.getOptions();\n\n this._sessionSamplingRate = Math.random();\n this._sampled = this._sessionSamplingRate < (options.profileSessionSampleRate ?? 0);\n this._profileLifecycle = options.profileLifecycle ?? 'manual';\n\n this._setupSpanChunkInstrumentation();\n\n DEBUG_BUILD && debug.log(`[Profiling] Profiling mode is ${this._profileLifecycle}.`);\n\n switch (this._profileLifecycle) {\n case 'trace': {\n this._startTraceLifecycleProfiling();\n break;\n }\n case 'manual': {\n // Manual mode requires manual calls to profiler.startProfiler() and profiler.stopProfiler().\n break;\n }\n default: {\n DEBUG_BUILD &&\n debug.warn(`[Profiling] Unknown profiler mode: ${this._profileLifecycle}, profiler was not initialized`);\n break;\n }\n }\n\n // Attaches a listener to beforeSend which will add the threadId data to the event being sent.\n // This adds a constant overhead to all events being sent which could be improved to only attach\n // and detach the listener during a profiler session\n this._client.on('beforeSendEvent', this._onBeforeSendThreadContextAssignment.bind(this));\n }\n\n /**\n * Initializes a new profilerId session and schedules chunk profiling.\n * @returns void\n */\n public start(): void {\n if (!this._client) {\n DEBUG_BUILD && debug.log('[Profiling] Failed to start, Sentry client was never attached to the profiler.');\n return;\n }\n\n this._startProfiler();\n }\n\n /**\n * Stops the current chunk and flushes the profile to Sentry.\n */\n public stop(): void {\n this._stopProfiler();\n }\n\n private _startProfiler(): void {\n if (this._chunkData !== undefined) {\n DEBUG_BUILD && debug.log('[Profiling] Profile session already running, no-op.');\n return;\n }\n\n if (!this._sampled) {\n DEBUG_BUILD && debug.log('[Profiling] Profile session not sampled, no-op.');\n return;\n }\n\n if (this._profileLifecycle === 'trace') {\n DEBUG_BUILD &&\n debug.log(\n '[Profiling] You are using the trace profile lifecycle, manual calls to profiler.startProfiler() and profiler.stopProfiler() will be ignored.',\n );\n return;\n }\n\n this._startChunkProfiling();\n }\n\n private _stopProfiler(): void {\n if (this._profileLifecycle === 'trace') {\n DEBUG_BUILD &&\n debug.log(\n '[Profiling] You are using the trace profile lifecycle, manual calls to profiler.startProfiler() and profiler.stopProfiler() will be ignored.',\n );\n return;\n }\n\n if (!this._chunkData) {\n DEBUG_BUILD && debug.log('[Profiling] No profile session running, no-op.');\n return;\n }\n\n this._stopChunkProfiling();\n }\n\n /**\n * Starts trace lifecycle profiling. Profiling will remain active as long as there is an active span.\n */\n private _startTraceLifecycleProfiling(): void {\n if (!this._sampled) {\n DEBUG_BUILD &&\n debug.log('[Profiling] Profile session not sampled, trace lifecycle profiling will not be started.');\n return;\n }\n\n if (!this._client) {\n DEBUG_BUILD &&\n debug.log(\n '[Profiling] Failed to start trace lifecycle profiling, sentry client was never attached to the profiler.',\n );\n return;\n }\n\n let activeSpanCounter = 0;\n this._client.on('spanStart', _span => {\n if (activeSpanCounter === 0) {\n this._startChunkProfiling();\n }\n activeSpanCounter++;\n });\n\n this._client.on('spanEnd', _span => {\n if (activeSpanCounter === 1) {\n this._stopChunkProfiling();\n }\n activeSpanCounter--;\n });\n }\n\n /**\n * Stop profiler and initializes profiling of the next chunk\n */\n private _restartChunkProfiling(): void {\n if (!this._client) {\n // The client is not attached to the profiler if the user has not enabled continuous profiling.\n // In this case, calling start() and stop() is a noop action.The reason this exists is because\n // it makes the types easier to work with and avoids users having to do null checks.\n DEBUG_BUILD && debug.log('[Profiling] Profiler was never attached to the client.');\n return;\n }\n\n if (this._chunkData) {\n DEBUG_BUILD &&\n debug.log(\n `[Profiling] Chunk with chunk_id ${this._chunkData.id} is still running, current chunk will be stopped a new chunk will be started.`,\n );\n this._stopChunkProfiling();\n }\n\n this._startChunkProfiling();\n }\n\n /**\n * Stops profiling of the current chunks and flushes the profile to Sentry\n */\n private _stopChunkProfiling(): void {\n if (!this._chunkData) {\n DEBUG_BUILD && debug.log('[Profiling] No chunk data found, no-op.');\n return;\n }\n\n if (this._chunkData?.timer) {\n global.clearTimeout(this._chunkData.timer);\n this._chunkData.timer = undefined;\n DEBUG_BUILD && debug.log(`[Profiling] Stopping profiling chunk: ${this._chunkData.id}`);\n }\n\n if (!this._client) {\n DEBUG_BUILD &&\n debug.log('[Profiling] Failed to collect profile, sentry client was never attached to the profiler.');\n this._resetChunkData();\n return;\n }\n\n if (!this._chunkData?.id) {\n DEBUG_BUILD &&\n debug.log(`[Profiling] Failed to collect profile for: ${this._chunkData?.id}, the chunk_id is missing.`);\n this._resetChunkData();\n return;\n }\n\n const profile = CpuProfilerBindings.stopProfiling(this._chunkData.id, ProfileFormat.CHUNK);\n\n if (!profile) {\n DEBUG_BUILD && debug.log(`[Profiling] Failed to collect profile for: ${this._chunkData.id}`);\n this._resetChunkData();\n return;\n }\n\n if (!this._profilerId) {\n DEBUG_BUILD &&\n debug.log('[Profiling] Profile chunk does not contain a valid profiler_id, this is a bug in the SDK');\n this._resetChunkData();\n return;\n }\n if (profile) {\n DEBUG_BUILD && debug.log(`[Profiling] Sending profile chunk ${this._chunkData.id}.`);\n }\n\n DEBUG_BUILD && debug.log(`[Profiling] Profile chunk ${this._chunkData.id} sent to Sentry.`);\n const chunk = createProfilingChunkEvent(\n this._client,\n this._client.getOptions(),\n profile,\n this._client.getSdkMetadata()?.sdk,\n {\n chunk_id: this._chunkData.id,\n trace_id: this._chunkData.startTraceID,\n profiler_id: this._profilerId,\n },\n );\n\n if (!chunk) {\n DEBUG_BUILD && debug.log(`[Profiling] Failed to create profile chunk for: ${this._chunkData.id}`);\n this._resetChunkData();\n return;\n }\n\n this._flush(chunk);\n // Depending on the profile and stack sizes, stopping the profile and converting\n // the format may negatively impact the performance of the application. To avoid\n // blocking for too long, enqueue the next chunk start inside the next macrotask.\n // clear current chunk\n this._resetChunkData();\n }\n\n /**\n * Flushes the profile chunk to Sentry.\n * @param chunk\n */\n private _flush(chunk: ProfileChunk): void {\n if (!this._client) {\n DEBUG_BUILD &&\n debug.log('[Profiling] Failed to collect profile, sentry client was never attached to the profiler.');\n return;\n }\n\n const transport = this._client.getTransport();\n if (!transport) {\n DEBUG_BUILD && debug.log('[Profiling] No transport available to send profile chunk.');\n return;\n }\n\n const dsn = this._client.getDsn();\n const metadata = this._client.getSdkMetadata();\n const tunnel = this._client.getOptions().tunnel;\n\n const envelope = makeProfileChunkEnvelope('node', chunk, metadata?.sdk, tunnel, dsn);\n transport.send(envelope).then(null, reason => {\n DEBUG_BUILD && debug.error('Error while sending profile chunk envelope:', reason);\n });\n }\n\n /**\n * Starts the profiler and registers the flush timer for a given chunk.\n * @param chunk\n */\n private _startChunkProfiling(): void {\n if (this._chunkData) {\n DEBUG_BUILD && debug.log('[Profiling] Chunk is already running, no-op.');\n return;\n }\n\n const traceId = getCurrentScope().getPropagationContext().traceId;\n const chunk = this._initializeChunk(traceId);\n\n CpuProfilerBindings.startProfiling(chunk.id);\n DEBUG_BUILD && debug.log(`[Profiling] starting profiling chunk: ${chunk.id}`);\n\n chunk.timer = global.setTimeout(() => {\n DEBUG_BUILD && debug.log(`[Profiling] Stopping profiling chunk: ${chunk.id}`);\n this._stopChunkProfiling();\n DEBUG_BUILD && debug.log('[Profiling] Starting new profiling chunk.');\n setImmediate(this._restartChunkProfiling.bind(this));\n }, CHUNK_INTERVAL_MS);\n\n // Unref timeout so it doesn't keep the process alive.\n chunk.timer.unref();\n }\n\n /**\n * Attaches profiling information to spans that were started\n * during a profiling session.\n */\n private _setupSpanChunkInstrumentation(): void {\n if (!this._client) {\n DEBUG_BUILD &&\n debug.log('[Profiling] Failed to initialize span profiling, sentry client was never attached to the profiler.');\n return;\n }\n\n this._profilerId = uuid4();\n getGlobalScope().setContext('profile', {\n profiler_id: this._profilerId,\n });\n }\n\n /**\n * Assigns thread_id and thread name context to a profiled event if there is an active profiler session\n */\n private _onBeforeSendThreadContextAssignment(event: Event): void {\n if (!this._client || !this._profilerId) return;\n this._assignThreadIdContext(event);\n }\n\n /**\n * Clear profiling information from global context when a profile is not running.\n */\n private _teardownSpanChunkInstrumentation(): void {\n this._profilerId = undefined;\n const globalScope = getGlobalScope();\n globalScope.setContext('profile', {});\n }\n\n /**\n * Initializes new profile chunk metadata\n */\n private _initializeChunk(traceId: string): ChunkData {\n this._chunkData = {\n id: uuid4(),\n startTraceID: traceId,\n timer: undefined,\n };\n return this._chunkData;\n }\n\n /**\n * Assigns thread_id and thread name context to a profiled event.\n */\n private _assignThreadIdContext(event: Event): void {\n if (!event?.contexts?.profile) {\n return;\n }\n\n if (!event.contexts) {\n return;\n }\n\n // @ts-expect-error the trace fallback value is wrong, though it should never happen\n // and in case it does, we dont want to override whatever was passed initially.\n event.contexts.trace = {\n ...(event.contexts?.trace ?? {}),\n data: {\n ...(event.contexts?.trace?.data ?? {}),\n ['thread.id']: PROFILER_THREAD_ID_STRING,\n ['thread.name']: PROFILER_THREAD_NAME,\n },\n };\n }\n\n /**\n * Resets the current chunk state.\n */\n private _resetChunkData(): void {\n this._chunkData = undefined;\n }\n}\n\n/** Exported only for tests. */\nexport const _nodeProfilingIntegration = ((): ProfilingIntegration<NodeClient> => {\n if (![16, 18, 20, 22, 24, 26].includes(NODE_MAJOR)) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn(\n `[Sentry Profiling] You are using a Node.js version that does not have prebuilt binaries (${NODE_MAJOR}).`,\n 'The @sentry/profiling-node package only has prebuilt support for the following LTS versions of Node.js: 16, 18, 20, 22, 24, 26.',\n 'To use the @sentry/profiling-node package with this version of Node.js, you will need to compile the native addon from source.',\n 'See: https://github.com/getsentry/sentry-javascript/tree/develop/packages/profiling-node#building-the-package-from-source',\n );\n });\n }\n\n return {\n name: 'ProfilingIntegration' as const,\n _profiler: new ContinuousProfiler(),\n setup(client: NodeClient) {\n DEBUG_BUILD && debug.log('[Profiling] Profiling integration setup.');\n this._profiler.initialize(client);\n return;\n },\n };\n}) satisfies IntegrationFn;\n\nexport const nodeProfilingIntegration = defineIntegration(_nodeProfilingIntegration);\n"],"names":[],"mappings":";;;;AAOO,MAAM,WAAA,IAAc,OAAA,gBAAA,KAAA,WAAA,IAAA,gBAAA,CAAA;;ACLpB,MAAM,YAAA,GAAe,WAAA,CAAY,OAAA,CAAQ,QAAA,CAAS,IAAI,CAAA;AACtD,MAAM,aAAa,YAAA,CAAa,KAAA;;ACehC,MAAM,yBAAA,GAA4B,OAAO,QAAQ,CAAA;AACjD,MAAM,oBAAA,GAAuB,eAAe,MAAA,GAAS,QAAA;AAC5D,MAAM,yBAAA,GAA4B,GAAA;AAOlC,SAAS,sBACP,OAAA,EAC+B;AAC/B,EAAA,OAAO,EAAE,iBAAA,IAAqB,OAAA,CAAA;A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AU,CAAA,EAAG;AAClD,IAAA,cAAA,CAAe,MAAM;AAEnB,MAAA,OAAA,CAAQ,IAAA;AAAA,QACN,4FAA4F,UAAU,CAAA,EAAA,CAAA;AAAA,QACtG,iIAAA;AAAA,QACA,gIAAA;AAAA,QACA;AAAA,OACF;AAAA,IACF,CAAC,CAAA;AAAA,EACH;AAEA,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,sBAAA;AAAA,IACN,SAAA,EAAW,IAAI,kBAAA,EAAmB;AAAA,IAClC,MAAM,MAAA,EAAoB;AACxB,MAAA,WAAA,IAAe,KAAA,CAAM,IAAI,0CAA0C,CAAA;AACnE,MAAA,IAAA,CAAK,SAAA,CAAU,WAAW,MAAM,CAAA;AAChC,MAAA;AAAA,IACF;AAAA,GACF;AACF,CAAA,CAAA;AAEO,MAAM,wBAAA,GAA2B,kBAAkB,yBAAyB;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/debug-build.ts","../../src/nodeVersion.ts","../../src/utils.ts","../../src/integration.ts"],"sourcesContent":["declare const __DEBUG_BUILD__: boolean;\n\n/**\n * This serves as a build time flag that will be true by default, but false in non-debug builds or if users replace `__SENTRY_DEBUG__` in their generated code.\n *\n * ATTENTION: This constant must never cross package boundaries (i.e. be exported) to guarantee that it can be used for tree shaking.\n */\nexport const DEBUG_BUILD = __DEBUG_BUILD__;\n","import { parseSemver } from '@sentry/core';\n\nexport const NODE_VERSION = parseSemver(process.versions.node) as { major: number; minor: number; patch: number };\nexport const NODE_MAJOR = NODE_VERSION.major;\n","import type {\n Client,\n ContinuousThreadCpuProfile,\n DebugImage,\n DsnComponents,\n EventEnvelopeHeaders,\n ProfileChunk,\n ProfileChunkEnvelope,\n ProfileChunkItem,\n SdkInfo,\n} from '@sentry/core';\nimport { createEnvelope, debug, dsnToString, getDebugImagesForResources, uuid4 } from '@sentry/core';\nimport type { RawChunkCpuProfile } from '@sentry/node-cpu-profiler';\nimport { isMainThread, threadId } from 'worker_threads';\nimport { DEBUG_BUILD } from './debug-build';\n\n// We require the file because if we import it, it will be included in the bundle.\n// I guess tsc does not check file contents when it's imported.\nexport const PROFILER_THREAD_ID_STRING = String(threadId);\nexport const PROFILER_THREAD_NAME = isMainThread ? 'main' : 'worker';\nconst CONTINUOUS_FORMAT_VERSION = '2';\n\n/**\n * Checks if the profile is a raw profile or a profile enriched with thread information.\n * @param {ContinuousThreadCpuProfile | RawChunkCpuProfile} profile\n * @returns {boolean}\n */\nfunction isRawThreadCpuProfile(\n profile: ContinuousThreadCpuProfile | RawChunkCpuProfile,\n): profile is RawChunkCpuProfile {\n return !('thread_metadata' in profile);\n}\n\n/**\n * Enriches the profile with threadId of the current thread.\n * This is done in node as we seem to not be able to get the info from C native code.\n *\n * @param {ContinuousThreadCpuProfile | RawChunkCpuProfile} profile\n * @returns {ContinuousThreadCpuProfile}\n */\nexport function enrichWithThreadInformation(\n profile: ContinuousThreadCpuProfile | RawChunkCpuProfile,\n): ContinuousThreadCpuProfile {\n if (!isRawThreadCpuProfile(profile)) {\n return profile;\n }\n\n return {\n samples: profile.samples,\n frames: profile.frames,\n stacks: profile.stacks,\n thread_metadata: {\n [PROFILER_THREAD_ID_STRING]: {\n name: PROFILER_THREAD_NAME,\n },\n },\n };\n}\n\n/**\n * Create a profile chunk from raw thread profile\n * @param {RawChunkCpuProfile} cpuProfile\n * @returns {ProfileChunk}\n */\nfunction createProfileChunkPayload(\n client: Client,\n cpuProfile: RawChunkCpuProfile,\n {\n release,\n environment,\n trace_id,\n profiler_id,\n chunk_id,\n sdk,\n }: {\n release: string;\n environment: string;\n trace_id: string | undefined;\n chunk_id: string;\n profiler_id: string;\n sdk: SdkInfo | undefined;\n },\n): ProfileChunk {\n // Log a warning if the profile has an invalid traceId (should be uuidv4).\n // All profiles and transactions are rejected if this is the case and we want to\n // warn users that this is happening if they enable debug flag\n if (trace_id?.length !== 32) {\n DEBUG_BUILD && debug.log(`[Profiling] Invalid traceId: ${trace_id} on profiled event`);\n }\n\n const enrichedThreadProfile = enrichWithThreadInformation(cpuProfile);\n\n const profile: ProfileChunk = {\n chunk_id: chunk_id,\n client_sdk: {\n name: sdk?.name ?? 'sentry.javascript.node',\n version: sdk?.version ?? '0.0.0',\n },\n profiler_id: profiler_id,\n platform: 'node',\n version: CONTINUOUS_FORMAT_VERSION,\n release: release,\n environment: environment,\n measurements: cpuProfile.measurements,\n debug_meta: {\n images: applyDebugMetadata(client, cpuProfile.resources),\n },\n profile: enrichedThreadProfile,\n };\n\n return profile;\n}\n\n/**\n * Creates a profiling chunk envelope item, if the profile does not pass validation, returns null.\n */\nexport function createProfilingChunkEvent(\n client: Client,\n options: { release?: string; environment?: string },\n profile: RawChunkCpuProfile,\n sdk: SdkInfo | undefined,\n identifiers: { trace_id: string | undefined; chunk_id: string; profiler_id: string },\n): ProfileChunk | null {\n if (!isValidProfileChunk(profile)) {\n return null;\n }\n\n return createProfileChunkPayload(client, profile, {\n release: options.release ?? '',\n environment: options.environment ?? '',\n trace_id: identifiers.trace_id ?? '',\n chunk_id: identifiers.chunk_id,\n profiler_id: identifiers.profiler_id,\n sdk,\n });\n}\n\n/**\n * Checks if the profile chunk is valid and can be sent to Sentry.\n * @param profile\n * @returns\n */\nexport function isValidProfileChunk(profile: RawChunkCpuProfile): profile is RawChunkCpuProfile {\n if (profile.samples.length <= 1) {\n DEBUG_BUILD &&\n // Log a warning if the profile has less than 2 samples so users can know why\n // they are not seeing any profiling data and we cant avoid the back and forth\n // of asking them to provide us with a dump of the profile data.\n debug.log('[Profiling] Discarding profile chunk because it contains less than 2 samples');\n return false;\n }\n\n return true;\n}\n\n/**\n * Creates event envelope headers for a profile chunk. This is separate from createEventEnvelopeHeaders util\n * as the profile chunk does not conform to the sentry event type\n */\nexport function createEventEnvelopeHeaders(\n sdkInfo: SdkInfo | undefined,\n tunnel: string | undefined,\n dsn?: DsnComponents,\n): EventEnvelopeHeaders {\n return {\n event_id: uuid4(),\n sent_at: new Date().toISOString(),\n ...(sdkInfo && { sdk: sdkInfo }),\n ...(!!tunnel && dsn && { dsn: dsnToString(dsn) }),\n };\n}\n\n/**\n * Creates a standalone profile_chunk envelope.\n */\nexport function makeProfileChunkEnvelope(\n platform: 'node',\n chunk: ProfileChunk,\n sdkInfo: SdkInfo | undefined,\n tunnel: string | undefined,\n dsn?: DsnComponents,\n): ProfileChunkEnvelope {\n const profileChunkHeader: ProfileChunkItem[0] = {\n type: 'profile_chunk',\n platform,\n };\n\n return createEnvelope<ProfileChunkEnvelope>(createEventEnvelopeHeaders(sdkInfo, tunnel, dsn), [\n [profileChunkHeader, chunk],\n ]);\n}\n\n/**\n * Cross reference profile collected resources with debug_ids and return a list of debug images.\n * @param {string[]} resource_paths\n * @returns {DebugImage[]}\n */\nexport function applyDebugMetadata(client: Client, resource_paths: ReadonlyArray<string>): DebugImage[] {\n const options = client.getOptions();\n\n if (!options?.stackParser) {\n return [];\n }\n\n return getDebugImagesForResources(options.stackParser, resource_paths);\n}\n","/* eslint-disable max-lines */\nimport type { Event, IntegrationFn, ProfileChunk, ProfilingIntegration } from '@sentry/core';\nimport { consoleSandbox, debug, defineIntegration, getCurrentScope, getGlobalScope, uuid4 } from '@sentry/core';\nimport type { NodeClient } from '@sentry/node';\nimport { CpuProfilerBindings, ProfileFormat } from '@sentry/node-cpu-profiler';\nimport { isMainThread } from 'worker_threads';\nimport { DEBUG_BUILD } from './debug-build';\nimport { NODE_MAJOR } from './nodeVersion';\nimport {\n createProfilingChunkEvent,\n makeProfileChunkEnvelope,\n PROFILER_THREAD_ID_STRING,\n PROFILER_THREAD_NAME,\n} from './utils';\n\nconst CHUNK_INTERVAL_MS = 1000 * 60;\ninterface ChunkData {\n id: string;\n timer: NodeJS.Timeout | undefined;\n startTraceID: string;\n}\n\nclass ContinuousProfiler {\n private _profilerId: string | undefined;\n private _client: NodeClient | undefined = undefined;\n private _chunkData: ChunkData | undefined = undefined;\n private _profileLifecycle: 'manual' | 'trace' | undefined = undefined;\n private _sampled: boolean | undefined = undefined;\n private _sessionSamplingRate: number | undefined = undefined;\n /**\n * Called when the profiler is attached to the client (continuous mode is enabled). If of the profiler\n * methods called before the profiler is initialized will result in a noop action with debug logs.\n * @param client\n */\n public initialize(client: NodeClient): void {\n if (!isMainThread) {\n DEBUG_BUILD &&\n debug.warn(\n '[Profiling] nodeProfilingIntegration() does not support worker threads — profiling will be disabled for this thread.',\n );\n return;\n }\n\n this._client = client;\n const options = client.getOptions();\n\n this._sessionSamplingRate = Math.random();\n this._sampled = this._sessionSamplingRate < (options.profileSessionSampleRate ?? 0);\n this._profileLifecycle = options.profileLifecycle ?? 'manual';\n\n this._setupSpanChunkInstrumentation();\n\n DEBUG_BUILD && debug.log(`[Profiling] Profiling mode is ${this._profileLifecycle}.`);\n\n switch (this._profileLifecycle) {\n case 'trace': {\n this._startTraceLifecycleProfiling();\n break;\n }\n case 'manual': {\n // Manual mode requires manual calls to profiler.startProfiler() and profiler.stopProfiler().\n break;\n }\n default: {\n DEBUG_BUILD &&\n debug.warn(`[Profiling] Unknown profiler mode: ${this._profileLifecycle}, profiler was not initialized`);\n break;\n }\n }\n\n // Attaches a listener to beforeSend which will add the threadId data to the event being sent.\n // This adds a constant overhead to all events being sent which could be improved to only attach\n // and detach the listener during a profiler session\n this._client.on('beforeSendEvent', this._onBeforeSendThreadContextAssignment.bind(this));\n }\n\n /**\n * Initializes a new profilerId session and schedules chunk profiling.\n * @returns void\n */\n public start(): void {\n if (!this._client) {\n DEBUG_BUILD && debug.log('[Profiling] Failed to start, Sentry client was never attached to the profiler.');\n return;\n }\n\n this._startProfiler();\n }\n\n /**\n * Stops the current chunk and flushes the profile to Sentry.\n */\n public stop(): void {\n this._stopProfiler();\n }\n\n private _startProfiler(): void {\n if (this._chunkData !== undefined) {\n DEBUG_BUILD && debug.log('[Profiling] Profile session already running, no-op.');\n return;\n }\n\n if (!this._sampled) {\n DEBUG_BUILD && debug.log('[Profiling] Profile session not sampled, no-op.');\n return;\n }\n\n if (this._profileLifecycle === 'trace') {\n DEBUG_BUILD &&\n debug.log(\n '[Profiling] You are using the trace profile lifecycle, manual calls to profiler.startProfiler() and profiler.stopProfiler() will be ignored.',\n );\n return;\n }\n\n this._startChunkProfiling();\n }\n\n private _stopProfiler(): void {\n if (this._profileLifecycle === 'trace') {\n DEBUG_BUILD &&\n debug.log(\n '[Profiling] You are using the trace profile lifecycle, manual calls to profiler.startProfiler() and profiler.stopProfiler() will be ignored.',\n );\n return;\n }\n\n if (!this._chunkData) {\n DEBUG_BUILD && debug.log('[Profiling] No profile session running, no-op.');\n return;\n }\n\n this._stopChunkProfiling();\n }\n\n /**\n * Starts trace lifecycle profiling. Profiling will remain active as long as there is an active span.\n */\n private _startTraceLifecycleProfiling(): void {\n if (!this._sampled) {\n DEBUG_BUILD &&\n debug.log('[Profiling] Profile session not sampled, trace lifecycle profiling will not be started.');\n return;\n }\n\n if (!this._client) {\n DEBUG_BUILD &&\n debug.log(\n '[Profiling] Failed to start trace lifecycle profiling, sentry client was never attached to the profiler.',\n );\n return;\n }\n\n let activeSpanCounter = 0;\n this._client.on('spanStart', _span => {\n if (activeSpanCounter === 0) {\n this._startChunkProfiling();\n }\n activeSpanCounter++;\n });\n\n this._client.on('spanEnd', _span => {\n if (activeSpanCounter === 1) {\n this._stopChunkProfiling();\n }\n activeSpanCounter--;\n });\n }\n\n /**\n * Stop profiler and initializes profiling of the next chunk\n */\n private _restartChunkProfiling(): void {\n if (!this._client) {\n // The client is not attached to the profiler if the user has not enabled continuous profiling.\n // In this case, calling start() and stop() is a noop action.The reason this exists is because\n // it makes the types easier to work with and avoids users having to do null checks.\n DEBUG_BUILD && debug.log('[Profiling] Profiler was never attached to the client.');\n return;\n }\n\n if (this._chunkData) {\n DEBUG_BUILD &&\n debug.log(\n `[Profiling] Chunk with chunk_id ${this._chunkData.id} is still running, current chunk will be stopped a new chunk will be started.`,\n );\n this._stopChunkProfiling();\n }\n\n this._startChunkProfiling();\n }\n\n /**\n * Stops profiling of the current chunks and flushes the profile to Sentry\n */\n private _stopChunkProfiling(): void {\n if (!this._chunkData) {\n DEBUG_BUILD && debug.log('[Profiling] No chunk data found, no-op.');\n return;\n }\n\n if (this._chunkData?.timer) {\n global.clearTimeout(this._chunkData.timer);\n this._chunkData.timer = undefined;\n DEBUG_BUILD && debug.log(`[Profiling] Stopping profiling chunk: ${this._chunkData.id}`);\n }\n\n if (!this._client) {\n DEBUG_BUILD &&\n debug.log('[Profiling] Failed to collect profile, sentry client was never attached to the profiler.');\n this._resetChunkData();\n return;\n }\n\n if (!this._chunkData?.id) {\n DEBUG_BUILD &&\n debug.log(`[Profiling] Failed to collect profile for: ${this._chunkData?.id}, the chunk_id is missing.`);\n this._resetChunkData();\n return;\n }\n\n const profile = CpuProfilerBindings.stopProfiling(this._chunkData.id, ProfileFormat.CHUNK);\n\n if (!profile) {\n DEBUG_BUILD && debug.log(`[Profiling] Failed to collect profile for: ${this._chunkData.id}`);\n this._resetChunkData();\n return;\n }\n\n if (!this._profilerId) {\n DEBUG_BUILD &&\n debug.log('[Profiling] Profile chunk does not contain a valid profiler_id, this is a bug in the SDK');\n this._resetChunkData();\n return;\n }\n if (profile) {\n DEBUG_BUILD && debug.log(`[Profiling] Sending profile chunk ${this._chunkData.id}.`);\n }\n\n DEBUG_BUILD && debug.log(`[Profiling] Profile chunk ${this._chunkData.id} sent to Sentry.`);\n const chunk = createProfilingChunkEvent(\n this._client,\n this._client.getOptions(),\n profile,\n this._client.getSdkMetadata()?.sdk,\n {\n chunk_id: this._chunkData.id,\n trace_id: this._chunkData.startTraceID,\n profiler_id: this._profilerId,\n },\n );\n\n if (!chunk) {\n DEBUG_BUILD && debug.log(`[Profiling] Failed to create profile chunk for: ${this._chunkData.id}`);\n this._resetChunkData();\n return;\n }\n\n this._flush(chunk);\n // Depending on the profile and stack sizes, stopping the profile and converting\n // the format may negatively impact the performance of the application. To avoid\n // blocking for too long, enqueue the next chunk start inside the next macrotask.\n // clear current chunk\n this._resetChunkData();\n }\n\n /**\n * Flushes the profile chunk to Sentry.\n * @param chunk\n */\n private _flush(chunk: ProfileChunk): void {\n if (!this._client) {\n DEBUG_BUILD &&\n debug.log('[Profiling] Failed to collect profile, sentry client was never attached to the profiler.');\n return;\n }\n\n const dsn = this._client.getDsn();\n const metadata = this._client.getSdkMetadata();\n const tunnel = this._client.getOptions().tunnel;\n\n const envelope = makeProfileChunkEnvelope('node', chunk, metadata?.sdk, tunnel, dsn);\n this._client.sendEnvelope(envelope).then(null, reason => {\n DEBUG_BUILD && debug.error('Error while sending profile chunk envelope:', reason);\n });\n }\n\n /**\n * Starts the profiler and registers the flush timer for a given chunk.\n * @param chunk\n */\n private _startChunkProfiling(): void {\n if (this._chunkData) {\n DEBUG_BUILD && debug.log('[Profiling] Chunk is already running, no-op.');\n return;\n }\n\n const traceId = getCurrentScope().getPropagationContext().traceId;\n const chunk = this._initializeChunk(traceId);\n\n CpuProfilerBindings.startProfiling(chunk.id);\n DEBUG_BUILD && debug.log(`[Profiling] starting profiling chunk: ${chunk.id}`);\n\n chunk.timer = global.setTimeout(() => {\n DEBUG_BUILD && debug.log(`[Profiling] Stopping profiling chunk: ${chunk.id}`);\n this._stopChunkProfiling();\n DEBUG_BUILD && debug.log('[Profiling] Starting new profiling chunk.');\n setImmediate(this._restartChunkProfiling.bind(this));\n }, CHUNK_INTERVAL_MS);\n\n // Unref timeout so it doesn't keep the process alive.\n chunk.timer.unref();\n }\n\n /**\n * Attaches profiling information to spans that were started\n * during a profiling session.\n */\n private _setupSpanChunkInstrumentation(): void {\n if (!this._client) {\n DEBUG_BUILD &&\n debug.log('[Profiling] Failed to initialize span profiling, sentry client was never attached to the profiler.');\n return;\n }\n\n this._profilerId = uuid4();\n getGlobalScope().setContext('profile', {\n profiler_id: this._profilerId,\n });\n }\n\n /**\n * Assigns thread_id and thread name context to a profiled event if there is an active profiler session\n */\n private _onBeforeSendThreadContextAssignment(event: Event): void {\n if (!this._client || !this._profilerId) return;\n this._assignThreadIdContext(event);\n }\n\n /**\n * Clear profiling information from global context when a profile is not running.\n */\n private _teardownSpanChunkInstrumentation(): void {\n this._profilerId = undefined;\n const globalScope = getGlobalScope();\n globalScope.setContext('profile', {});\n }\n\n /**\n * Initializes new profile chunk metadata\n */\n private _initializeChunk(traceId: string): ChunkData {\n this._chunkData = {\n id: uuid4(),\n startTraceID: traceId,\n timer: undefined,\n };\n return this._chunkData;\n }\n\n /**\n * Assigns thread_id and thread name context to a profiled event.\n */\n private _assignThreadIdContext(event: Event): void {\n if (!event?.contexts?.profile) {\n return;\n }\n\n if (!event.contexts) {\n return;\n }\n\n // @ts-expect-error the trace fallback value is wrong, though it should never happen\n // and in case it does, we dont want to override whatever was passed initially.\n event.contexts.trace = {\n ...(event.contexts?.trace ?? {}),\n data: {\n ...(event.contexts?.trace?.data ?? {}),\n ['thread.id']: PROFILER_THREAD_ID_STRING,\n ['thread.name']: PROFILER_THREAD_NAME,\n },\n };\n }\n\n /**\n * Resets the current chunk state.\n */\n private _resetChunkData(): void {\n this._chunkData = undefined;\n }\n}\n\n/** Exported only for tests. */\nexport const _nodeProfilingIntegration = ((): ProfilingIntegration<NodeClient> => {\n if (![16, 18, 20, 22, 24, 26].includes(NODE_MAJOR)) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn(\n `[Sentry Profiling] You are using a Node.js version that does not have prebuilt binaries (${NODE_MAJOR}).`,\n 'The @sentry/profiling-node package only has prebuilt support for the following LTS versions of Node.js: 16, 18, 20, 22, 24, 26.',\n 'To use the @sentry/profiling-node package with this version of Node.js, you will need to compile the native addon from source.',\n 'See: https://github.com/getsentry/sentry-javascript/tree/develop/packages/profiling-node#building-the-package-from-source',\n );\n });\n }\n\n return {\n name: 'ProfilingIntegration' as const,\n _profiler: new ContinuousProfiler(),\n setup(client: NodeClient) {\n DEBUG_BUILD && debug.log('[Profiling] Profiling integration setup.');\n this._profiler.initialize(client);\n return;\n },\n };\n}) satisfies IntegrationFn;\n\nexport const nodeProfilingIntegration = defineIntegration(_nodeProfilingIntegration);\n"],"names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AA,EAKQ,eAAA,GAAwB;AAC9B,IAAA,IAAA,CAAK,UAAA,GAAa,MAAA;AAAA,EACpB;AACF;AAGO,MAAM,6BAA6B,MAAwC;AAChF,EAAA,IAAI,CAAC,CAAC,EAAA,EAAI,EAAA,EAAI,EAAA,EAAI,EAAA,EAAI,EAAA,EAAI,EAAE,CAAA,CAAE,QAAA,CAAS,UAAU,CAAA,EAAG;AAClD,IAAA,cAAA,CAAe,MAAM;AAEnB,MAAA,OAAA,CAAQ,IAAA;AAAA,QACN,4FAA4F,UAAU,CAAA,EAAA,CAAA;AAAA,QACtG,iIAAA;AAAA,QACA,gIAAA;AAAA,QACA;AAAA,OACF;AAAA,IACF,CAAC,CAAA;AAAA,EACH;AAEA,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,sBAAA;AAAA,IACN,SAAA,EAAW,IAAI,kBAAA,EAAmB;AAAA,IAClC,MAAM,MAAA,EAAoB;AACxB,MAAA,WAAA,IAAe,KAAA,CAAM,IAAI,0CAA0C,CAAA;AACnE,MAAA,IAAA,CAAK,SAAA,CAAU,WAAW,MAAM,CAAA;AAChC,MAAA;AAAA,IACF;AAAA,GACF;AACF,CAAA,CAAA;AAEO,MAAM,wBAAA,GAA2B,kBAAkB,yBAAyB;;;;"}
|
package/build/esm/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"type":"module","version":"11.
|
|
1
|
+
{"type":"module","version":"11.3.0","sideEffects":false}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integration.d.ts","sourceRoot":"","sources":["../../src/integration.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAsC,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAE7F,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"integration.d.ts","sourceRoot":"","sources":["../../src/integration.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAsC,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAE7F,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAqY/C,+BAA+B;AAC/B,eAAO,MAAM,yBAAyB,QAAQ,oBAAoB,CAAC,UAAU,CAsBnD,CAAC;AAE3B,eAAO,MAAM,wBAAwB;;CAA+C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/profiling-node",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.3.0",
|
|
4
4
|
"description": "Official Sentry SDK for Node.js Profiling",
|
|
5
5
|
"repository": "git://github.com/getsentry/sentry-javascript.git",
|
|
6
6
|
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/profiling-node",
|
|
@@ -51,8 +51,8 @@
|
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"@sentry/node-cpu-profiler": "^2.4.4",
|
|
54
|
-
"@sentry/core": "11.
|
|
55
|
-
"@sentry/node": "11.
|
|
54
|
+
"@sentry/core": "11.3.0",
|
|
55
|
+
"@sentry/node": "11.3.0"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@types/node": "^18.19.1"
|