Skip to content

Commit

Permalink
ref: Simplify querylog processor more (#4520)
Browse files Browse the repository at this point in the history
  • Loading branch information
lynnagara authored Jul 18, 2023
1 parent 2a49c60 commit 17d74b9
Showing 1 changed file with 3 additions and 16 deletions.
19 changes: 3 additions & 16 deletions snuba/datasets/processors/querylog_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@
from typing import Any, Mapping, Optional, Sequence, Union

import simplejson as json
from sentry_kafka_schemas.schema_types.snuba_queries_v1 import (
ClickhouseQueryProfile,
Querylog,
QueryMetadata,
)
from sentry_kafka_schemas.schema_types.snuba_queries_v1 import Querylog, QueryMetadata

from snuba import environment
from snuba.consumers.types import KafkaMessageMetadata
Expand Down Expand Up @@ -75,22 +71,13 @@ def __extract_query_list(
# ``Cache.get_readthrough`` query execution path. See GH-902.
is_duplicate.append(int(query["stats"].get("is_duplicate") or 0))
consistent.append(int(query["stats"].get("consistent") or 0))
fallback_profile: ClickhouseQueryProfile = {
"time_range": 0,
"all_columns": [],
"multi_level_condition": False,
"where_profile": {"columns": [], "mapping_cols": []},
"groupby_cols": [],
"array_join_cols": [],
}
profile = query.get("profile") or fallback_profile

profile = query["profile"]
result_profile = query.get("result_profile") or {"bytes": 0}
time_range = profile["time_range"]
num_days.append(
time_range if time_range is not None and time_range >= 0 else 0
)
all_columns.append(profile.get("all_columns") or [])
all_columns.append(profile["all_columns"])
or_conditions.append(profile["multi_level_condition"])
where_columns.append(profile["where_profile"]["columns"])
where_mapping_columns.append(profile["where_profile"]["mapping_cols"])
Expand Down

0 comments on commit 17d74b9

Please sign in to comment.