|
@@ -10,7 +10,7 @@ from rest_framework.request import Request
|
|
|
from rest_framework.response import Response
|
|
|
|
|
|
from sentry import experiments
|
|
|
-from sentry.api.base import ONE_DAY
|
|
|
+from sentry.api.base import ONE_HOUR
|
|
|
from sentry.api.bases import OrganizationEventsEndpointBase
|
|
|
from sentry.api.serializers.models.project import get_access_by_project
|
|
|
from sentry.models import Organization, Project, ProjectStatus
|
|
@@ -19,14 +19,16 @@ from sentry.utils import json
|
|
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
+CACHE_TIME = ONE_HOUR * 4
|
|
|
+
|
|
|
# Web vitals: p75 for LCP and FCP
|
|
|
# Mobile vitals: Cold Start and Warm Start
|
|
|
# Snuba names to the API layer that matches the TS definition
|
|
|
NAME_MAPPING = {
|
|
|
"p75_measurements_fcp": "FCP",
|
|
|
"p75_measurements_lcp": "LCP",
|
|
|
- "measurements.app_start_warm": "appStartWarm",
|
|
|
- "measurements.app_start_cold": "appStartCold",
|
|
|
+ "p75_measurements.app_start_warm": "appStartWarm",
|
|
|
+ "p75_measurements.app_start_cold": "appStartCold",
|
|
|
"count_if_measurements_fcp_greaterOrEquals_0": "fcpCount",
|
|
|
"count_if_measurements_lcp_greaterOrEquals_0": "lcpCount",
|
|
|
"count_if_measurements_app_start_warm_greaterOrEquals_0": "appWarmStartCount",
|
|
@@ -38,8 +40,8 @@ NAME_MAPPING = {
|
|
|
BASIC_COLUMNS = [
|
|
|
"p75(measurements.lcp)",
|
|
|
"p75(measurements.fcp)",
|
|
|
- "measurements.app_start_cold",
|
|
|
- "measurements.app_start_warm",
|
|
|
+ "p75(measurements.app_start_cold)",
|
|
|
+ "p75(measurements.app_start_warm)",
|
|
|
"count_if(measurements.lcp,greaterOrEquals,0)",
|
|
|
"count_if(measurements.fcp,greaterOrEquals,0)",
|
|
|
"count_if(measurements.app_start_cold,greaterOrEquals,0)",
|
|
@@ -106,7 +108,7 @@ def get_vital_data_for_org(organization: Organization, projects: Sequence[Projec
|
|
|
# cache miss, lookup and store value
|
|
|
if cache_value is None:
|
|
|
cache_value = get_vital_data_for_org_no_cache(organization, projects)
|
|
|
- cache.set(cache_key, cache_value, ONE_DAY)
|
|
|
+ cache.set(cache_key, cache_value, CACHE_TIME)
|
|
|
return cache_value
|
|
|
|
|
|
|