App-wide vs. Handler-specific environments in Haskell's Servant
See files:
Client requests:
curl -XGET \
-H 'Authorization: TAEKcxpJndhfFaWqDIHgC' \
-H 'traceparent: 208327fb-d2ca-473f-9e15-85ce49db7493' \
'http://localhost:3000/v1/tickets/358541f0-15ad-4149-859c-2dc4654d46bf'
curl -XGET \
-H 'Authorization: TAEKcxpJndhfFaWqDIHgC' \
'http://localhost:3000/v1/tickets/7bc52df6-24ee-490c-8b3b-cc1ffcbf65f7'
Server logs (Bad):
# Server startup
# (nothing)
# Request 1
[Info] Created new database connection pool of size 10 for app:app@localhost:5432/app
[Info] Created new HTTP client manager with number of connections kept-alive per host of 20
[Info] Using existing trace ID 208327fb-d2ca-473f-9e15-85ce49db7493
[Info] Authenticated user with ID d42ed530-adba-41f0-99af-60bd6c476617
# Request 2
[Info] Created new database connection pool of size 10 for app:app@localhost:5432/app
[Info] Created new HTTP client manager with number of connections kept-alive per host of 20
[Info] Generating new trace ID 849a577b-7137-4738-9314-3bf9658d883d
[Info] Authenticated user with ID d42ed530-adba-41f0-99af-60bd6c476617
Server logs (Good):
# Server startup
[Info] Created new database connection pool of size 10 for app:app@localhost:5432/app
[Info] Created new HTTP client manager with number of connections kept-alive per host of 20
# Request 1
[Info] Using existing trace ID 208327fb-d2ca-473f-9e15-85ce49db7493
[Info] Authenticated user with ID d42ed530-adba-41f0-99af-60bd6c476617
# Request 2
[Info] Generating new trace ID 849a577b-7137-4738-9314-3bf9658d883d
[Info] Authenticated user with ID d42ed530-adba-41f0-99af-60bd6c476617