0

I am new to istio, and I am trying to setup the tracing, but can't make it work. Then I logged the trace headers in my service, I fount that the x-b3-sampled is awlays zero

x-request-id:e1a8e4f3-5256-9e43-b571-a9c8a4c93db7, x-b3-traceid:b2328351dbb2f95fd0ec782c5103f1c1, x-b3-spanid:a6ef2135d03fac8a, x-b3-parentspanid:d0ec782c5103f1c1, x-b3-sampled:0, x-b3-flags:null, x-ot-span-context:null This is what the service log printed.

I've set the sampling to 100

tracing:
 sampling: 100
 zipkin:
  address: zipkin.istio-system:9411

Anyone knows the reason, or how can I work it out?

Chunsen
  • 13
  • 2
  • you would need to show your code, not your tracing config. how are you handling these headers? – suren Jan 30 '21 at 12:36
  • @suren I did not handle any of these headers, it is the first service which I print those logs, just `istio_gateway -> my_service`. That means, `x-b3-sampled:0` is generated by the istio proxy, I think. – Chunsen Jan 31 '21 at 16:16
  • you need to generate these headers and pass from one service to another from your code. – suren Jan 31 '21 at 17:34
  • https://istio.io/latest/docs/tasks/observability/distributed-tracing/overview/#trace-context-propagation. **To do this, an application needs to collect and propagate the following headers from the incoming request to any outgoing requests**. As the document says, I just need to pass it to the outgoing requests, – Chunsen Feb 01 '21 at 01:37
  • `I fount that the x-b3-sampled is always zero`, even in [bookinfo application](https://istio.io/latest/docs/examples/bookinfo/)? Do you use ingress controller or istio ingress gateway? As per the headers I agree with @suren, when using the Zipkin tracer, Envoy relies on the **service** to propagate the B3 HTTP headers. It's better described in envoy documentation [here](https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/observability/tracing#trace-context-propagation). Also take a look [here](https://github.com/openzipkin/b3-propagation). – Jakub Feb 01 '21 at 11:28
  • actually, `X-B3-Sampled` is not always zero. Usually it's 1. – suren Feb 02 '21 at 17:19

0 Answers0