Skip to content

Commit c4bc643

Browse files
authored
Merge eaea0dd into 27d7cf8
2 parents 27d7cf8 + eaea0dd commit c4bc643

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
### Miscellaneous
6+
7+
- Collect PerformanceCollectionData only in sampled transactions ([#4834](https://github.com/getsentry/sentry-java/pull/4834))
8+
39
## 8.24.0
410

511
### Features

sentry/src/main/java/io/sentry/SentryTracer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ public SentryTracer(
9090
}
9191

9292
// We are currently sending the performance data only in profiles, but we are always sending
93-
// performance measurements.
94-
if (compositePerformanceCollector != null) {
93+
// performance measurements (frames data in spans).
94+
if (compositePerformanceCollector != null && Boolean.TRUE.equals(isSampled())) {
9595
compositePerformanceCollector.start(this);
9696
}
9797

sentry/src/test/java/io/sentry/SentryTracerTest.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,6 +1175,12 @@ class SentryTracerTest {
11751175
verify(fixture.compositePerformanceCollector).start(anyOrNull<ITransaction>())
11761176
}
11771177

1178+
@Test
1179+
fun `when transaction is created, but not sampled, compositePerformanceCollector is not started`() {
1180+
val transaction = fixture.getSut(samplingDecision = TracesSamplingDecision(false))
1181+
verify(fixture.compositePerformanceCollector, never()).start(anyOrNull<ITransaction>())
1182+
}
1183+
11781184
@Test
11791185
fun `when transaction is created and profiled compositePerformanceCollector is started`() {
11801186
val transaction =

0 commit comments

Comments
 (0)