Nordstrom / ctrace-go

Canonical OpenTracing for GoLang
Apache License 2.0
12 stars 6 forks source link

Need a way to get Trace ID #3

Open govindchowdhari opened 7 years ago

govindchowdhari commented 7 years ago

API(s) error message, in case of 4xx and 5xx, to clients includes a TraceContextId so that clients can get trace error details using the TraceContextId.

Usually, this TraceContextId is passed from client as a request header and appended to it's own trace id by server.

I would be great if ctrace can provision a method to return trace id of current tracer.

andyday commented 7 years ago

Here's my idea for this:

  1. Create a public SpanContext that implements opentracing.SpanContext
  2. Have span.context() return this instead of opentracing.SpanContext (this will break the opentracing.Span interface so maybe create span.correlation() which returns ctrace.SpanContext or ctrace.Corrolation (which contains TraceID and SpanID).
  3. Above these measures, have the chttp.TracedHandler add the TraceID and SpanID to the response headers using tracer.inject()
andyday commented 7 years ago

I'll be formalizing ID Access in the ctrace spec. For go, we should do the following: