File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
sentry-opentelemetry/sentry-opentelemetry-core/src/main/java/io/sentry/opentelemetry Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change 11
11
import io .opentelemetry .sdk .trace .samplers .SamplingDecision ;
12
12
import io .opentelemetry .sdk .trace .samplers .SamplingResult ;
13
13
import io .sentry .Baggage ;
14
+ import io .sentry .DataCategory ;
14
15
import io .sentry .IScopes ;
15
16
import io .sentry .PropagationContext ;
16
17
import io .sentry .SamplingContext ;
19
20
import io .sentry .SpanId ;
20
21
import io .sentry .TracesSamplingDecision ;
21
22
import io .sentry .TransactionContext ;
23
+ import io .sentry .clientreport .DiscardReason ;
22
24
import io .sentry .protocol .SentryId ;
23
25
import java .util .List ;
24
26
import org .jetbrains .annotations .NotNull ;
@@ -94,7 +96,18 @@ public SamplingResult shouldSample(
94
96
.getOptions ()
95
97
.getInternalTracesSampler ()
96
98
.sample (new SamplingContext (transactionContext , null ));
97
- // TODO [POTEL] if sampling decision = false, we should record it in client report
99
+
100
+ if (!sentryDecision .getSampled ()) {
101
+ scopes
102
+ .getOptions ()
103
+ .getClientReportRecorder ()
104
+ .recordLostEvent (DiscardReason .SAMPLE_RATE , DataCategory .Transaction );
105
+ scopes
106
+ .getOptions ()
107
+ .getClientReportRecorder ()
108
+ .recordLostEvent (DiscardReason .SAMPLE_RATE , DataCategory .Span );
109
+ }
110
+
98
111
return new SentrySamplingResult (sentryDecision );
99
112
}
100
113
You can’t perform that action at this time.
0 commit comments