Skip to content

Commit b38f9b2

Browse files
committed
fix(profiling): continuous profile chunks should be in seconds
1 parent 78ff5bf commit b38f9b2

File tree

4 files changed

+3
-12
lines changed

4 files changed

+3
-12
lines changed

packages/profiling-node/bindings/cpu_profiler.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,7 @@ static napi_value TranslateMeasurementsDouble(
759759
} else if (format == ProfileFormat::kFormatChunk) {
760760
napi_value ts;
761761
napi_create_double(
762-
env, profile_start_timestamp_ms + (timestamps_ns[i] * 1e-6), &ts);
762+
env, profile_start_timestamp_ms + (timestamps_ns[i] * 1e-9), &ts);
763763
napi_set_named_property(env, entry, "timestamp", ts);
764764
}
765765

@@ -818,7 +818,7 @@ TranslateMeasurements(const napi_env &env, const enum ProfileFormat format,
818818
case ProfileFormat::kFormatChunk: {
819819
napi_value ts;
820820
napi_create_double(
821-
env, profile_start_timestamp_ms + (timestamps_ns[i] * 1e-6), &ts);
821+
env, profile_start_timestamp_ms + (timestamps_ns[i] * 1e-9), &ts);
822822
napi_set_named_property(env, entry, "timestamp", ts);
823823
} break;
824824
default:

packages/profiling-node/src/integration.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,6 @@ function setupAutomatedSpanProfiling(client: NodeClient): void {
146146
interface ChunkData {
147147
id: string;
148148
timer: NodeJS.Timeout | undefined;
149-
startTimestampMS: number;
150149
startTraceID: string;
151150
}
152151
class ContinuousProfiler {
@@ -212,7 +211,7 @@ class ContinuousProfiler {
212211
return;
213212
}
214213
const profile = CpuProfilerBindings.stopProfiling(this._chunkData.id, ProfileFormat.CHUNK);
215-
if (!profile || !this._chunkData.startTimestampMS) {
214+
if (!profile) {
216215
DEBUG_BUILD && logger.log(`[Profiling] _chunkiledStartTraceID to collect profile for: ${this._chunkData.id}`);
217216
return;
218217
}
@@ -222,7 +221,6 @@ class ContinuousProfiler {
222221

223222
DEBUG_BUILD && logger.log(`[Profiling] Profile chunk ${this._chunkData.id} sent to Sentry.`);
224223
const chunk = createProfilingChunkEvent(
225-
this._chunkData.startTimestampMS,
226224
this._client,
227225
this._client.getOptions(),
228226
profile,
@@ -300,7 +298,6 @@ class ContinuousProfiler {
300298
this._chunkData = {
301299
id: uuid4(),
302300
startTraceID: traceId,
303-
startTimestampMS: timestampInSeconds(),
304301
timer: undefined,
305302
};
306303
}

packages/profiling-node/src/utils.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -191,14 +191,12 @@ function createProfileChunkPayload(
191191
{
192192
release,
193193
environment,
194-
start_timestamp,
195194
trace_id,
196195
profiler_id,
197196
chunk_id,
198197
}: {
199198
release: string;
200199
environment: string;
201-
start_timestamp: number;
202200
trace_id: string | undefined;
203201
chunk_id: string;
204202
profiler_id: string;
@@ -216,7 +214,6 @@ function createProfileChunkPayload(
216214
const profile: ProfileChunk = {
217215
chunk_id: chunk_id,
218216
profiler_id: profiler_id,
219-
timestamp: new Date(start_timestamp).toISOString(),
220217
platform: 'node',
221218
version: CONTINUOUS_FORMAT_VERSION,
222219
release: release,
@@ -235,7 +232,6 @@ function createProfileChunkPayload(
235232
* Creates a profiling chunk envelope item, if the profile does not pass validation, returns null.
236233
*/
237234
export function createProfilingChunkEvent(
238-
start_timestamp: number,
239235
client: Client,
240236
options: { release?: string; environment?: string },
241237
profile: RawChunkCpuProfile,
@@ -248,7 +244,6 @@ export function createProfilingChunkEvent(
248244
return createProfileChunkPayload(client, profile, {
249245
release: options.release ?? '',
250246
environment: options.environment ?? '',
251-
start_timestamp: start_timestamp,
252247
trace_id: identifiers.trace_id ?? '',
253248
chunk_id: identifiers.chunk_id,
254249
profiler_id: identifiers.profiler_id,

packages/types/src/profiling.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ export interface ContinuousThreadCpuProfile {
5050
}
5151

5252
interface BaseProfile<T> {
53-
timestamp: string;
5453
version: string;
5554
release: string;
5655
environment: string;

0 commit comments

Comments
 (0)