Skip to content

OtelSentrySpanProcessorTest #3877

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public final class io/sentry/opentelemetry/OtelSentrySpanProcessor : io/opentele
public final class io/sentry/opentelemetry/OtelSpanContext : io/sentry/SpanContext {
public fun <init> (Lio/opentelemetry/sdk/trace/ReadWriteSpan;Lio/sentry/TracesSamplingDecision;Lio/sentry/opentelemetry/IOtelSpanWrapper;Lio/sentry/SpanId;Lio/sentry/Baggage;)V
public fun getOperation ()Ljava/lang/String;
public fun getSampled ()Ljava/lang/Boolean;
public fun getStatus ()Lio/sentry/SpanStatus;
public fun setOperation (Ljava/lang/String;)V
public fun setStatus (Lio/sentry/SpanStatus;)V
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,17 @@ public void setOperation(@NotNull String operation) {
return StatusCode.ERROR;
}
}

@Override
public @Nullable Boolean getSampled() {
Boolean isSuperSampled = super.getSampled();
if (isSuperSampled != null) {
return isSuperSampled;
}
final @Nullable ReadWriteSpan otelSpan = span.get();
if (otelSpan != null) {
return otelSpan.getSpanContext().isSampled();
}
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ public final class SpanDescriptionExtractor {
final @NotNull SpanData otelSpan, final @Nullable IOtelSpanWrapper sentrySpan) {
final @NotNull Attributes attributes = otelSpan.getAttributes();

final @Nullable String httpMethod = attributes.get(HttpAttributes.HTTP_REQUEST_METHOD);
final @Nullable String httpMethod =
attributes.get(HttpAttributes.HTTP_REQUEST_METHOD) != null
? attributes.get(HttpAttributes.HTTP_REQUEST_METHOD)
: attributes.get(io.opentelemetry.semconv.SemanticAttributes.HTTP_METHOD);
if (httpMethod != null) {
return descriptionForHttpMethod(otelSpan, httpMethod);
}
Expand Down
Loading
Loading