feat(api): performance largest_contentful_paint

This commit is contained in:
Taha Yassine Kraiem 2022-01-03 18:27:29 +01:00
parent a693b94434
commit e94de67738
2 changed files with 5 additions and 4 deletions

View file

@ -10,5 +10,6 @@ def get_col(perf: schemas.PerformanceEventType):
"extraJoin": "events.performance"},
schemas.PerformanceEventType.fetch_failed: {"column": "success", "extraJoin": None},
# schemas.PerformanceEventType.fetch_duration: {"column": "duration", "extraJoin": None},
# schemas.PerformanceEventType.location_largest_contentful_paint_time: "timestamp"
schemas.PerformanceEventType.location_largest_contentful_paint_time: {"column": "first_contentful_paint_time",
"extraJoin": None}
}.get(perf)

View file

@ -442,7 +442,7 @@ class IssueType(str, Enum):
class _SessionSearchEventRaw(BaseModel):
custom: Optional[List[Union[int, str]]] = Field(None)
custom: Optional[List[Union[int, str]]] = Field(None, min_items=1)
customOperator: Optional[MathOperator] = Field(None)
key: Optional[str] = Field(None)
value: Union[str, List[str]] = Field(...)
@ -455,9 +455,9 @@ class _SessionSearchEventRaw(BaseModel):
if isinstance(values.get("type"), PerformanceEventType):
if values.get("type") == PerformanceEventType.fetch_failed:
return values
assert values.get("custom") is not None, "custom should not be None for PerformanceEventType"
assert values.get("custom") is not None, "custom should not be null for PerformanceEventType"
assert values.get("customOperator") is not None \
, "customOperator should not be None for PerformanceEventType"
, "customOperator should not be null for PerformanceEventType"
if values["type"] == PerformanceEventType.time_between_events:
assert len(values.get("value", [])) == 2, \
f"must provide 2 Events as value for {PerformanceEventType.time_between_events}"