From d93d94c2ea2777a356c41101099f8c556563d6ab Mon Sep 17 00:00:00 2001 From: JonasBa Date: Fri, 23 Jun 2023 13:03:19 -0400 Subject: [PATCH] fix: remove profilesSampler --- .../browser/src/profiling/hubextensions.ts | 20 ++----------------- packages/browser/src/profiling/integration.ts | 4 ++-- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/packages/browser/src/profiling/hubextensions.ts b/packages/browser/src/profiling/hubextensions.ts index 5b45b593b2e2..fe8e7c7e2aa0 100644 --- a/packages/browser/src/profiling/hubextensions.ts +++ b/packages/browser/src/profiling/hubextensions.ts @@ -71,20 +71,8 @@ export function wrapTransactionWithProfiling(transaction: Transaction): Transact return transaction; } - // @ts-ignore profilesSampler is not part of the browser options yet - const profilesSampler = options.profilesSampler; // @ts-ignore profilesSampleRate is not part of the browser options yet - let profilesSampleRate: number | boolean | undefined = options.profilesSampleRate; - - // Prefer sampler to sample rate if both are provided. - if (typeof profilesSampler === 'function') { - const transactionContext = transaction.toContext(); - profilesSampleRate = profilesSampler({ - parentSampled: transactionContext.parentSampled, - transactionContext: transactionContext, - ...transaction.getDynamicSamplingContext(), - }); - } + const profilesSampleRate: number | boolean | undefined = options.profilesSampleRate; // Since this is coming from the user (or from a function provided by the user), who knows what we might get. (The // only valid values are booleans or numbers between 0 and 1.) @@ -97,11 +85,7 @@ export function wrapTransactionWithProfiling(transaction: Transaction): Transact if (!profilesSampleRate) { __DEBUG_BUILD__ && logger.log( - `[Profiling] Discarding profile because ${ - typeof profilesSampler === 'function' - ? 'profileSampler returned 0 or false' - : 'a negative sampling decision was inherited or profileSampleRate is set to 0' - }`, + '[Profiling] Discarding profile because a negative sampling decision was inherited or profileSampleRate is set to 0', ); return transaction; } diff --git a/packages/browser/src/profiling/integration.ts b/packages/browser/src/profiling/integration.ts index eee2691bddc6..36fb6432e6df 100644 --- a/packages/browser/src/profiling/integration.ts +++ b/packages/browser/src/profiling/integration.ts @@ -61,8 +61,8 @@ export class BrowserProfilingIntegration implements Integration { } // Remove the profile from the transaction context before sending, relay will take care of the rest. - if (profiledTransaction && profiledTransaction.contexts && profiledTransaction.contexts['profile']) { - delete profiledTransaction.contexts.profile; + if (context && context['profile']) { + delete context.profile; } const profile = PROFILE_MAP.get(profile_id);