Tracing requests

Hi,

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.

We would like to see CF support traceparent as a first-party feature. We cannot use transform rules (it’s impossible to format it correctly), and ideally we are using the rayid to generate this trace, and also respecting if the request already had trace headers on it. OTEL push for the span itself would also be GOLD.