apache / apisix

The Cloud-Native API Gateway
https://apisix.apache.org/blog/
Apache License 2.0
14.3k stars 2.49k forks source link

Plugin interaction and SkyWalking native log format with trace context #4232

Open wu-sheng opened 3 years ago

wu-sheng commented 3 years ago

@dmsolr @moonming I want to discuss an enhancement feature for APISIX ecosystem about observability.

SkyWalking built its native tracer implementation for Nginx and APISIX, so we have this, http://apisix.apache.org/docs/apisix/plugins/skywalking/. Which supports tracing and backed by OAP's analysis capability, we have topology with metrics about traffic.

Now, with the latest SkyWalking's log analyzer, we should consider looping logs in. So 2 questions should be answered

  1. Could 2 plugins interact with each other? If so, how.
  2. Does APISIX want to adopt SkyWalking native log format? https://github.com/apache/skywalking-data-collect-protocol/blob/master/logging/Logging.proto Although APISIX is only good at HTTP+JSON, so we could leverage satellite to forward, but it is better to add a native gRPC reporter into satellite

If you feel interests, let's work on this together.

wu-sheng commented 3 years ago

I know we talked about ALS, which could be another separate feature. As general logs are more flexible, ALS is focusing on topology and traffic metrics analysising.

dmsolr commented 3 years ago
  1. plugins interact means passing trace context in the scope of a request. We can use ngx.ctx to propagate it.
  2. I think it is good to adopt SkyWalking native log format when skywalking tracer plugin was enabled.
wu-sheng commented 3 years ago

plugins interact means passing trace context in the scope of a request. We can use ngx.ctx to propagate it.

Yes, it could be, but we should take care of the priority and execution sequence.

wu-sheng commented 3 years ago

I think it is good to adopt SkyWalking native log format when skywalking tracer plugin was enabled.

I think we could include it in skywalking-nginx-lua repo if that makes senses to APISIX community.

dmsolr commented 2 years ago

APISIX has supported reporting access-log with trace context and error-log to SkyWalking by #5478 and #4633. So, I think this issue could be closed.

wu-sheng commented 2 years ago

I think (1) is not supported? Do we skip it?

dmsolr commented 2 years ago

We can get tracing_context in other plugins by ngx.ctx.tracing_context. So I think (1) is supported as well. I will submit a PR to add some explanations to the related document.

wu-sheng commented 2 years ago

Thanks, look forward to that.