feat(api): search by TTFB
This commit is contained in:
parent
2d1600a4d9
commit
c49621314e
3 changed files with 9 additions and 2 deletions
|
|
@ -4,5 +4,6 @@ import schemas
|
|||
def get_col(perf: schemas.PerformanceEventType):
|
||||
return {
|
||||
schemas.PerformanceEventType.location_dom_complete: "dom_building_time",
|
||||
schemas.PerformanceEventType.ttfb: "ttfb",
|
||||
# schemas.PerformanceEventType.location_largest_contentful_paint_time: "timestamp"
|
||||
}.get(perf)
|
||||
|
|
|
|||
|
|
@ -440,8 +440,9 @@ def search2_pg(data: schemas.SessionsSearchPayloadSchema, project_id, user_id, f
|
|||
event_where.append(
|
||||
_multiple_conditions(f"(main1.reason {op} %({e_k})s OR main1.name {op} %({e_k})s)",
|
||||
event.value, value_key=e_k))
|
||||
elif event_type == [schemas.PerformanceEventType.location_dom_complete,
|
||||
schemas.PerformanceEventType.location_largest_contentful_paint_time]:
|
||||
elif event_type in [schemas.PerformanceEventType.location_dom_complete,
|
||||
schemas.PerformanceEventType.location_largest_contentful_paint_time,
|
||||
schemas.PerformanceEventType.ttfb]:
|
||||
event_from = event_from % f"{events.event_type.LOCATION.table} AS main "
|
||||
if not is_any:
|
||||
event_where.append(
|
||||
|
|
@ -488,6 +489,7 @@ def search2_pg(data: schemas.SessionsSearchPayloadSchema, project_id, user_id, f
|
|||
|
||||
|
||||
else:
|
||||
print("LLLLLLLLLLLLLL")
|
||||
continue
|
||||
if event_index == 0 or or_events:
|
||||
event_where += ss_constraints
|
||||
|
|
|
|||
|
|
@ -372,6 +372,7 @@ class PerformanceEventType(str, Enum):
|
|||
location_dom_complete = "DOM_COMPLETE"
|
||||
location_largest_contentful_paint_time = "LARGEST_CONTENTFUL_PAINT_TIME"
|
||||
time_between_events = "TIME_BETWEEN_EVENTS"
|
||||
ttfb = "TTFB"
|
||||
|
||||
|
||||
class FilterType(str, Enum):
|
||||
|
|
@ -459,6 +460,9 @@ class _SessionSearchEventRaw(BaseModel):
|
|||
assert isinstance(values["value"][0], _SessionSearchEventRaw) \
|
||||
and isinstance(values["value"][1], _SessionSearchEventRaw) \
|
||||
, f"event should be of type _SessionSearchEventRaw for {PerformanceEventType.time_between_events}"
|
||||
else:
|
||||
for c in values["custom"]:
|
||||
assert isinstance(c, int), f"custom value should be of type int for {values.get('type')}"
|
||||
return values
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue