diff --git a/packages/opentelemetry/src/sampler.ts b/packages/opentelemetry/src/sampler.ts index 10be97b0a4bd..d323ca4424e2 100644 --- a/packages/opentelemetry/src/sampler.ts +++ b/packages/opentelemetry/src/sampler.ts @@ -67,8 +67,8 @@ export class SentrySampler implements Sampler { // If we encounter a span emitted by Next.js, we do not want to sample it // The reason for this is that the data quality of the spans varies, it is different per version of Next, // and we need to keep our manual instrumentation around for the edge runtime anyhow. - // BUT we only do this if we don't have a parent span with a sampling decision yet - if (spanAttributes['next.span_type'] && typeof parentSampled !== 'boolean') { + // BUT we only do this if we don't have a parent span with a sampling decision yet (or if the parent is remote) + if (spanAttributes['next.span_type'] && (typeof parentSampled !== 'boolean' || parentContext?.isRemote)) { return { decision: SamplingDecision.NOT_RECORD, traceState: traceState }; }