From 3a340b443333129f4d65721e1789cfb421cafbc2 Mon Sep 17 00:00:00 2001 From: Shruthilaya Jaganathan Date: Fri, 6 Dec 2024 11:12:40 -0500 Subject: [PATCH] chore: Add trace response code to context array --- snuba/datasets/processors/transactions_processor.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/snuba/datasets/processors/transactions_processor.py b/snuba/datasets/processors/transactions_processor.py index cc4f2e4cca9..3b22c653ab7 100644 --- a/snuba/datasets/processors/transactions_processor.py +++ b/snuba/datasets/processors/transactions_processor.py @@ -424,9 +424,14 @@ def _sanitize_contexts( # Only top level scalar values within a context are written to the table. `data` is # always a dict, so pop it from the context and move some values into the top level. transaction_data = transaction_ctx.pop("data", None) or {} - if isinstance(transaction_data, dict) and "thread.id" in transaction_data: - # The thread.id can be either a str/int. Make sure to always convert to a str. - transaction_ctx["thread_id"] = str(transaction_data["thread.id"]) + if isinstance(transaction_data, dict): + if "thread.id" in transaction_data: + # The thread.id can be either a str/int. Make sure to always convert to a str. + transaction_ctx["thread_id"] = str(transaction_data["thread.id"]) + if "http.response.status_code" in transaction_data: + transaction_ctx["http.response.status_code"] = str( + transaction_data["http.response.status_code"] + ) # The hash and exclusive_time is being stored in the spans columns # so there is no need to store it again in the context array.