Skip to content

Commit 3f62f43

Browse files
Updating querystring for logging. (#209)
* Updating querystring for logging. Use of 'dict' resulted in hundreds of additional columns to log schema. Wrapping the 'dict' in a 'str' converts the querystring from a RECORD in BQ to a STRING. * Updating tests
1 parent b171dae commit 3f62f43

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

jbi/log.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def format_request_summary_fields(
5454
"path": request.url.path,
5555
"method": request.method,
5656
"lang": request.headers.get("Accept-Language"),
57-
"querystring": dict(request.query_params),
57+
"querystring": str(dict(request.query_params)),
5858
"errno": 0,
5959
"t": int((current_time - request_time) * 1000.0),
6060
"time": datetime.fromtimestamp(current_time).isoformat(),

tests/unit/test_main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def test_request_summary_is_logged(caplog):
1919
assert summary.name == "request.summary"
2020
assert summary.method == "GET"
2121
assert summary.path == "/"
22-
assert summary.querystring == {}
22+
assert summary.querystring == "{}"
2323

2424

2525
def test_errors_are_reported_to_sentry(

0 commit comments

Comments
 (0)