envoy icon indicating copy to clipboard operation
envoy copied to clipboard

zipkin tracing: support to make the envoy as the independent hop for tracing

Open wbpcode opened this issue 3 years ago • 16 comments

Commit Message: zipkin tracing: support to make the envoy as the independent hop for tracing

Additional Description:

In the previous implementation of zipkin tracer, the inbound envoy will generates server span and the outbound envoy will generates client span. By this way, in the sidecar mode, envoy is treated as part of the app. But in the gateway mode, the zipkin couldn't work correctly.

This PR added a new option to make the envoy worked as independent hop for zipkin tracing. In this new implementation, envoy can work correctly in both sidecar mode and gateway mode.

And this PR will close #22944.

Risk Level: Low, zipkin only updates. Testing: Unit tests. Docs Changes: n/a. Release Notes: Added Platform Specific Features: n/a.

wbpcode avatar Sep 05 '22 09:09 wbpcode

CC @envoyproxy/api-shepherds: Your approval is needed for changes made to (api/envoy/|docs/root/api-docs/). envoyproxy/api-shepherds assignee is @adisuissa CC @envoyproxy/api-watchers: FYI only for changes made to (api/envoy/|docs/root/api-docs/).

:cat:

Caused by: https://github.com/envoyproxy/envoy/pull/22987 was opened by wbpcode.

see: more, trace.

cc @mattklein123 @kyessenov

wbpcode avatar Sep 05 '22 09:09 wbpcode

/retest

wbpcode avatar Sep 06 '22 12:09 wbpcode

Retrying Azure Pipelines: Retried failed jobs in: envoy-presubmit

:cat:

Caused by: a https://github.com/envoyproxy/envoy/pull/22987#issuecomment-1238107226 was created by @wbpcode.

see: more, trace.

/retest

wbpcode avatar Sep 07 '22 04:09 wbpcode

Retrying Azure Pipelines: Retried failed jobs in: envoy-presubmit

:cat:

Caused by: a https://github.com/envoyproxy/envoy/pull/22987#issuecomment-1238880027 was created by @wbpcode.

see: more, trace.

friendly ping @adisuissa

wbpcode avatar Sep 13 '22 01:09 wbpcode

High-level question: is it correct to think that this flag should be true by default? (i.e., if we were to have a runtime guard around it, will it make sense to have it set to true eventually)

IMO, it should be true. But I am afraid there will be many users will be affected. I'm not sure if many people have gotten used to the original model.

wbpcode avatar Sep 15 '22 01:09 wbpcode

It is still somewhat not clear to me and could be due to my misunderstanding of zipkin and tracing. Is this field separating server and client spans?

In the privious implementation, the zinkin tracer create only one span (server span for inbound, client span for outbound) for a request. The inbound proxy and outbond proxy constitute a complete span pair.

This implementation couldn't work properly in gateway mode. And if inbound traffic routing or outbound traffic routing is disabled, the trace chain couldn't be generated correctly.

And in the new implementaion, if the independent_proxy is set to true (and start child span should be set to true also), the inbound proxy will create a complete span pair for a request independently. The outbound proxy will create a complete span pair indepentdently also. Inbound proxy and outbound proxy will no longer be bound.

wbpcode avatar Sep 15 '22 02:09 wbpcode

friendly ping @adisuissa

wbpcode avatar Sep 20 '22 13:09 wbpcode

the previous assign is failed 🤣

wbpcode avatar Sep 20 '22 13:09 wbpcode

the previous assign is failed 🤣

wbpcode avatar Sep 20 '22 13:09 wbpcode

In the privious implementation, the zinkin tracer create only one span (server span for inbound, client span for outbound) for a request. The inbound proxy and outbond proxy constitute a complete span pair.

This implementation couldn't work properly in gateway mode. And if inbound traffic routing or outbound traffic routing is disabled, the trace chain couldn't be generated correctly.

And in the new implementaion, if the independent_proxy is set to true (and start child span should be set to true also), the inbound proxy will create a complete span pair for a request independently. The outbound proxy will create a complete span pair indepentdently also. Inbound proxy and outbound proxy will no longer be bound.

Thanks for the explanation. In this case, the name of the field could probably be improved to explain this behavior. Something in the lines of split_in_out_spans or something that explains what this function does would improve the usability of this feature. I would suggest adding when the value should be set (i.e., when the proxy is used as a gateway) in the comments.

adisuissa avatar Sep 20 '22 14:09 adisuissa

In the privious implementation, the zinkin tracer create only one span (server span for inbound, client span for outbound) for a request. The inbound proxy and outbond proxy constitute a complete span pair. This implementation couldn't work properly in gateway mode. And if inbound traffic routing or outbound traffic routing is disabled, the trace chain couldn't be generated correctly. And in the new implementaion, if the independent_proxy is set to true (and start child span should be set to true also), the inbound proxy will create a complete span pair for a request independently. The outbound proxy will create a complete span pair indepentdently also. Inbound proxy and outbound proxy will no longer be bound.

Thanks for the explanation. In this case, the name of the field could probably be improved to explain this behavior. Something in the lines of split_in_out_spans or something that explains what this function does would improve the usability of this feature. I would suggest adding when the value should be set (i.e., when the proxy is used as a gateway) in the comments.

Got it. I will update it tomorrow.

wbpcode avatar Sep 20 '22 14:09 wbpcode

@envoyproxy/envoy-maintainers assignee is @adisuissa

:cat:

Caused by: a https://github.com/envoyproxy/envoy/pull/22987#pullrequestreview-1116295179 was submitted by @adisuissa.

see: more, trace.

@envoyproxy/senior-maintainers assignee is @lizan

:cat:

Caused by: a https://github.com/envoyproxy/envoy/pull/22987#pullrequestreview-1117494167 was submitted by @adisuissa.

see: more, trace.