Tracing requests


We would like to send tracing data from our Cloudflare requests to our OpenTelemetry endpoint, so we can benefit from distributed tracing up to the CDN level.

We’ve been looking into doing that with workers, but the unreliability of time in there makes it impossible to compute the duration of a request. The lack of full npm packages support also prevents us from using well-known packages.

We’re looking into using logpush to create traces with the request ID you provide, as well as using that request ID as our parent span in underlying components. But that feels quite hacky, and we’d love it if there were a better solution.

Would you have any recommendation for us there?

Not sure whether creating a request header in Transform Rules can help?

I suppose a custom HTTP header using custom rules would allow us to pass the request ID as a traceparent HTTP header, and make it easier to get the parent span’s ID within our own components.

We’d still have to listen on logpush to create the actual spans, which is quite tedious when it could be so simple using workers.