Skip to content

Commit 86712d9

Browse files
authored
perf: remove unecessary spans for json (#70447)
We don't need to trace JSON deserialization cost since creating spans has a cost as well.
1 parent 2136ed2 commit 86712d9

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

src/sentry/ingest/consumer/processors.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,8 +304,7 @@ def process_individual_attachment(message: IngestMessage, project: Project) -> N
304304
@metrics.wraps("ingest_consumer.process_userreport")
305305
def process_userreport(message: IngestMessage, project: Project) -> bool:
306306
start_time = to_datetime(message["start_time"])
307-
with sentry_sdk.start_span(op="sentry.utils.json.loads"):
308-
feedback = orjson.loads(message["payload"])
307+
feedback = orjson.loads(message["payload"])
309308

310309
try:
311310
save_userreport(

src/sentry/sentry_metrics/consumers/indexer/batch.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,7 @@ def _extract_message(
168168
) -> ParsedMessage:
169169
assert isinstance(msg.value, BrokerValue)
170170
try:
171-
with sentry_sdk.start_span(op="sentry.utils.json.loads"):
172-
parsed_payload: ParsedMessage = orjson.loads(msg.payload.value.decode())
171+
parsed_payload: ParsedMessage = orjson.loads(msg.payload.value)
173172
except orjson.JSONDecodeError:
174173
logger.exception(
175174
"process_messages.invalid_json",

src/sentry/snuba/tasks.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,7 @@ def _create_snql_in_snuba(subscription, snuba_query, snql_query, entity_subscrip
262262
metrics.incr("snuba.snql.subscription.http.error", tags={"dataset": snuba_query.dataset})
263263
raise SnubaError("HTTP %s response from Snuba!" % response.status)
264264

265-
with sentry_sdk.start_span(op="sentry.utils.json.loads"):
266-
return orjson.loads(response.data)["subscription_id"]
265+
return orjson.loads(response.data)["subscription_id"]
267266

268267

269268
def _delete_from_snuba(dataset: Dataset, subscription_id: str, entity_key: EntityKey) -> None:

0 commit comments

Comments
 (0)