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

Return x-b3-trace id in response #9243

Closed
bluetechy opened this issue Dec 5, 2019 · 9 comments
Closed

Return x-b3-trace id in response #9243

bluetechy opened this issue Dec 5, 2019 · 9 comments
Labels
area/tracing question Questions that are neither investigations, bugs, nor enhancements

Comments

@bluetechy
Copy link
Contributor

bluetechy commented Dec 5, 2019

Description:

Since Zipkin's Lens UI allows one to search on the trace id, it would be helpful if there was a flag in envoy's typed_config to include in the response header the x-b3-traceid, such as return_trace_id: true (similar to the generate_request_id: true flag).

For example:

tracing:
    http:
        name: envoy.zipkin
        typed_config:
            "@type": type.googleapis.com/envoy.config.trace.v2.ZipkinConfig
            return_trace_id: true
            collector_cluster: zipkin-svc
            collector_endpoint: "/api/v1/spans"

Or alternatively in the tracing object:

                    - name: envoy.http_connection_manager
                      typed_config:
                          "@type": type.googleapis.com/envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager
                          generate_request_id: true
                          tracing:
                              operation_name: egress
                              return_trace_id: true

so that it could be used to search here:

Screen Shot 2019-12-05 at 1 52 03 PM

Relevant Links:

@dio
Copy link
Member

dio commented Dec 5, 2019

@bluetechy I'm wondering if response_headers_to_add is sufficient for this case:

e.g.

Tried adding it in: examples/zipkin-tracing/front-envoy-zipkin.yaml.

             name: local_route
             virtual_hosts:
             - name: backend
+              response_headers_to_add:
+                - header:
+                    key: x-b3-traceid
+                    value: "%REQ(x-b3-traceid)%"
               domains:
               - "*"
               routes:
$ # in examples/zipkin-tracing
$ docker-compose up -d
$ curl -I localhost:8000/trace/2
HTTP/1.1 200 OK
content-type: text/html; charset=utf-8
content-length: 89
server: envoy
date: Thu, 05 Dec 2019 21:35:54 GMT
x-envoy-upstream-service-time: 14
x-b3-traceid: a1f1fc48e8599203

image

@bluetechy
Copy link
Contributor Author

@dio Yes, I would think that would work nicely. Is value: "%REQ(x-b3-traceid)%" currently supported as I just tried it locally and my pod crashed? If it is, I will double-check my yaml then to figure out if I got a yaml error or not.

@dio
Copy link
Member

dio commented Dec 5, 2019

@bluetechy mind to share your envoy version?

@dio dio added area/tracing question Questions that are neither investigations, bugs, nor enhancements labels Dec 5, 2019
@bluetechy
Copy link
Contributor Author

@dio Yes, sorry....I should have included my version in my last question to you. Here you go:

Screen Shot 2019-12-05 at 3 58 38 PM

@bluetechy
Copy link
Contributor Author

@dio Just came across this issue (#8683) which looks to discuss this same syntax.

@dio
Copy link
Member

dio commented Dec 5, 2019

Yeap. You can use envoyproxy/envoy-dev:latest if you are OK with that. 😉

@dio
Copy link
Member

dio commented Dec 6, 2019

Since it seems it is answered, I'm closing this.

@dio dio closed this as completed Dec 6, 2019
@bluetechy
Copy link
Contributor Author

bluetechy commented Dec 6, 2019

@dio I can confirm it does work using envoyproxy/envoy-dev:latest so thank you for the excellent help. It would be nice that once this is released that the example above that you provided is added to examples/zipkin-tracing/front-envoy-zipkin.yaml. These would be the headers I think are most important:

                                    response_headers_to_add:
                                        - header:
                                              key: "x-b3-traceid"
                                              value: "%REQ(x-b3-traceid)%"
                                        - header:
                                              key: "x-request-id"
                                              value: "%REQ(x-request-id)%"

@dio
Copy link
Member

dio commented Dec 6, 2019

@bluetechy, sure! Thanks for confirming. To make it available in the example, I think you can send out a PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/tracing question Questions that are neither investigations, bugs, nor enhancements
Projects
None yet
Development

No branches or pull requests

2 participants