8000 feat: Propagate and use a sampling random (#14989) · tjhiggins/sentry-javascript@95cc948 · GitHub
[go: up one dir, main page]

Skip to content

Commit 95cc948

Browse files
author
Luca Forstner
authored
feat: Propagate and use a sampling random (getsentry#14989)
1 parent 5a46a5c commit 95cc948

File tree

70 files changed

+481
-151
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+481
-151
lines changed

dev-packages/browser-integration-tests/suites/public-api/startSpan/parallel-root-spans-with-parentSpanId/subject.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
Sentry.getCurrentScope().setPropagationContext({
22
parentSpanId: '1234567890123456',
33
traceId: '12345678901234567890123456789012',
4+
sampleRand: Math.random(),
45
});
56

67
Sentry.startSpan({ name: 'test_span_1' }, () => undefined);

dev-packages/browser-integration-tests/suites/public-api/startSpan/standalone-mixed-transaction/test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ sentryTest(
4747
sampled: 'true',
4848
trace_id: traceId,
4949
transaction: 'outer',
50+
sample_rand: expect.any(String),
5051
},
5152
});
5253

@@ -64,6 +65,7 @@ sentryTest(
6465
sampled: 'true',
6566
trace_id: traceId,
6667
transaction: 'outer',
68+
sample_rand: expect.any(String),
6769
},
6870
});
6971

dev-packages/browser-integration-tests/suites/public-api/startSpan/standalone/test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ sentryTest('sends a segment span envelope', async ({ getLocalTestUrl, page }) =>
3333
sampled: 'true',
3434
trace_id: traceId,
3535
transaction: 'standalone_segment_span',
36+
sample_rand: expect.any(String),
3637
},
3738
});
3839

dev-packages/browser-integration-tests/suites/replay/dsc/test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ sentryTest(
6262
public_key: 'public',
6363
replay_id: replay.session?.id,
6464
sampled: 'true',
65+
sample_rand: expect.any(String),
6566
});
6667
},
6768
);
@@ -108,6 +109,7 @@ sentryTest(
108109
trace_id: expect.stringMatching(/[a-f0-9]{32}/),
109110
public_key: 'public',
110111
sampled: 'true',
112+
sample_rand: expect.any(String),
111113
});
112114
},
113115
);
@@ -161,6 +163,7 @@ sentryTest(
161163
public_key: 'public',
162164
replay_id: replay.session?.id,
163165
sampled: 'true',
166+
sample_rand: expect.any(String),
164167
});
165168
},
166169
);
@@ -202,6 +205,7 @@ sentryTest(
202205
trace_id: expect.stringMatching(/[a-f0-9]{32}/),
203206
public_key: 'public',
204207
sampled: 'true',
208+
sample_rand: expect.any(String),
205209
});
206210
},
207211
);
@@ -247,6 +251,7 @@ sentryTest('should add replay_id to error DSC while replay is active', async ({
247251
? {
248252
sample_rate: '1',
249253
sampled: 'true',
254+
sample_rand: expect.any(String),
250255
}
251256
: {}),
252257
});
@@ -267,6 +272,7 @@ sentryTest('should add replay_id to error DSC while replay is active', async ({
267272
? {
268273
sample_rate: '1',
269274
sampled: 'true',
275+
sample_rand: expect.any(String),
270276
}
271277
: {}),
272278
});

dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/meta/template.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<meta name="sentry-trace" content="12312012123120121231201212312012-1121201211212012-1" />
66
<meta
77
name="baggage"
8-
content="sentry-release=2.1.12,sentry-public_key=public,sentry-trace_id=123,sentry-sample_rate=0.3232"
8+
content="sentry-release=2.1.12,sentry-public_key=public,sentry-trace_id=123,sentry-sample_rate=0.3232,sentry-sample_rand=0.42"
99
/>
1010
</head>
1111
</html>

dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/meta/test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ sentryTest(
4343
sample_rate: '0.3232',
4444
trace_id: '123',
4545
public_key: 'public',
46+
sample_rand: '0.42',
4647
});
4748
},
4849
);

dev-packages/browser-integration-tests/suites/tracing/dsc-txn-name-update/test.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ sentryTest('updates the DSC when the txn name is updated and high-quality', asyn
4848
'sentry-environment=production',
4949
'sentry-public_key=public',
5050
'sentry-release=1.1.1',
51+
expect.stringMatching(/sentry-sample_rand=0\.[0-9]+/),
5152
'sentry-sample_rate=1',
5253
'sentry-sampled=true',
5354
`sentry-trace_id=${traceId}`,
@@ -62,6 +63,7 @@ sentryTest('updates the DSC when the txn name is updated and high-quality', asyn
6263
sample_rate: '1',
6364
sampled: 'true',
6465
trace_id: traceId,
66+
sample_rand: expect.any(String),
6567
});
6668

6769
// 4
@@ -73,6 +75,7 @@ sentryTest('updates the DSC when the txn name is updated and high-quality', asyn
7375
'sentry-environment=production',
7476
'sentry-public_key=public',
7577
'sentry-release=1.1.1',
78+
expect.stringMatching(/sentry-sample_rand=0\.[0-9]+/),
7679
'sentry-sample_rate=1',
7780
'sentry-sampled=true',
7881
`sentry-trace_id=${traceId}`,
@@ -89,6 +92,7 @@ sentryTest('updates the DSC when the txn name is updated and high-quality', asyn
8992
sampled: 'true',
9093
trace_id: traceId,
9194
transaction: 'updated-root-span-1',
95+
sample_rand: expect.any(String),
9296
});
9397

9498
// 7
@@ -100,6 +104,7 @@ sentryTest('updates the DSC when the txn name is updated and high-quality', asyn
100104
'sentry-environment=production',
101105
'sentry-public_key=public',
102106
'sentry-release=1.1.1',
107+
expect.stringMatching(/sentry-sample_rand=0\.[0-9]+/),
103108
'sentry-sample_rate=1',
104109
'sentry-sampled=true',
105110
`sentry-trace_id=${traceId}`,
@@ -116,6 +121,7 @@ sentryTest('updates the DSC when the txn name is updated and high-quality', asyn
116121
sampled: 'true',
117122
trace_id: traceId,
118123
transaction: 'updated-root-span-2',
124+
sample_rand: expect.any(String),
119125
});
120126

121127
// 10
@@ -137,6 +143,7 @@ sentryTest('updates the DSC when the txn name is updated and high-quality', asyn
137143
sampled: 'true',
138144
trace_id: traceId,
139145
transaction: 'updated-root-span-2',
146+
sample_rand: expect.any(String),
140147
});
141148

142149
expect(txnEvent.transaction).toEqual('updated-root-span-2');

dev-packages/browser-integration-tests/suites/tracing/envelope-header-transaction-name/test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ sentryTest(
2727
trace_id: expect.stringMatching(/[a-f0-9]{32}/),
2828
public_key: 'public',
2929
sampled: 'true',
30+
sample_rand: expect.any(String),
3031
});
3132
},
3233
);

dev-packages/browser-integration-tests/suites/tracing/envelope-header/test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ sentryTest(
3030
trace_id: expect.stringMatching(/[a-f0-9]{32}/),
3131
public_key: 'public',
3232
sampled: 'true',
33+
sample_rand: expect.any(String),
3334
});
3435
},
3536
);

dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-cls-standalone-spans/test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ sentryTest('captures a "GOOD" CLS vital with its source as a standalone span', a
100100
sample_rate: '1',
101101
sampled: 'true',
102102
trace_id: spanEnvelopeItem.trace_id,
103+
sample_rand: expect.any(String),
103104
// no transaction, because span source is URL
104105
},
105106
});
@@ -167,6 +168,7 @@ sentryTest('captures a "MEH" CLS vital with its source as a standalone span', as
167168
sample_rate: '1',
168169
sampled: 'true',
169170
trace_id: spanEnvelopeItem.trace_id,
171+
sample_rand: expect.any(String),
170172
// no transaction, because span source is URL
171173
},
172174
});
@@ -232,6 +234,7 @@ sentryTest('captures a "POOR" CLS vital with its source as a standalone span.',
232234
sample_rate: '1',
233235
sampled: 'true',
234236
trace_id: spanEnvelopeItem.trace_id,
237+
sample_rand: expect.any(String),
235238
// no transaction, because span source is URL
236239
},
237240
});
@@ -294,6 +297,7 @@ sentryTest(
294297
sample_rate: '1',
295298
sampled: 'true',
296299
trace_id: spanEnvelopeItem.trace_id,
300+
sample_rand: expect.any(String),
297301
// no transaction, because span source is URL
298302
},
299303
});

0 commit comments

Comments
 (0)
0