X-Request-ID support means that you can easily trace an HTTP request all the way from a client to your backend web processes (via our proxies).

Each time a request is made to your application we will generate a request ID and send it to your application's web processes in the X-Request-ID HTTP header. We will also log this into your proxy logs so you can collelate requests in the proxy to requests to your actual application processes.

Screenshot

Alternatively, you can make your own request ID and send the X-Request-ID header from the client to your application. If you send your own request ID, just be sure that it's between 20 or 200 characters and consists of only letters, numbers and these select symbols (+-/_=). If it does not conform, we will generate a new one for you.

See more about this in our documentation.

Using this with Rails

Rails has built-in support for X-Request-ID. You can automatically tag every log line Rails generates with the request ID. To do this, you simply need to add the following to your config/environments/production.rb file.

config.log_tags = [ :uuid ]

Using with other Rack/Ruby apps

You can access the request ID from your environment hash in any Rack application. For example:

def call(env)
  puts env['HTTP_X_REQUEST_ID']
  ...the rest of your method...
end

Using with PHP

PHP users can simply access the request ID through the $_SERVER hash. We recommend that you use Monolog and add a custom processor to insert the request ID into your logs.

$_SERVER['HTTP_X_REQUEST_ID']

Tell us how you feel about this post?