feat(chalice): transform keys
This commit is contained in:
parent
7ae8934702
commit
9d7c89198d
1 changed files with 50 additions and 22 deletions
|
|
@ -371,31 +371,31 @@ class ErrorSource(str, Enum):
|
||||||
|
|
||||||
|
|
||||||
class EventType(str, Enum):
|
class EventType(str, Enum):
|
||||||
click = "CLICK"
|
click = "click"
|
||||||
input = "INPUT"
|
input = "input"
|
||||||
location = "LOCATION"
|
location = "location"
|
||||||
custom = "CUSTOM"
|
custom = "custom"
|
||||||
request = "REQUEST"
|
request = "request"
|
||||||
request_details = "FETCH"
|
request_details = "fetch"
|
||||||
graphql = "GRAPHQL"
|
graphql = "graphql"
|
||||||
state_action = "STATEACTION"
|
state_action = "stateAction"
|
||||||
error = "ERROR"
|
error = "error"
|
||||||
click_ios = "CLICK_IOS"
|
click_ios = "clickIos"
|
||||||
input_ios = "INPUT_IOS"
|
input_ios = "inputIos"
|
||||||
view_ios = "VIEW_IOS"
|
view_ios = "viewIos"
|
||||||
custom_ios = "CUSTOM_IOS"
|
custom_ios = "customIos"
|
||||||
request_ios = "REQUEST_IOS"
|
request_ios = "requestIos"
|
||||||
error_ios = "ERROR_IOS"
|
error_ios = "errorIos"
|
||||||
|
|
||||||
|
|
||||||
class PerformanceEventType(str, Enum):
|
class PerformanceEventType(str, Enum):
|
||||||
location_dom_complete = "DOM_COMPLETE"
|
location_dom_complete = "domComplete"
|
||||||
location_largest_contentful_paint_time = "LARGEST_CONTENTFUL_PAINT_TIME"
|
location_largest_contentful_paint_time = "largestContentfulPaintTime"
|
||||||
time_between_events = "TIME_BETWEEN_EVENTS"
|
time_between_events = "timeBetweenEvents"
|
||||||
location_ttfb = "TTFB"
|
location_ttfb = "ttfb"
|
||||||
location_avg_cpu_load = "AVG_CPU_LOAD"
|
location_avg_cpu_load = "avgCpuLoad"
|
||||||
location_avg_memory_usage = "AVG_MEMORY_USAGE"
|
location_avg_memory_usage = "avgMemoryUsage"
|
||||||
fetch_failed = "FETCH_FAILED"
|
fetch_failed = "fetchFailed"
|
||||||
# fetch_duration = "FETCH_DURATION"
|
# fetch_duration = "FETCH_DURATION"
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -549,6 +549,34 @@ class _SessionSearchEventRaw(__MixedSearchFilter):
|
||||||
sourceOperator: Optional[MathOperator] = Field(default=None)
|
sourceOperator: Optional[MathOperator] = Field(default=None)
|
||||||
filters: Optional[List[Union[RequestGraphqlFilterSchema, IssueFilterSchema]]] = Field(default=None)
|
filters: Optional[List[Union[RequestGraphqlFilterSchema, IssueFilterSchema]]] = Field(default=None)
|
||||||
|
|
||||||
|
@root_validator(pre=True)
|
||||||
|
def transform(cls, values):
|
||||||
|
values["type"] = {
|
||||||
|
"CLICK": EventType.click.value,
|
||||||
|
"INPUT": EventType.input.value,
|
||||||
|
"LOCATION": EventType.location.value,
|
||||||
|
"CUSTOM": EventType.custom.value,
|
||||||
|
"REQUEST": EventType.request.value,
|
||||||
|
"FETCH": EventType.request_details.value,
|
||||||
|
"GRAPHQL": EventType.graphql.value,
|
||||||
|
"STATEACTION": EventType.state_action.value,
|
||||||
|
"ERROR": EventType.error.value,
|
||||||
|
"CLICK_IOS": EventType.click_ios.value,
|
||||||
|
"INPUT_IOS": EventType.input_ios.value,
|
||||||
|
"VIEW_IOS": EventType.view_ios.value,
|
||||||
|
"CUSTOM_IOS": EventType.custom_ios.value,
|
||||||
|
"REQUEST_IOS": EventType.request_ios.value,
|
||||||
|
"ERROR_IOS": EventType.error_ios.value,
|
||||||
|
"DOM_COMPLETE": PerformanceEventType.location_dom_complete.value,
|
||||||
|
"LARGEST_CONTENTFUL_PAINT_TIME": PerformanceEventType.location_largest_contentful_paint_time.value,
|
||||||
|
"TIME_BETWEEN_EVENTS": PerformanceEventType.time_between_events.value,
|
||||||
|
"TTFB": PerformanceEventType.location_ttfb.value,
|
||||||
|
"AVG_CPU_LOAD": PerformanceEventType.location_avg_cpu_load.value,
|
||||||
|
"AVG_MEMORY_USAGE": PerformanceEventType.location_avg_memory_usage.value,
|
||||||
|
"FETCH_FAILED": PerformanceEventType.fetch_failed.value,
|
||||||
|
}.get(values["type"], values["type"])
|
||||||
|
return values
|
||||||
|
|
||||||
@root_validator
|
@root_validator
|
||||||
def event_validator(cls, values):
|
def event_validator(cls, values):
|
||||||
if isinstance(values.get("type"), PerformanceEventType):
|
if isinstance(values.get("type"), PerformanceEventType):
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue