Skip to content

Commit e68cd64

Browse files
committed
Support HTTP_METHOD and HTTP_REQUEST_METHOD for Otel Spans
1 parent 6de95f1 commit e68cd64

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

sentry-opentelemetry/sentry-opentelemetry-core/src/main/java/io/sentry/opentelemetry/SpanDescriptionExtractor.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,15 @@ public final class SpanDescriptionExtractor {
2121
if (!isInternalSpanKind(otelSpan)) {
2222
final @NotNull Attributes attributes = otelSpan.getAttributes();
2323

24-
final @Nullable String httpMethod = attributes.get(HttpAttributes.HTTP_REQUEST_METHOD);
24+
final @Nullable String httpMethod =
25+
attributes.get(HttpAttributes.HTTP_REQUEST_METHOD) != null
26+
? attributes.get(HttpAttributes.HTTP_REQUEST_METHOD)
27+
: attributes.get(io.opentelemetry.semconv.SemanticAttributes.HTTP_METHOD);
28+
2529
if (httpMethod != null) {
2630
return descriptionForHttpMethod(otelSpan, httpMethod);
2731
}
2832

29-
final @Nullable String httpRequestMethod = attributes.get(HttpAttributes.HTTP_REQUEST_METHOD);
30-
if (httpRequestMethod != null) {
31-
return descriptionForHttpMethod(otelSpan, httpRequestMethod);
32-
}
33-
3433
final @Nullable String dbSystem = attributes.get(DbIncubatingAttributes.DB_SYSTEM);
3534
if (dbSystem != null) {
3635
return descriptionForDbSystem(otelSpan);

0 commit comments

Comments
 (0)