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

ochttp public traceparent/tracestate marshal/unmarshal #1208

Closed
slinkydeveloper opened this issue Apr 27, 2020 · 2 comments · Fixed by #1218
Closed

ochttp public traceparent/tracestate marshal/unmarshal #1208

slinkydeveloper opened this issue Apr 27, 2020 · 2 comments · Fixed by #1218

Comments

@slinkydeveloper
Copy link
Contributor

NB: Before opening a feature request against this repo, consider whether the feature should/could be implemented in OpenCensus libraries in other languages. If so, please open an issue on opencensus-specs first.

Is your feature request related to a problem? Please describe.
I wish to read and write traceparent/tracestate, encoded using trace context, without passing an http.Request

Describe the solution you'd like
Two new methods should be added to HttpFormat or as public functions:

SpanContextFromHeaders(traceparent string, tracestate string) (sc trace.SpanContext, ok bool)
SpanContextToRequest(sc trace.SpanContext) (traceparent string, tracestate string)

Describe alternatives you've considered
AFAIK no alternatives are available in this library, except copy pasting that code in my own code.

@llhhbc
Copy link

llhhbc commented May 28, 2020

This method has already has in package: go.opencensus.io/plugin/ochttp/propagation/b3

HTTPFormat{}

func (f *HTTPFormat) SpanContextFromRequest(req *http.Request) (sc trace.SpanContext, ok bool)

func (f *HTTPFormat) SpanContextToRequest(sc trace.SpanContext, req *http.Request)

@slinkydeveloper
Copy link
Contributor Author

What I mean is that I want to extract manually the traceparent/tracestate headers and then i want to pass them to a method, while these two methods interacts already with http request

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

Successfully merging a pull request may close this issue.

2 participants