unit icon indicating copy to clipboard operation
unit copied to clipboard

Variables: add request_id

Open icy opened this issue 2 years ago • 3 comments

Hi team,

In our nginx setup, we are using request_id for tracing purpose . This is an embedded variable as documented here https://nginx.org/en/docs/http/ngx_http_core_module.html#variables. The setting is done thanks to fastcgi setting as below

# nginx.conf
fastcgi_param       HTTP_X_REQUEST_ID   $request_id;

My question is how we can get a similar thing with unit configuration?

Thanks for your reading and support.

icy avatar Jun 03 '22 08:06 icy

Hello!

How do you use this variable end-to-end? Presumably you also log this variable in the access log for correlation purposes? Or does it end up somewhere else?

lcrilly avatar Jun 03 '22 15:06 lcrilly

Hello!

How do you use this variable end-to-end? Presumably you also log this variable in the access log for correlation purposes? Or does it end up somewhere else?

We are using Symfony + Newrelic integration. Though I don't really get all details how it's exactly working, I think our developers are using HTTP_X_REQUEST_ID header value (which is $request_id) as Newrelic tracing ID.

Fyi, the Symfony project seems not to get a final resolution (discussed in https://github.com/symfony/symfony/issues/11573 ). There are some patches, but I think it's great if unit can support $request_id out of the box.

icy avatar Jun 03 '22 20:06 icy

Thanks for making this clear. It will be generally possible to create a request_id and add it to the application context so it will be accessible from inside your PHP application.

As a request ID should be a secure random the implementation need some architectural design work first. I will mark this as enhancement and look how it will fit in the roadmap / next releases.

tippexs avatar Jun 17 '22 14:06 tippexs