diff --git a/packages/profiling-node/bindings/cpu_profiler.cc b/packages/profiling-node/bindings/cpu_profiler.cc index cbff754623bc..3a00d76f3169 100644 --- a/packages/profiling-node/bindings/cpu_profiler.cc +++ b/packages/profiling-node/bindings/cpu_profiler.cc @@ -759,7 +759,7 @@ static napi_value TranslateMeasurementsDouble( } else if (format == ProfileFormat::kFormatChunk) { napi_value ts; napi_create_double( - env, profile_start_timestamp_ms + (timestamps_ns[i] * 1e-6), &ts); + env, profile_start_timestamp_ms + (timestamps_ns[i] * 1e-9), &ts); napi_set_named_property(env, entry, "timestamp", ts); } @@ -818,7 +818,7 @@ TranslateMeasurements(const napi_env &env, const enum ProfileFormat format, case ProfileFormat::kFormatChunk: { napi_value ts; napi_create_double( - env, profile_start_timestamp_ms + (timestamps_ns[i] * 1e-6), &ts); + env, profile_start_timestamp_ms + (timestamps_ns[i] * 1e-9), &ts); napi_set_named_property(env, entry, "timestamp", ts); } break; default: diff --git a/packages/profiling-node/src/integration.ts b/packages/profiling-node/src/integration.ts index 574c0250e76a..e6d33d5c4b46 100644 --- a/packages/profiling-node/src/integration.ts +++ b/packages/profiling-node/src/integration.ts @@ -2,7 +2,7 @@ import { defineIntegration, getCurrentScope, getIsolationScope, getRootSpan, spa import type { NodeClient } from '@sentry/node'; import type { Event, Integration, IntegrationFn, Profile, ProfileChunk, Span } from '@sentry/types'; -import { LRUMap, logger, timestampInSeconds, uuid4 } from '@sentry/utils'; +import { LRUMap, logger, uuid4 } from '@sentry/utils'; import { getGlobalScope } from '../../core/src/currentScopes'; import { CpuProfilerBindings } from './cpu_profiler'; @@ -149,7 +149,6 @@ function setupAutomatedSpanProfiling(client: NodeClient): void { interface ChunkData { id: string; timer: NodeJS.Timeout | undefined; - startTimestampMS: number; startTraceID: string; } class ContinuousProfiler { @@ -217,7 +216,7 @@ class ContinuousProfiler { const profile = this._stopChunkProfiling(this._chunkData); - if (!profile || !this._chunkData.startTimestampMS) { + if (!profile) { DEBUG_BUILD && logger.log(`[Profiling] _chunkiledStartTraceID to collect profile for: ${this._chunkData.id}`); return; } @@ -226,17 +225,11 @@ class ContinuousProfiler { } DEBUG_BUILD && logger.log(`[Profiling] Profile chunk ${this._chunkData.id} sent to Sentry.`); - const chunk = createProfilingChunkEvent( - this._chunkData.startTimestampMS, - this._client, - this._client.getOptions(), - profile, - { - chunk_id: this._chunkData.id, - trace_id: this._chunkData.startTraceID, - profiler_id: this._profilerId, - }, - ); + const chunk = createProfilingChunkEvent(this._client, this._client.getOptions(), profile, { + chunk_id: this._chunkData.id, + trace_id: this._chunkData.startTraceID, + profiler_id: this._profilerId, + }); if (!chunk) { DEBUG_BUILD && logger.log(`[Profiling] Failed to create profile chunk for: ${this._chunkData.id}`); @@ -341,7 +334,6 @@ class ContinuousProfiler { this._chunkData = { id: uuid4(), startTraceID: traceId, - startTimestampMS: timestampInSeconds(), timer: undefined, }; } diff --git a/packages/profiling-node/src/utils.ts b/packages/profiling-node/src/utils.ts index 5cb7824387b7..673901990d90 100644 --- a/packages/profiling-node/src/utils.ts +++ b/packages/profiling-node/src/utils.ts @@ -191,14 +191,12 @@ function createProfileChunkPayload( { release, environment, - start_timestamp, trace_id, profiler_id, chunk_id, }: { release: string; environment: string; - start_timestamp: number; trace_id: string | undefined; chunk_id: string; profiler_id: string; @@ -216,7 +214,6 @@ function createProfileChunkPayload( const profile: ProfileChunk = { chunk_id: chunk_id, profiler_id: profiler_id, - timestamp: new Date(start_timestamp).toISOString(), platform: 'node', version: CONTINUOUS_FORMAT_VERSION, release: release, @@ -235,7 +232,6 @@ function createProfileChunkPayload( * Creates a profiling chunk envelope item, if the profile does not pass validation, returns null. */ export function createProfilingChunkEvent( - start_timestamp: number, client: Client, options: { release?: string; environment?: string }, profile: RawChunkCpuProfile, @@ -248,7 +244,6 @@ export function createProfilingChunkEvent( return createProfileChunkPayload(client, profile, { release: options.release ?? '', environment: options.environment ?? '', - start_timestamp: start_timestamp, trace_id: identifiers.trace_id ?? '', chunk_id: identifiers.chunk_id, profiler_id: identifiers.profiler_id, diff --git a/packages/types/src/profiling.ts b/packages/types/src/profiling.ts index 5161b6b64b2e..48dd797492bf 100644 --- a/packages/types/src/profiling.ts +++ b/packages/types/src/profiling.ts @@ -50,7 +50,6 @@ export interface ContinuousThreadCpuProfile { } interface BaseProfile { - timestamp: string; version: string; release: string; environment: string;