From d227e7b3703b22f6c42c29e9a6aa17dc7a4e28d0 Mon Sep 17 00:00:00 2001 From: Taha Yassine Kraiem Date: Tue, 28 Dec 2021 16:44:15 +0100 Subject: [PATCH] feat(api): search sessions by AVG_MEMORY_USAGE --- api/chalicelib/core/performance_event.py | 2 ++ api/chalicelib/core/sessions.py | 3 ++- api/schemas.py | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/api/chalicelib/core/performance_event.py b/api/chalicelib/core/performance_event.py index ad55fb2d9..31ba69578 100644 --- a/api/chalicelib/core/performance_event.py +++ b/api/chalicelib/core/performance_event.py @@ -6,5 +6,7 @@ def get_col(perf: schemas.PerformanceEventType): schemas.PerformanceEventType.location_dom_complete: {"column": "dom_building_time", "extraJoin": None}, schemas.PerformanceEventType.location_ttfb: {"column": "ttfb", "extraJoin": None}, schemas.PerformanceEventType.location_avg_cpu_load: {"column": "avg_cpu", "extraJoin": "events.performance"}, + schemas.PerformanceEventType.location_avg_memory_usage: {"column": "avg_used_js_heap_size", + "extraJoin": "events.performance"}, # schemas.PerformanceEventType.location_largest_contentful_paint_time: "timestamp" }.get(perf) diff --git a/api/chalicelib/core/sessions.py b/api/chalicelib/core/sessions.py index e086ab099..d0c674007 100644 --- a/api/chalicelib/core/sessions.py +++ b/api/chalicelib/core/sessions.py @@ -443,7 +443,8 @@ def search2_pg(data: schemas.SessionsSearchPayloadSchema, project_id, user_id, f elif event_type in [schemas.PerformanceEventType.location_dom_complete, schemas.PerformanceEventType.location_largest_contentful_paint_time, schemas.PerformanceEventType.location_ttfb, - schemas.PerformanceEventType.location_avg_cpu_load + schemas.PerformanceEventType.location_avg_cpu_load, + schemas.PerformanceEventType.location_avg_memory_usage ]: event_from = event_from % f"{events.event_type.LOCATION.table} AS main " col = performance_event.get_col(event_type) diff --git a/api/schemas.py b/api/schemas.py index aabfad967..de69f413c 100644 --- a/api/schemas.py +++ b/api/schemas.py @@ -374,6 +374,7 @@ class PerformanceEventType(str, Enum): time_between_events = "TIME_BETWEEN_EVENTS" location_ttfb = "TTFB" location_avg_cpu_load = "AVG_CPU_LOAD" + location_avg_memory_usage = "AVG_MEMORY_USAGE" class FilterType(str, Enum):