Skip to content

Commit c7724bd

Browse files
committed
ref(tracing): Switch to JSON format when serializing the sample_rate for DSC
1 parent 174433a commit c7724bd

File tree

2 files changed

+1
-28
lines changed

2 files changed

+1
-28
lines changed

packages/tracing/src/transaction.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,10 +246,7 @@ export class Transaction extends SpanClass implements TransactionInterface {
246246
const { publicKey: public_key } = client.getDsn() || {};
247247

248248
const rate = this.metadata && this.metadata.transactionSampling && this.metadata.transactionSampling.rate;
249-
const sample_rate =
250-
rate !== undefined
251-
? rate.toLocaleString('fullwide', { useGrouping: false, maximumFractionDigits: 16 })
252-
: undefined;
249+
const sample_rate = rate !== undefined ? JSON.stringify(rate) : undefined;
253250

254251
const scope = hub.getScope();
255252
const { segment: user_segment } = (scope && scope.getUser()) || {};

packages/tracing/test/span.test.ts

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -449,30 +449,6 @@ describe('Span', () => {
449449
expect(baggage && getThirdPartyBaggage(baggage)).toStrictEqual('');
450450
});
451451

452-
test('exponential sample rate notation is converted to decimal notation', () => {
453-
const transaction = new Transaction(
454-
{
455-
name: 'tx',
456-
metadata: {
457-
transactionSampling: { rate: 1.45e-14, method: 'client_rate' },
458-
},
459-
},
460-
hub,
461-
);
462-
463-
const baggage = transaction.getBaggage();
464-
465-
expect(baggage && isSentryBaggageEmpty(baggage)).toBe(false);
466-
expect(baggage && getSentryBaggageItems(baggage)).toStrictEqual({
467-
release: '1.0.1',
468-
environment: 'production',
469-
// transaction: 'tx',
470-
sample_rate: '0.0000000000000145',
471-
trace_id: expect.any(String),
472-
});
473-
expect(baggage && getThirdPartyBaggage(baggage)).toStrictEqual('');
474-
});
475-
476452
describe('Including transaction name in DSC', () => {
477453
test.each([
478454
['is not included if transaction source is not set', undefined],

0 commit comments

Comments
 (0)