-
Notifications
You must be signed in to change notification settings - Fork 74
Request IDs
Pedro Belo edited this page Aug 13, 2015
·
6 revisions
Request IDs are a unique identifier associated with every single request your Pliny API receives.
You don't need to do anything to setup or enable Request IDs in your app; they are simply appended to everything logged within that request thanks to log contexts, and available in the Rack environment in case you want to use it (eg: to audit):
post '/users' do
user = Mediator::Users::Creator.run(
email: params[:email],
request_id: env['REQUEST_ID'])
encode(user)
end
They are also rendered to users via the Request-Id
response header so you can quickly trace responses down:
$ curl -v http://localhost:5000
...
< Request-Id: 095dbcd5-a4de-4d2e-a609-fdbe72ca7c01
Pliny also takes request ids supplied by clients, which is crucial to trace workflows in a distributed environment:
$ curl -v -H "Request-Id: d1359391-ecf0-4510-b96d-18edb88c1a31" \
http://localhost:5000
...
< Request-Id: d1359391-ecf0-4510-b96d-18edb88c1a31
Supply request ids to all API requests that you make to facilitate debugging.
Further reading:
Basics
Diving in
- bin/setup
- Config
- CORS
- Endpoints
- Error Handling
- Logging
- Models
- Mediators
- Migrations
- Rake Tasks
- Request IDs
- RequestStore
- Schema
- Serialization
- Testing
- Updating
Guides