Commit 51f46b12 authored by Alexandre Vincent's avatar Alexandre Vincent
Browse files

trace data-partition-id even in None case

parent d86f746a
......@@ -91,8 +91,6 @@ class TracingMiddleware(BaseHTTPMiddleware):
ctx_partition_id = get_or_create_ctx().partition_id
partition_id = ctx_partition_id if ctx_partition_id is not None \
else request.headers.get(conf.PARTITION_ID_HEADER_NAME)
# only put in the trace if there is data
if partition_id is not None:
......@@ -88,10 +88,11 @@ def test_about_call_traces_existing_data_partition_id(client: TestClient):
response = client.get(build_url("/about"))
assert response.status_code == 200
# one call was exported, without data-partition-id
# one call was exported, with data-partition-id
assert len(wdms_app.trace_exporter.exported) == 1 # one call => one export
spandata = wdms_app.trace_exporter.exported[0]
assert 'data-partition-id' not in spandata.attributes.keys()
assert 'data-partition-id' in spandata.attributes.keys()
assert spandata.attributes['data-partition-id'] is None
# data-partition-id header -> works as well
client.get(build_url("/about"), headers={'data-partition-id': 'some partition id'})
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment