Skip to content
This repository has been archived by the owner on Mar 24, 2021. It is now read-only.

Commit

Permalink
Proxy Request-Id to stagecraft
Browse files Browse the repository at this point in the history
As someone operating a distributed system
I would like to be able to trace a single request through everywhere
So that I have good transparency in how the system behaves
  • Loading branch information
jabley committed Sep 9, 2014
1 parent b0993f2 commit eeb94cc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions backdrop/read/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
app.config['STAGECRAFT_URL'],
app.config['SIGNON_API_USER_TOKEN'],
dry_run=False,
request_id_fn = generate_request_id,
)

DEFAULT_DATA_SET_QUERYABLE = True
Expand Down Expand Up @@ -228,6 +229,10 @@ def fetch(data_set_config):
return response


def generate_request_id():
return request.headers.get('Request-Id')


def start(port):
app.debug = True
app.run(host='0.0.0.0', port=port)
5 changes: 5 additions & 0 deletions backdrop/write/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
app.config['STAGECRAFT_URL'],
app.config['SIGNON_API_USER_TOKEN'],
dry_run=False,
request_id_fn = generate_request_id,
)

log_handler.set_up_logging(app, GOVUK_ENV)
Expand Down Expand Up @@ -276,6 +277,10 @@ def listify_json(data):
return [data]


def generate_request_id():
return request.headers.get('Request-Id')


def start(port):
# this method only gets run on dev
# app.debug = True
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ gunicorn==19.1.1
invoke
isodate==0.5.0
jsonschema==2.4
performanceplatform-client==0.0.8
performanceplatform-client==0.0.9
pip==1.5.6
pymongo==2.7.2
python-dateutil==2.2
Expand Down

0 comments on commit eeb94cc

Please sign in to comment.