import {Fragment} from 'react'; import type {Query} from 'history'; import EventsRequest from 'sentry/components/charts/eventsRequest'; import {HeaderTitleLegend} from 'sentry/components/charts/styles'; import {getInterval} from 'sentry/components/charts/utils'; import {normalizeDateTimeParams} from 'sentry/components/organizations/pageFilters/parse'; import QuestionTooltip from 'sentry/components/questionTooltip'; import {t} from 'sentry/locale'; import type {Series} from 'sentry/types/echarts'; import type {Organization, OrganizationSummary} from 'sentry/types/organization'; import {getUtcToLocalDateObject} from 'sentry/utils/dates'; import {useMEPSettingContext} from 'sentry/utils/performance/contexts/metricsEnhancedSetting'; import useApi from 'sentry/utils/useApi'; import {useLocation} from 'sentry/utils/useLocation'; import DurationChart from 'sentry/views/performance/charts/chart'; import {getTermHelp, PerformanceTerm} from 'sentry/views/performance/data'; import {getMEPQueryParams} from 'sentry/views/performance/landing/widgets/utils'; import type {ViewProps} from 'sentry/views/performance/types'; type Props = ViewProps & { organization: OrganizationSummary; queryExtra: Query; withoutZerofill: boolean; }; /** * Fetch and render an area chart that shows user misery over a period */ function UserMiseryChart({ project, environment, organization, query, statsPeriod, withoutZerofill, start: propsStart, end: propsEnd, }: Props) { const location = useLocation(); const api = useApi(); const mepContext = useMEPSettingContext(); const start = propsStart ? getUtcToLocalDateObject(propsStart) : null; const end = propsEnd ? getUtcToLocalDateObject(propsEnd) : null; const utc = normalizeDateTimeParams(location.query).utc === 'true'; const period = statsPeriod; const datetimeSelection = {start, end, period}; const requestCommonProps = { api, start, end, project, environment, query, period, interval: getInterval(datetimeSelection, 'high'), }; const header = ( {t('User Misery')} ); const yAxis = 'user_misery()'; return ( {header} {({loading, reloading, timeseriesData}) => { const data: Series[] = timeseriesData?.[0] ? [{...timeseriesData[0], seriesName: yAxis}] : []; return ( ); }} ); } export default UserMiseryChart;