diff --git a/static/app/views/explore/components/attributeBreakdowns/cohortComparisonContent.tsx b/static/app/views/explore/components/attributeBreakdowns/cohortComparisonContent.tsx index 5b55d8e48e73c0..f4732754e2b1bd 100644 --- a/static/app/views/explore/components/attributeBreakdowns/cohortComparisonContent.tsx +++ b/static/app/views/explore/components/attributeBreakdowns/cohortComparisonContent.tsx @@ -20,7 +20,6 @@ import {useQueryParamState} from 'sentry/utils/url/useQueryParamState'; import {useDebouncedValue} from 'sentry/utils/useDebouncedValue'; import useAttributeBreakdownComparison from 'sentry/views/explore/hooks/useAttributeBreakdownComparison'; import {useQueryParamsVisualizes} from 'sentry/views/explore/queryParams/context'; -import {prettifyAggregation} from 'sentry/views/explore/utils'; import {Chart} from './cohortComparisonChart'; import {AttributeBreakdownsComponent} from './styles'; @@ -29,7 +28,6 @@ type SortingMethod = 'rrr'; const CHARTS_COLUMN_COUNT = 3; const CHARTS_PER_PAGE = CHARTS_COLUMN_COUNT * 4; -const PERCENTILE_FUNCTION_PREFIXES = ['p50', 'p75', 'p90', 'p95', 'p99', 'avg']; export function CohortComparison({ selection, @@ -90,7 +88,7 @@ export function CohortComparison({ setPage(0); }, [filteredRankedAttributes]); - const selectionHint = useMemo(() => { + const selectedRangeToDates = useMemo(() => { if (!selection) { return null; } @@ -102,31 +100,14 @@ export function CohortComparison({ startTimestamp = Math.min(startTimestamp, endTimestamp - 60_000); const userTimezone = getUserTimezone() || moment.tz.guess(); - const startDate = moment - .tz(startTimestamp, userTimezone) - .format('MMM D YYYY h:mm A z'); - const endDate = moment.tz(endTimestamp, userTimezone).format('MMM D YYYY h:mm A z'); - - // Check if yAxis is a percentile function (only these functions should include "and is greater than or equal to") - const yAxisLower = yAxis.toLowerCase(); - const isPercentileFunction = PERCENTILE_FUNCTION_PREFIXES.some(prefix => - yAxisLower.startsWith(prefix) - ); - - const formattedFunction = prettifyAggregation(yAxis) ?? yAxis; + const start = moment.tz(startTimestamp, userTimezone).format('MMM D YYYY h:mm A z'); + const end = moment.tz(endTimestamp, userTimezone).format('MMM D YYYY h:mm A z'); return { - selection: isPercentileFunction - ? t( - `Selection is data between %s - %s and is greater than or equal to %s`, - startDate, - endDate, - formattedFunction - ) - : t(`Selection is data between %s - %s`, startDate, endDate), - baseline: t('Baseline is all other spans from your query'), + start, + end, }; - }, [selection, yAxis]); + }, [selection]); if (isError) { return ; @@ -150,12 +131,18 @@ export function CohortComparison({ ) : ( - {selectionHint && ( + {selectedRangeToDates && ( - {selectionHint.selection} + {t( + 'Selection is data between %s - %s', + selectedRangeToDates.start, + selectedRangeToDates.end + )} + + + {t('Baseline is all other spans from your query')} - {selectionHint.baseline} )} {filteredRankedAttributes.length > 0 ? (