Skip to content
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

Do not replace op with auto generated content for OpenTelemetry spans with span kindINTERNAL #3906

Merged
merged 4 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
- Send `otel.kind` to Sentry ([#3907](https://github.com/getsentry/sentry-java/pull/3907))
- Allow passing `environment` to `CheckinUtils.withCheckIn` ([3889](https://github.com/getsentry/sentry-java/pull/3889))

### Fixes

- Do not replace `op` with auto generated content for OpenTelemetry spans with span kind`INTERNAL` ([#3906](https://github.com/getsentry/sentry-java/pull/3906))
adinauer marked this conversation as resolved.
Show resolved Hide resolved

## 8.0.0-beta.2

### Breaking Changes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,23 @@ public final class SpanDescriptionExtractor {
@SuppressWarnings("deprecation")
public @NotNull OtelSpanInfo extractSpanInfo(
final @NotNull SpanData otelSpan, final @Nullable IOtelSpanWrapper sentrySpan) {
final @NotNull Attributes attributes = otelSpan.getAttributes();
if (!isInternalSpanKind(otelSpan)) {
final @NotNull Attributes attributes = otelSpan.getAttributes();

final @Nullable String httpMethod = attributes.get(HttpAttributes.HTTP_REQUEST_METHOD);
if (httpMethod != null) {
return descriptionForHttpMethod(otelSpan, httpMethod);
}
final @Nullable String httpMethod = attributes.get(HttpAttributes.HTTP_REQUEST_METHOD);
if (httpMethod != null) {
return descriptionForHttpMethod(otelSpan, httpMethod);
}

final @Nullable String httpRequestMethod = attributes.get(HttpAttributes.HTTP_REQUEST_METHOD);
if (httpRequestMethod != null) {
return descriptionForHttpMethod(otelSpan, httpRequestMethod);
}
final @Nullable String httpRequestMethod = attributes.get(HttpAttributes.HTTP_REQUEST_METHOD);
if (httpRequestMethod != null) {
return descriptionForHttpMethod(otelSpan, httpRequestMethod);
}

final @Nullable String dbSystem = attributes.get(DbIncubatingAttributes.DB_SYSTEM);
if (dbSystem != null) {
return descriptionForDbSystem(otelSpan);
final @Nullable String dbSystem = attributes.get(DbIncubatingAttributes.DB_SYSTEM);
if (dbSystem != null) {
return descriptionForDbSystem(otelSpan);
}
}

final @NotNull String name = otelSpan.getName();
Expand All @@ -42,6 +44,10 @@ public final class SpanDescriptionExtractor {
return new OtelSpanInfo(name, description, TransactionNameSource.CUSTOM);
}

private boolean isInternalSpanKind(final @NotNull SpanData otelSpan) {
return SpanKind.INTERNAL.equals(otelSpan.getKind());
}

@SuppressWarnings("deprecation")
private OtelSpanInfo descriptionForHttpMethod(
final @NotNull SpanData otelSpan, final @NotNull String httpMethod) {
Expand Down
Loading