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

POTEL 3 - Use OpenTelemetry in Sentry Performance API #3416

Open
wants to merge 2 commits into
base: feat/potel-2-promote-span-attributes
Choose a base branch
from

Conversation

adinauer
Copy link
Member

📜 Description

💡 Motivation and Context

💚 How did you test it?

📝 Checklist

  • I reviewed the submitted code.
  • 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.
  • 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

Copy link
Contributor

github-actions bot commented May 13, 2024

Fails
🚫 Please consider adding a changelog entry for the next release.
Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Instructions and example for changelog

Please add an entry to CHANGELOG.md to the "Unreleased" section. Make sure the entry includes this PR's number.

Example:

## Unreleased

- POTEL 3 - Use OpenTelemetry in Sentry Performance API ([#3416](https://github.com/getsentry/sentry-java/pull/3416))

If none of the above apply, you can opt out of this check by adding #skip-changelog to the PR description.

Generated by 🚫 dangerJS against 0f22adb

@@ -196,4 +200,14 @@ public void setAppStartTransaction(final boolean appStartTransaction) {
public boolean isAppStartTransaction() {
return isAppStartTransaction;
}

@ApiStatus.Internal
public @Nullable ISpanFactory getSpanFactory() {
Copy link
Member Author

Choose a reason for hiding this comment

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

This is required to override the span factory when creating Sentry transactions in OTel SpanExporter to avoid endless loops.

Copy link
Contributor

github-actions bot commented May 13, 2024

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 398.25 ms 477.15 ms 78.90 ms
Size 1.70 MiB 2.28 MiB 596.83 KiB

Baseline results on branch: feat/potel-2-promote-span-attributes

Startup times

Revision Plain With Sentry Diff
9cd6181 376.73 ms 459.41 ms 82.67 ms
9fdb8b8 365.10 ms 449.87 ms 84.77 ms

App size

Revision Plain With Sentry Diff
9cd6181 1.70 MiB 2.28 MiB 596.17 KiB
9fdb8b8 1.70 MiB 2.28 MiB 596.01 KiB

Previous results on branch: feat/potel-3-use-otel-in-sentry-api

Startup times

Revision Plain With Sentry Diff
0978e3b 424.86 ms 519.90 ms 95.04 ms

App size

Revision Plain With Sentry Diff
0978e3b 1.70 MiB 2.28 MiB 596.24 KiB

@NotNull IScopes scopes,
@NotNull SpanOptions spanOptions,
@Nullable ISpan parentSpan) {
// TODO [POTEL] forward to SentryTracer.createChild?
Copy link
Collaborator

Choose a reason for hiding this comment

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

In case of DefaultSpanFactory, couldn't we just call parentSpan.createChild() ?

final @NotNull IScopes scopes,
final @NotNull SpanOptions spanOptions,
final @Nullable ISpan parentSpan) {
final @NotNull SpanBuilder spanBuilder = getTracer().spanBuilder(name);
Copy link
Collaborator

Choose a reason for hiding this comment

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

TODO: forward sampling decision to OTEL

}
// TODO [POTEL] start timestamp
final @NotNull Span span = spanBuilder.startSpan();
return new OtelSpanWrapper(span, scopes);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't we be able to read the OtelSpanWrapper from the spanStorage at this point?
As spanBuilder.startSpan() calls spanProcessor.onStart() before returning the span.


@Override
public void setDescription(@Nullable String description) {
// TODO [POTEL] need to find a way to transfer data from this wrapper to SpanExporter
Copy link
Collaborator

Choose a reason for hiding this comment

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

Possibly in SentrySpanExporter.createAndFinishSpanForOtelSpan() if the wrapper is stored in SentryWeakSpanStorage

// TODO [POTEL] should check if enabled but multi init with different options makes testing hard
// atm
// if (scopes.getOptions().isEnableSpotlight()) {
final @Nullable String spotlightUrl = scopes.getOptions().getSpotlightConnectionUrl();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe something like this for a little less nesting?

    final @Nullable String optionsSpotlightUrl = scopes.getOptions().getSpotlightConnectionUrl();
    final @NotNull String spotlightUrl = optionsSpotlightUrl != null ? optionsSpotlightUrl : "http://localhost:8969/stream";
    
    if(containsSpotlightUrl(fullUrl, spotlightUrl)) {
      return true;
    }
    
    if(containsSpotlightUrl(httpUrl, spotlightUrl)) {
      return true;
    }

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.

None yet

2 participants