ReqeustId
fra
HOBBYTop 10% ContributorOP

2 months ago

Hello, I have a quick question about the requestId, let's say that I have a frontend and an api, the user open a page in the frontend, a new railway requestId (1) is created, the frontend send a request to my api server side, will this request have a new requestId or will this be magically preserved when I do the second request or should I manually pass it when I do any request? or probably even better using something like opentelemetry?

Solved$10 Bounty

7 Replies

I’m pretty sure request ID’s are unique to every single request.


It’s an ID for a reason.


https://docs.railway.com/reference/public-networking
You can access the request ID from request headers.


fra
HOBBYTop 10% ContributorOP

2 months ago

the docs say:
X-Railway-Request-Id for correlating requests against network logs.

so in theory (please correct me if I'm wrong) once a requestId is created on the frontend should be forwarded around the services, yet I don't think there is a way to do it in railway, I still think this should be something done in the app


2 months ago

Pepper is correct, a request ID is going to be unique to every single request.


Status changed to Solved brody 2 months ago


jonas-admin
PRO

2 months ago

If you're talking about something like:

  • Client makes request (Request ID: req-1)

  • Client recieves response

  • Client makes another request based on the response (Request ID: req-2)

I think what you mean is you want to correlate the two requests as one whole trace or something similar.

If that is the case, you should handle the correlations within your service instrumentation (with the help of your client-side code). Since the X-Railway-Request-Id is unique for every request, you need to introduce another correlating element (could be a header or something, such as X-Unique-N-Step-Flow-ID) and do the two (or more) requests with the same correlating element.

Depending on how you propagate the request context, the semantic conventions may vary. I do know though that there are risks if you pass the traceparent header in the response and use that to propagate the request context as defined in https://www.w3.org/TR/trace-context/#other-risks which is why I mentioned that you can use another unique correlating ID for this use case.


fra
HOBBYTop 10% ContributorOP

2 months ago

yeah I think I'll just keep my cid header and continue to use it instead of the requestId, mine was just curiosity, many thanks!


Loading...