Skip to content

Commit

Permalink
POTEL 58 - Extract OpenTelemetry URL_PATH span attribute into descr…
Browse files Browse the repository at this point in the history
…iption (#3933)

* Extract OTel URL_PATH span attribute into description

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

Co-authored-by: Stefano <stefano.siano@sentry.io>

* changelog

---------

Co-authored-by: Stefano <stefano.siano@sentry.io>
  • Loading branch information
adinauer and stefanosiano authored Nov 27, 2024
1 parent 6de95f1 commit 7c61b46
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Unreleased

### Features

- Extract OpenTelemetry `URL_PATH` span attribute into description ([#3933](https://github.com/getsentry/sentry-java/pull/3933))

## 8.0.0-beta.3

### Features
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,19 @@ private OtelSpanInfo descriptionForHttpMethod(
httpPath = httpTarget;
}
final @NotNull String op = opBuilder.toString();

final @Nullable String urlFull = attributes.get(UrlAttributes.URL_FULL);
if (urlFull != null) {
if (httpPath == null) {
httpPath = urlFull;
}
}

final @Nullable String urlPath = attributes.get(UrlAttributes.URL_PATH);
if (httpPath == null && urlPath != null) {
httpPath = urlPath;
}

if (httpPath == null) {
return new OtelSpanInfo(op, name, TransactionNameSource.CUSTOM);
}
Expand Down

0 comments on commit 7c61b46

Please sign in to comment.