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

Assume http.client for span op if not a root span #4257

Merged
merged 3 commits into from
Mar 14, 2025

Conversation

adinauer
Copy link
Member

📜 Description

When extracting span description, assume it's http.client if the span is not a root span (invalid or remote parent).

💡 Motivation and Context

Fixes #3904

💚 How did you test it?

📝 Checklist

  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.

🔮 Next steps

Sorry, something went wrong.

Verified

This commit was signed with the committer’s verified signature.
adamreichold Adam Reichold
Copy link
Contributor

github-actions bot commented Mar 13, 2025

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 385.78 ms 418.76 ms 32.98 ms
Size 1.58 MiB 2.21 MiB 642.34 KiB

Previous results on branch: fix/assume-http-client-if-not-root-span

Startup times

Revision Plain With Sentry Diff
b7b8293 384.81 ms 409.82 ms 25.01 ms

App size

Revision Plain With Sentry Diff
b7b8293 1.58 MiB 2.21 MiB 642.38 KiB

Copy link
Member

@lcian lcian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@@ -18,23 +18,16 @@ public final class SpanDescriptionExtractor {
@SuppressWarnings("deprecation")
public @NotNull OtelSpanInfo extractSpanInfo(
final @NotNull SpanData otelSpan, final @Nullable IOtelSpanWrapper sentrySpan) {
if (!isInternalSpanKind(otelSpan)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you explain why we removed this check?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem we had before (see #3904) was that when span kind was set to neither CLIENT nor SERVER we would generate http as op (without .client or .server suffix).

The default span kind is INTERNAL. So if a customer manually instruments using OTel, doesn't set span kind and has HTTP span attributes set, the SpanDescriptionExtractor wouldn't know whether it's an incoming or outgoing request.

Having this check in place would prevent the changes in this PR from taking effect.

Copy link
Collaborator

@lbloder lbloder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@adinauer adinauer merged commit e5e6905 into main Mar 14, 2025
35 checks passed
@adinauer adinauer deleted the fix/assume-http-client-if-not-root-span branch March 14, 2025 10:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OpenTelemetry spans appearing with op http missing .client / .server
3 participants