Dev (#2431)
* 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 * feat(chalice): autocomplete top 10 for error events
This commit is contained in:
parent
97df9b2b7c
commit
ca8f70d92d
1 changed files with 13 additions and 3 deletions
|
|
@ -368,9 +368,6 @@ TYPE_TO_TABLE = {
|
|||
schemas.EventType.REQUEST: "events_common.requests",
|
||||
schemas.EventType.GRAPHQL: "events.graphql",
|
||||
schemas.EventType.STATE_ACTION: "events.state_actions",
|
||||
# For ERROR, sessions search is happening over name OR message,
|
||||
# for simplicity top 10 is using name only
|
||||
schemas.EventType.ERROR: "name"
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -396,6 +393,19 @@ 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:
|
||||
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,
|
||||
COUNT(1) OVER () AS total_count
|
||||
FROM public.errors
|
||||
WHERE project_id = %(project_id)s
|
||||
AND {colname} IS NOT NULL
|
||||
AND {colname} != ''
|
||||
ORDER BY row_count DESC
|
||||
LIMIT 10)
|
||||
SELECT c_value AS value, row_count, trunc(row_count * 100 / total_count,2) AS row_percentage
|
||||
FROM raw;"""
|
||||
else:
|
||||
colname = TYPE_TO_COLUMN.get(event_type)
|
||||
table = TYPE_TO_TABLE.get(event_type)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue