diff --git a/static/app/constants/index.tsx b/static/app/constants/index.tsx index 84abbde5cee0bf..28c9dd96311b13 100644 --- a/static/app/constants/index.tsx +++ b/static/app/constants/index.tsx @@ -334,6 +334,18 @@ export const DATA_CATEGORY_INFO = { titleName: t('Profile Seconds'), uid: 17, }, + /** + * Used to display metrics on the stats page + */ + [DataCategoryExact.METRICS]: { + name: DataCategoryExact.METRICS, + apiName: 'metrics', + plural: 'metrics', + displayName: 'metrics', + titleName: t('Metrics'), + // Metrics has no uid, is only used on stats page + uid: -1, + }, [DataCategoryExact.METRIC_SECOND]: { name: DataCategoryExact.METRIC_SECOND, apiName: 'metricSecond', diff --git a/static/app/types/core.tsx b/static/app/types/core.tsx index 573dce5b44a6f9..403ced5ded2276 100644 --- a/static/app/types/core.tsx +++ b/static/app/types/core.tsx @@ -101,6 +101,11 @@ export enum DataCategoryExact { MONITOR_SEAT = 'monitorSeat', PROFILE_DURATION = 'profileDuration', SPAN = 'span', + /** + * Metrics does not actually exist as a data category, but is used on the stats page. + * See metricSecond instead. + */ + METRICS = 'metrics', METRIC_SECOND = 'metricSecond', } diff --git a/static/app/views/organizationStats/index.tsx b/static/app/views/organizationStats/index.tsx index 9bdfe772a5b916..6912f98afdd15f 100644 --- a/static/app/views/organizationStats/index.tsx +++ b/static/app/views/organizationStats/index.tsx @@ -263,7 +263,7 @@ export class OrganizationStats extends Component { if (opt.value === DATA_CATEGORY_INFO.replay.plural) { return organization.features.includes('session-replay'); } - if (opt.value === DATA_CATEGORY_INFO.metricSecond.plural) { + if (opt.value === DATA_CATEGORY_INFO.metrics.plural) { return hasMetricStats(organization); } return true; @@ -321,7 +321,7 @@ export class OrganizationStats extends Component { if (opt.value === DATA_CATEGORY_INFO.replay.plural) { return organization.features.includes('session-replay'); } - if (opt.value === DATA_CATEGORY_INFO.metricSecond.plural) { + if (opt.value === DATA_CATEGORY_INFO.metrics.plural) { return hasMetricStats(organization); } return true; diff --git a/static/app/views/organizationStats/usageChart/index.tsx b/static/app/views/organizationStats/usageChart/index.tsx index 07129efb28bae4..5b0c2435081be6 100644 --- a/static/app/views/organizationStats/usageChart/index.tsx +++ b/static/app/views/organizationStats/usageChart/index.tsx @@ -89,8 +89,8 @@ export const CHART_OPTIONS_DATACATEGORY: CategoryOption[] = [ yAxisMinInterval: 100, }, { - label: DATA_CATEGORY_INFO.metricSecond.titleName, - value: DATA_CATEGORY_INFO.metricSecond.plural, + label: DATA_CATEGORY_INFO.metrics.titleName, + value: DATA_CATEGORY_INFO.metrics.plural, disabled: false, yAxisMinInterval: 100, }, @@ -360,7 +360,7 @@ function UsageChartBody({ const filteredOptions = useMemo(() => { return categoryOptions.filter(option => { - if (option.value !== DATA_CATEGORY_INFO.metricSecond.plural) { + if (option.value !== DATA_CATEGORY_INFO.metrics.plural) { return true; } return ( diff --git a/static/app/views/organizationStats/usageStatsOrg.tsx b/static/app/views/organizationStats/usageStatsOrg.tsx index 67bebd2054c5ea..66b1cd1d50450b 100644 --- a/static/app/views/organizationStats/usageStatsOrg.tsx +++ b/static/app/views/organizationStats/usageStatsOrg.tsx @@ -136,7 +136,7 @@ class UsageStatsOrganization< { query: { ...this.endpointQuery, - category: DATA_CATEGORY_INFO.metricSecond.apiName, + category: DATA_CATEGORY_INFO.metrics.apiName, groupBy: ['outcome'], }, }, @@ -159,7 +159,7 @@ class UsageStatsOrganization< ...group, by: { ...group.by, - category: DATA_CATEGORY_INFO.metricSecond.apiName, + category: DATA_CATEGORY_INFO.metrics.apiName, }, }; }); @@ -345,7 +345,7 @@ class UsageStatsOrganization< filtered: { title: tct('Filtered [dataCategory]', {dataCategory: dataCategoryName}), help: - dataCategory === DATA_CATEGORY_INFO.metricSecond.plural + dataCategory === DATA_CATEGORY_INFO.metrics.plural ? tct( 'Filtered metrics were blocked due to your disabled metrics [settings: settings]', { diff --git a/static/app/views/organizationStats/usageStatsPerMin.tsx b/static/app/views/organizationStats/usageStatsPerMin.tsx index 49cad934d6fd64..d3dd2efbb03cb9 100644 --- a/static/app/views/organizationStats/usageStatsPerMin.tsx +++ b/static/app/views/organizationStats/usageStatsPerMin.tsx @@ -78,7 +78,7 @@ function UsageStatsPerMin({dataCategory, organization, projectIds}: Props) { }; // Metrics stats ingestion is delayed, so we can't show this for metrics right now - if (dataCategory === DATA_CATEGORY_INFO.metricSecond.plural) { + if (dataCategory === DATA_CATEGORY_INFO.metrics.plural) { return null; }