Skip to content
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.

Add a getContext -> SpanContext in the Span #59

Open
bogdandrutu opened this issue Nov 14, 2017 · 1 comment
Open

Add a getContext -> SpanContext in the Span #59

bogdandrutu opened this issue Nov 14, 2017 · 1 comment

Comments

@bogdandrutu
Copy link

bogdandrutu commented Nov 14, 2017

the SpanContext contains the ids that uniquely identify a Span (trace_id, span_id) and the propagated trace options.

Every Span class should have it's own SpanContext:

class Span {
  SpanContext getContext() {
    return my_own_context;
  }
}

We should also remove the context() from the Tracer because that was the incoming SpanContext but when we make a call to a different user we should not use that context we actually should use the SpanContext of the current Span.

=======================   // Client in JS
    Sent.RequestSpanA       // SpanA
=======================
           | here we should have the SpanContext of the "SpanA" that way "SpanB" is a child of "SpanA"
=======================   // Service in PHP
    Recv.RequestSpanB       // SpanB
=======================
    Sent.RequestSpanC       // SpanC
=======================
           | here we should have the SpanContext of the "SpanC" that way "SpanD" is a child of "SpanC"
=======================  // DB in Java
    Recv.RequestSpanA       // SpanD
=======================

If I would have to write an instrumentation using the current API in PHP when I make the call to the DB I would probably propagate the RequestTracer.context(); which actually is the SpanContext of the "SpanA".

@chingor13
Copy link
Member

In the current implementation, RequestTracer::context() is always the current context. This is because the context is managed separately, depending on whether the extension is available or not. If the extension is available, then the extension is responsible for managing the span context. If not, then we manage it in PHP using the static (per request) variables.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants