Hi, dear community,
I have seen few discussions about adding tracing support for Caddy Proxy on GitHub, but I haven’t seen an implementation so far.
I plan to make a PR that will add support for opentelemetry(tracing).
While I was working on the implementation, I’ve found this TODO https://github.com/caddyserver/caddy/blob/2392478bd3cf3e2878b3fa0eac8859a6374e0fa8/modules/caddyhttp/routes.go#L261. This is a good idea because it will allow enabling tracing for every single request in one place. Nevertheless, in my opinion, adding it in the same way as metrics will create a dependency on opentelemetry(or another tracing implementation). In turn, make it “injectable” will require bigger changes to the core functionality.
My idea now is to create an implementation of
caddyhttp.MiddlewareHandler. It will enable tracing on particular handlers and handle a basic tracing configuration, which can be overwritten by ENV variables (defined by opentelemetry specification). So it will be a standalone module that can be chained to the regular HTTP handlers.
Are there any objections/ideas regarding this? If not, I will be happy to create a PR in the next few days for further discussion.
Looking forward to hearing feedback.
Thank you so much for your attention and participation.