feat(api): search sessions by AVG_MEMORY_USAGE

This commit is contained in:
Taha Yassine Kraiem 2021-12-28 16:44:15 +01:00
parent 2bc486f744
commit d227e7b370
3 changed files with 5 additions and 1 deletions

View file

@ -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)

View file

@ -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)

View file

@ -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):