From eb51641c89559ab3c35f8a3a52c9dc48158808c0 Mon Sep 17 00:00:00 2001 From: s1gr1d <32902192+s1gr1d@users.noreply.github.com> Date: Wed, 12 Nov 2025 15:33:16 +0100 Subject: [PATCH 1/2] move profiling --- packages/browser/src/profiling/integration.ts | 2 +- .../profiling/{lifecycleMode => }/traceLifecycleProfiler.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) rename packages/browser/src/profiling/{lifecycleMode => }/traceLifecycleProfiler.ts (98%) diff --git a/packages/browser/src/profiling/integration.ts b/packages/browser/src/profiling/integration.ts index 415282698d45..b599665ca895 100644 --- a/packages/browser/src/profiling/integration.ts +++ b/packages/browser/src/profiling/integration.ts @@ -3,8 +3,8 @@ import { debug, defineIntegration, getActiveSpan, getRootSpan, hasSpansEnabled } import type { BrowserOptions } from '../client'; import { DEBUG_BUILD } from '../debug-build'; import { WINDOW } from '../helpers'; -import { BrowserTraceLifecycleProfiler } from './lifecycleMode/traceLifecycleProfiler'; import { startProfileForSpan } from './startProfileForSpan'; +import { BrowserTraceLifecycleProfiler } from './traceLifecycleProfiler'; import type { ProfiledEvent } from './utils'; import { addProfilesToEnvelope, diff --git a/packages/browser/src/profiling/lifecycleMode/traceLifecycleProfiler.ts b/packages/browser/src/profiling/traceLifecycleProfiler.ts similarity index 98% rename from packages/browser/src/profiling/lifecycleMode/traceLifecycleProfiler.ts rename to packages/browser/src/profiling/traceLifecycleProfiler.ts index 3ce773fe01ff..541579f5563c 100644 --- a/packages/browser/src/profiling/lifecycleMode/traceLifecycleProfiler.ts +++ b/packages/browser/src/profiling/traceLifecycleProfiler.ts @@ -9,9 +9,9 @@ import { getSdkMetadataForEnvelopeHeader, uuid4, } from '@sentry/core'; -import { DEBUG_BUILD } from '../../debug-build'; -import type { JSSelfProfiler } from '../jsSelfProfiling'; -import { createProfileChunkPayload, startJSSelfProfile, validateProfileChunk } from '../utils'; +import { DEBUG_BUILD } from './../debug-build'; +import type { JSSelfProfiler } from './jsSelfProfiling'; +import { createProfileChunkPayload, startJSSelfProfile, validateProfileChunk } from './utils'; const CHUNK_INTERVAL_MS = 60_000; // 1 minute // Maximum length for trace lifecycle profiling per root span (e.g. if spanEnd never fires) From de831379d38105c52bbe3da88525f9f7625a9278 Mon Sep 17 00:00:00 2001 From: s1gr1d <32902192+s1gr1d@users.noreply.github.com> Date: Wed, 12 Nov 2025 15:37:54 +0100 Subject: [PATCH 2/2] ref(profiling): Move and rename profiler class to UIProfiler --- .../profiling/{traceLifecycleProfiler.ts => UIProfiler.ts} | 2 +- packages/browser/src/profiling/integration.ts | 4 ++-- .../{traceLifecycleProfiler.test.ts => UIProfiler.test.ts} | 0 3 files changed, 3 insertions(+), 3 deletions(-) rename packages/browser/src/profiling/{traceLifecycleProfiler.ts => UIProfiler.ts} (99%) rename packages/browser/test/profiling/{traceLifecycleProfiler.test.ts => UIProfiler.test.ts} (100%) diff --git a/packages/browser/src/profiling/traceLifecycleProfiler.ts b/packages/browser/src/profiling/UIProfiler.ts similarity index 99% rename from packages/browser/src/profiling/traceLifecycleProfiler.ts rename to packages/browser/src/profiling/UIProfiler.ts index 541579f5563c..fb7cd022ac7f 100644 --- a/packages/browser/src/profiling/traceLifecycleProfiler.ts +++ b/packages/browser/src/profiling/UIProfiler.ts @@ -27,7 +27,7 @@ const MAX_ROOT_SPAN_PROFILE_MS = 300_000; // 5 minutes * - there are no more sampled root spans, or * - the 60s chunk timer elapses while profiling is running. */ -export class BrowserTraceLifecycleProfiler { +export class UIProfiler { private _client: Client | undefined; private _profiler: JSSelfProfiler | undefined; private _chunkTimer: ReturnType | undefined; diff --git a/packages/browser/src/profiling/integration.ts b/packages/browser/src/profiling/integration.ts index b599665ca895..7cd1886e636d 100644 --- a/packages/browser/src/profiling/integration.ts +++ b/packages/browser/src/profiling/integration.ts @@ -4,7 +4,7 @@ import type { BrowserOptions } from '../client'; import { DEBUG_BUILD } from '../debug-build'; import { WINDOW } from '../helpers'; import { startProfileForSpan } from './startProfileForSpan'; -import { BrowserTraceLifecycleProfiler } from './traceLifecycleProfiler'; +import { UIProfiler } from './UIProfiler'; import type { ProfiledEvent } from './utils'; import { addProfilesToEnvelope, @@ -65,7 +65,7 @@ const _browserProfilingIntegration = (() => { return; } - const traceLifecycleProfiler = new BrowserTraceLifecycleProfiler(); + const traceLifecycleProfiler = new UIProfiler(); traceLifecycleProfiler.initialize(client, sessionSampled); // If there is an active, sampled root span already, notify the profiler diff --git a/packages/browser/test/profiling/traceLifecycleProfiler.test.ts b/packages/browser/test/profiling/UIProfiler.test.ts similarity index 100% rename from packages/browser/test/profiling/traceLifecycleProfiler.test.ts rename to packages/browser/test/profiling/UIProfiler.test.ts