Skip to content

Commit 2630a8d

Browse files
committed
fix: lint
1 parent bcd9397 commit 2630a8d

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

packages/core/src/client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/* eslint-disable max-lines */
2-
import { _INTERNAL_safeMathRandom } from '.';
32
import { getEnvelopeEndpointWithUrlEncodedAuth } from './api';
43
import { DEFAULT_ENVIRONMENT } from './constants';
54
import { getCurrentScope, getIsolationScope, getTraceContextFromScope } from './currentScopes';
@@ -46,6 +45,7 @@ import { checkOrSetAlreadyCaught, uuid4 } from './utils/misc';
4645
import { parseSampleRate } from './utils/parseSampleRate';
4746
import { prepareEvent } from './utils/prepareEvent';
4847
import { makePromiseBuffer, type PromiseBuffer, SENTRY_BUFFER_FULL_ERROR } from './utils/promisebuffer';
48+
import { safeMathRandom } from './utils/randomSafeContext';
4949
import { reparentChildSpans, shouldIgnoreSpan } from './utils/should-ignore-span';
5050
import { showSpanDropWarning } from './utils/spanUtils';
5151
import { rejectedSyncPromise } from './utils/syncpromise';
@@ -1289,7 +1289,7 @@ export abstract class Client<O extends ClientOptions = ClientOptions> {
12891289
// 0.0 === 0% events are sent
12901290
// Sampling for transaction happens somewhere else
12911291
const parsedSampleRate = typeof sampleRate === 'undefined' ? undefined : parseSampleRate(sampleRate);
1292-
if (isError && typeof parsedSampleRate === 'number' && _INTERNAL_safeMathRandom() > parsedSampleRate) {
1292+
if (isError && typeof parsedSampleRate === 'number' && safeMathRandom() > parsedSampleRate) {
12931293
this.recordDroppedEvent('sample_rate', 'error');
12941294
return rejectedSyncPromise(
12951295
_makeDoNotSendEventError(

packages/opentelemetry/src/sampler.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
} from '@opentelemetry/semantic-conventions';
1313
import type { Client, SpanAttributes } from '@sentry/core';
1414
import {
15+
_INTERNAL_safeMathRandom,
1516
baggageHeaderToDynamicSamplingContext,
1617
debug,
1718
hasSpansEnabled,
@@ -121,7 +122,7 @@ export class SentrySampler implements Sampler {
121122
const dscString = parentContext?.traceState ? parentContext.traceState.get(SENTRY_TRACE_STATE_DSC) : undefined;
122123
const dsc = dscString ? baggageHeaderToDynamicSamplingContext(dscString) : undefined;
123124

124-
const sampleRand = parseSampleRate(dsc?.sample_rand) ?? Math.random();
125+
const sampleRand = parseSampleRate(dsc?.sample_rand) ?? _INTERNAL_safeMathRandom();
125126

126127
const [sampled, sampleRate, localSampleRateWasApplied] = sampleSpan(
127128
options,

0 commit comments

Comments
 (0)