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

How to add B3-headers to an inbound request and response? #213

Open
ilya-chumakov opened this issue Jul 11, 2018 · 7 comments
Open

How to add B3-headers to an inbound request and response? #213

ilya-chumakov opened this issue Jul 11, 2018 · 7 comments

Comments

@ilya-chumakov
Copy link

ilya-chumakov commented Jul 11, 2018

Hello, I'm trying zipkin4net 1.2.1 in a .Net Core 2.1 WebAPI app.

I expected that UseTracingMiddleware would add tracing headers to HttpContext.Request and HttpContext.Response for an inbound request. However, it seems the middleware just make calls to a Zipkin instance.

Should I add the tracing headers to the request/response manually? How to get a correct TraceId in that case?

@fedj
Copy link
Collaborator

fedj commented Jul 11, 2018

Hi @ilya-chumakov,

Did you see https://github.com/openzipkin/zipkin4net/blob/master/Examples/aspnetcore/frontend/Startup.cs#L19 ? Basically, you need to pass a TracingHandler to HTTP clients in order for them to forward traces.

@codefromthecrypt
Copy link
Member

codefromthecrypt commented Jul 11, 2018 via email

@ilya-chumakov
Copy link
Author

ilya-chumakov commented Jul 11, 2018

@fedj yes, I did. TracingHandler is for outbound requests, isn't it? I want to modify an inbound one. Let's say that there is only a WebAPI app which doesn't make any external HTTP calls. This app is called by someone, but it is not possible to force every caller to fill these headers.

@adriancole I would like to give the users (i.e. who calls our APIs) a kind of "request id". They could return it back to us in case of a problem happened. How else could I achieve that without response headers propagation?

@codefromthecrypt
Copy link
Member

codefromthecrypt commented Jul 11, 2018 via email

@ilya-chumakov
Copy link
Author

ilya-chumakov commented Jul 12, 2018

@adriancole thanks, I unsuccessfully have tried that gitter channel before posting here :)

If I'm going to create a middleware filling the headers with a tracing context manually and put it before UseTracingMiddleware, could you show me an example or class helper to start from?

@codefromthecrypt
Copy link
Member

codefromthecrypt commented Jul 12, 2018 via email

@fedj
Copy link
Collaborator

fedj commented Jul 20, 2018

The middleware is located in https://github.com/openzipkin/zipkin4net/blob/8e73b3c93ef0e9b661ca3aae89d70c423abf9775/Src/zipkin4net.middleware.aspnetcore/Src/TracingMiddleware.cs

You would need to Inject B3 headers using the Propagations.B3String.Injector

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

No branches or pull requests

3 participants