embrace-android-sdk icon indicating copy to clipboard operation
embrace-android-sdk copied to clipboard

[POC] Span links

Open priettt opened this issue 2 months ago • 0 comments

Goal

This quarter, one of the highlighter team's goals is to show NetworkRequests as spans in the dashboard, under the traces where they happen. Link to ticket

A way of doing that is adding every ongoing span as a Span Link in the network request span.

This PR makes it possible to add span links to every span, and in particular, it adds every ongoing span that doesn't start with "emb-" to the network request spans as a span link.

It's a POC; I'm mainly uploading it to have a working sample of how we could add links, but some things might be wrong.

Considerations

  • We need to update the OTel dependency as links were added in the latest version of the SDK.
  • We should probably add TraceState and TraceFlags to EmbraceSpanContext to be aligned with OTel.
  • We might want to link only the deepest spans of a trace, without the parent spans.
  • I exposed getActiveSpans in the SpanService so that we could get the active spans in the NetworkLoggingService. We might want to expose the active spans in a different way.
  • We should think of a better way to ignore embrace spans than checking if they start with "emb-".
  • We should add tests.

priettt avatar May 07 '24 15:05 priettt