Dev (#2468)
* refactor(chalice): upgraded dependencies * refactor(chalice): upgraded dependencies feat(chalice): support heatmaps * fix(chalice): fixed Math-operators validation refactor(chalice): search for sessions that have events for heatmaps * refactor(chalice): search for sessions that have at least 1 location event for heatmaps * refactor(chalice): upgraded dependencies * refactor(chalice): upgraded dependencies feat(chalice): support heatmaps * fix(chalice): fixed Math-operators validation refactor(chalice): search for sessions that have events for heatmaps * refactor(chalice): search for sessions that have at least 1 location event for heatmaps * refactor(chalice): upgraded dependencies refactor(crons): upgraded dependencies refactor(alerts): upgraded dependencies * feat(chalice): get top 10 values for autocomplete CH * refactor(chalice): cleaned code refactor(chalice): upgraded dependencies refactor(alerts): upgraded dependencies refactor(crons): upgraded dependencies * feat(chalice): autocomplete return top 10 with stats * fix(chalice): fixed autocomplete top 10 meta-filters * fix(chalice): fixed autocomplet-top-values
This commit is contained in:
parent
61a5fe188e
commit
e19477b9f6
3 changed files with 19 additions and 11 deletions
|
|
@ -336,10 +336,10 @@ def __search_metadata(project_id, value, key=None, source=None):
|
|||
TYPE_TO_COLUMN = {
|
||||
schemas.EventType.CLICK: "label",
|
||||
schemas.EventType.INPUT: "label",
|
||||
schemas.EventType.LOCATION: "url_path",
|
||||
schemas.EventType.LOCATION: "path",
|
||||
schemas.EventType.CUSTOM: "name",
|
||||
schemas.EventType.REQUEST: "url_path",
|
||||
schemas.EventType.GRAPHQL: "name",
|
||||
schemas.FetchFilterType.FETCH_URL: "path",
|
||||
schemas.GraphqlFilterType.GRAPHQL_NAME: "name",
|
||||
schemas.EventType.STATE_ACTION: "name",
|
||||
# For ERROR, sessions search is happening over name OR message,
|
||||
# for simplicity top 10 is using name only
|
||||
|
|
@ -365,12 +365,16 @@ TYPE_TO_TABLE = {
|
|||
schemas.EventType.INPUT: "events.inputs",
|
||||
schemas.EventType.LOCATION: "events.pages",
|
||||
schemas.EventType.CUSTOM: "events_common.customs",
|
||||
schemas.EventType.REQUEST: "events_common.requests",
|
||||
schemas.EventType.GRAPHQL: "events.graphql",
|
||||
schemas.FetchFilterType.FETCH_URL: "events_common.requests",
|
||||
schemas.GraphqlFilterType.GRAPHQL_NAME: "events.graphql",
|
||||
schemas.EventType.STATE_ACTION: "events.state_actions",
|
||||
}
|
||||
|
||||
|
||||
def is_top_supported(event_type):
|
||||
return TYPE_TO_COLUMN.get(event_type, False)
|
||||
|
||||
|
||||
def get_top_values(project_id, event_type, event_key=None):
|
||||
with pg_client.PostgresClient() as cur:
|
||||
if schemas.FilterType.has_value(event_type):
|
||||
|
|
@ -393,7 +397,7 @@ def get_top_values(project_id, event_type, event_key=None):
|
|||
LIMIT 10)
|
||||
SELECT c_value AS value, row_count, trunc(row_count * 100 / total_count, 2) AS row_percentage
|
||||
FROM raw;"""
|
||||
elif event_type==schemas.EventType.ERROR:
|
||||
elif event_type == schemas.EventType.ERROR:
|
||||
colname = TYPE_TO_COLUMN.get(event_type)
|
||||
query = f"""WITH raw AS (SELECT DISTINCT {colname} AS c_value,
|
||||
COUNT(1) OVER (PARTITION BY {colname}) AS row_count,
|
||||
|
|
|
|||
|
|
@ -28,10 +28,10 @@ def events_search(projectId: int, q: Optional[str] = None,
|
|||
key: str = None, source: str = None, live: bool = False,
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
if type and (not q or len(q) == 0) \
|
||||
and (schemas.FilterType.has_value(type) or schemas.EventType.has_value(type)):
|
||||
and (autocomplete.is_top_supported(type)):
|
||||
# TODO: check if type is a valid value for autocomplete
|
||||
return autocomplete.get_top_values(project_id=projectId, event_type=type,event_key=key)
|
||||
elif (not q or len(q) == 0) and not type:
|
||||
return autocomplete.get_top_values(project_id=projectId, event_type=type, event_key=key)
|
||||
elif (not q or len(q) == 0):
|
||||
return {"data": []}
|
||||
|
||||
if live:
|
||||
|
|
|
|||
|
|
@ -267,8 +267,8 @@ TYPE_TO_COLUMN = {
|
|||
schemas.EventType.INPUT: "label",
|
||||
schemas.EventType.LOCATION: "url_path",
|
||||
schemas.EventType.CUSTOM: "name",
|
||||
schemas.EventType.REQUEST: "url_path",
|
||||
schemas.EventType.GRAPHQL: "name",
|
||||
schemas.FetchFilterType.FETCH_URL: "url_path",
|
||||
schemas.GraphqlFilterType.GRAPHQL_NAME: "name",
|
||||
schemas.EventType.STATE_ACTION: "name",
|
||||
# For ERROR, sessions search is happening over name OR message,
|
||||
# for simplicity top 10 is using name only
|
||||
|
|
@ -290,6 +290,10 @@ TYPE_TO_COLUMN = {
|
|||
}
|
||||
|
||||
|
||||
def is_top_supported(event_type):
|
||||
return TYPE_TO_COLUMN.get(event_type, False)
|
||||
|
||||
|
||||
def get_top_values(project_id, event_type, event_key=None):
|
||||
with ch_client.ClickHouseClient() as cur:
|
||||
if schemas.FilterType.has_value(event_type):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue