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 1111import io .opentelemetry .sdk .trace .samplers .SamplingDecision ;
1212import io .opentelemetry .sdk .trace .samplers .SamplingResult ;
1313import io .sentry .Baggage ;
14+ import io .sentry .DataCategory ;
1415import io .sentry .IScopes ;
1516import io .sentry .PropagationContext ;
1617import io .sentry .SamplingContext ;
1920import io .sentry .SpanId ;
2021import io .sentry .TracesSamplingDecision ;
2122import io .sentry .TransactionContext ;
23+ import io .sentry .clientreport .DiscardReason ;
2224import io .sentry .protocol .SentryId ;
2325import java .util .List ;
2426import org .jetbrains .annotations .NotNull ;
@@ -94,7 +96,18 @@ public SamplingResult shouldSample(
9496 .getOptions ()
9597 .getInternalTracesSampler ()
9698 .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+
98111 return new SentrySamplingResult (sentryDecision );
99112 }
100113
You can’t perform that action at this time.
0 commit comments