Skip to content

Commit 5c29fa2

Browse files
committed
fix: run prettier
1 parent c7078fb commit 5c29fa2

File tree

4 files changed

+14
-16
lines changed

4 files changed

+14
-16
lines changed

packages/browser/src/profiling/hubextensions.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,8 @@ import type { Transaction } from '@sentry/types';
44
import { logger, uuid4 } from '@sentry/utils';
55

66
import { WINDOW } from '../helpers';
7-
import type {
8-
JSSelfProfile,
9-
JSSelfProfiler,
10-
JSSelfProfilerConstructor,
11-
} from './jsSelfProfiling';
12-
import { addProfileToMap,isValidSampleRate } from './utils';
7+
import type { JSSelfProfile, JSSelfProfiler, JSSelfProfilerConstructor } from './jsSelfProfiling';
8+
import { addProfileToMap, isValidSampleRate } from './utils';
139

1410
export const MAX_PROFILE_DURATION_MS = 30_000;
1511
// Keep a flag value to avoid re-initializing the profiler constructor. If it fails
@@ -82,7 +78,12 @@ export function wrapTransactionWithProfiling(transaction: Transaction): Transact
8278

8379
// Prefer sampler to sample rate if both are provided.
8480
if (typeof profilesSampler === 'function') {
85-
profilesSampleRate = profilesSampler({ transactionContext: transaction.toContext() });
81+
const transactionContext = transaction.toContext();
82+
profilesSampleRate = profilesSampler({
83+
parentSampled: transactionContext.parentSampled,
84+
transactionContext: transactionContext,
85+
...transaction.getDynamicSamplingContext(),
86+
});
8687
}
8788

8889
// Since this is coming from the user (or from a function provided by the user), who knows what we might get. (The

packages/browser/src/profiling/integration.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export class BrowserProfilingIntegration implements Integration {
3939

4040
client.on('beforeEnvelope', (envelope): void => {
4141
// if not profiles are in queue, there is nothing to add to the envelope.
42-
if (!PROFILE_MAP.size) {
42+
if (!PROFILE_MAP['size']) {
4343
return;
4444
}
4545

@@ -51,14 +51,12 @@ export class BrowserProfilingIntegration implements Integration {
5151
const profilesToAddToEnvelope: Profile[] = [];
5252

5353
for (const profiledTransaction of profiledTransactionEvents) {
54-
const profile_id =
55-
profiledTransaction &&
56-
profiledTransaction.contexts &&
57-
profiledTransaction.contexts['profile'] &&
58-
profiledTransaction.contexts['profile']['profile_id'] as string
54+
const context = profiledTransaction && profiledTransaction.contexts;
55+
const profile_id = context && context['profile'] && (context['profile']['profile_id'] as string);
5956

6057
if (!profile_id) {
61-
__DEBUG_BUILD__ && logger.log('[Profiling] cannot find profile for a transaction without a profile context');
58+
__DEBUG_BUILD__ &&
59+
logger.log('[Profiling] cannot find profile for a transaction without a profile context');
6260
continue;
6361
}
6462

packages/browser/src/profiling/jsSelfProfiling.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,3 @@ declare global {
4545
Profiler: typeof JSSelfProfilerConstructor | undefined;
4646
}
4747
}
48-

packages/browser/src/profiling/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ function isValidProfile(profile: JSSelfProfile): profile is JSSelfProfile & { pr
430430
}
431431

432432
if (!profile.frames.length) {
433-
if(__DEBUG_BUILD__) {
433+
if (__DEBUG_BUILD__) {
434434
logger.log('[Profiling] Discarding profile because it contains no frames');
435435
}
436436
return false;

0 commit comments

Comments
 (0)