metricChart.tsx 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692
  1. import {Fragment, PureComponent} from 'react';
  2. import type {WithRouterProps} from 'react-router';
  3. import {browserHistory} from 'react-router';
  4. import styled from '@emotion/styled';
  5. import color from 'color';
  6. import type {LineSeriesOption} from 'echarts';
  7. import moment from 'moment';
  8. import momentTimezone from 'moment-timezone';
  9. import type {Client} from 'sentry/api';
  10. import Feature from 'sentry/components/acl/feature';
  11. import {OnDemandMetricAlert} from 'sentry/components/alerts/onDemandMetricAlert';
  12. import {Button} from 'sentry/components/button';
  13. import type {AreaChartSeries} from 'sentry/components/charts/areaChart';
  14. import {AreaChart} from 'sentry/components/charts/areaChart';
  15. import ChartZoom from 'sentry/components/charts/chartZoom';
  16. import MarkArea from 'sentry/components/charts/components/markArea';
  17. import MarkLine from 'sentry/components/charts/components/markLine';
  18. import EventsRequest from 'sentry/components/charts/eventsRequest';
  19. import LineSeries from 'sentry/components/charts/series/lineSeries';
  20. import SessionsRequest from 'sentry/components/charts/sessionsRequest';
  21. import {
  22. ChartControls,
  23. HeaderTitleLegend,
  24. InlineContainer,
  25. SectionHeading,
  26. SectionValue,
  27. } from 'sentry/components/charts/styles';
  28. import {isEmptySeries} from 'sentry/components/charts/utils';
  29. import CircleIndicator from 'sentry/components/circleIndicator';
  30. import type {StatsPeriodType} from 'sentry/components/organizations/pageFilters/parse';
  31. import {parseStatsPeriod} from 'sentry/components/organizations/pageFilters/parse';
  32. import Panel from 'sentry/components/panels/panel';
  33. import PanelBody from 'sentry/components/panels/panelBody';
  34. import Placeholder from 'sentry/components/placeholder';
  35. import {Tooltip} from 'sentry/components/tooltip';
  36. import {IconCheckmark, IconClock, IconFire, IconWarning} from 'sentry/icons';
  37. import {t} from 'sentry/locale';
  38. import ConfigStore from 'sentry/stores/configStore';
  39. import {space} from 'sentry/styles/space';
  40. import type {DateString, Organization, Project} from 'sentry/types';
  41. import type {ReactEchartsRef, Series} from 'sentry/types/echarts';
  42. import {getUtcDateString} from 'sentry/utils/dates';
  43. import {DiscoverDatasets} from 'sentry/utils/discover/types';
  44. import {getDuration} from 'sentry/utils/formatters';
  45. import getDynamicText from 'sentry/utils/getDynamicText';
  46. import {getForceMetricsLayerQueryExtras} from 'sentry/utils/metrics/features';
  47. import {formatMRIField} from 'sentry/utils/metrics/mri';
  48. import {shouldShowOnDemandMetricAlertUI} from 'sentry/utils/onDemandMetrics/features';
  49. import {MINUTES_THRESHOLD_TO_DISPLAY_SECONDS} from 'sentry/utils/sessions';
  50. import {capitalize} from 'sentry/utils/string/capitalize';
  51. import theme from 'sentry/utils/theme';
  52. import toArray from 'sentry/utils/toArray';
  53. import {normalizeUrl} from 'sentry/utils/withDomainRequired';
  54. // eslint-disable-next-line no-restricted-imports
  55. import withSentryRouter from 'sentry/utils/withSentryRouter';
  56. import {COMPARISON_DELTA_OPTIONS} from 'sentry/views/alerts/rules/metric/constants';
  57. import {makeDefaultCta} from 'sentry/views/alerts/rules/metric/metricRulePresets';
  58. import type {MetricRule} from 'sentry/views/alerts/rules/metric/types';
  59. import {
  60. AlertRuleTriggerType,
  61. Dataset,
  62. TimePeriod,
  63. } from 'sentry/views/alerts/rules/metric/types';
  64. import {getChangeStatus} from 'sentry/views/alerts/utils/getChangeStatus';
  65. import {AlertWizardAlertNames} from 'sentry/views/alerts/wizard/options';
  66. import {getAlertTypeFromAggregateDataset} from 'sentry/views/alerts/wizard/utils';
  67. import type {Incident} from '../../../types';
  68. import {
  69. alertDetailsLink,
  70. alertTooltipValueFormatter,
  71. isSessionAggregate,
  72. SESSION_AGGREGATE_TO_FIELD,
  73. } from '../../../utils';
  74. import {getMetricDatasetQueryExtras} from '../utils/getMetricDatasetQueryExtras';
  75. import {isCrashFreeAlert} from '../utils/isCrashFreeAlert';
  76. import type {TimePeriodType} from './constants';
  77. import {
  78. getMetricAlertChartOption,
  79. transformSessionResponseToSeries,
  80. } from './metricChartOption';
  81. type Props = WithRouterProps & {
  82. api: Client;
  83. filter: string[] | null;
  84. interval: string;
  85. organization: Organization;
  86. project: Project;
  87. query: string;
  88. rule: MetricRule;
  89. timePeriod: TimePeriodType;
  90. incidents?: Incident[];
  91. isOnDemandAlert?: boolean;
  92. selectedIncident?: Incident | null;
  93. };
  94. type State = Record<string, never>;
  95. function formatTooltipDate(date: moment.MomentInput, format: string): string {
  96. const {
  97. options: {timezone},
  98. } = ConfigStore.get('user');
  99. return momentTimezone.tz(date, timezone).format(format);
  100. }
  101. function getRuleChangeSeries(
  102. rule: MetricRule,
  103. data: AreaChartSeries[]
  104. ): LineSeriesOption[] {
  105. const {dateModified} = rule;
  106. if (!data.length || !data[0].data.length || !dateModified) {
  107. return [];
  108. }
  109. const seriesData = data[0].data;
  110. const seriesStart = new Date(seriesData[0].name).getTime();
  111. const ruleChanged = new Date(dateModified).getTime();
  112. if (ruleChanged < seriesStart) {
  113. return [];
  114. }
  115. return [
  116. {
  117. type: 'line',
  118. markLine: MarkLine({
  119. silent: true,
  120. animation: false,
  121. lineStyle: {color: theme.gray200, type: 'solid', width: 1},
  122. data: [{xAxis: ruleChanged}],
  123. label: {
  124. show: false,
  125. },
  126. }),
  127. markArea: MarkArea({
  128. silent: true,
  129. itemStyle: {
  130. color: color(theme.gray100).alpha(0.42).rgb().string(),
  131. },
  132. data: [[{xAxis: seriesStart}, {xAxis: ruleChanged}]],
  133. }),
  134. data: [],
  135. },
  136. ];
  137. }
  138. function shouldUseErrorsDataset(
  139. organization: Organization,
  140. dataset: Dataset,
  141. query: string
  142. ): boolean {
  143. return (
  144. dataset === Dataset.ERRORS &&
  145. /\bis:unresolved\b/.test(query) &&
  146. organization.features.includes('metric-alert-ignore-archived')
  147. );
  148. }
  149. class MetricChart extends PureComponent<Props, State> {
  150. ref: null | ReactEchartsRef = null;
  151. handleZoom = (start: DateString, end: DateString) => {
  152. const {location} = this.props;
  153. browserHistory.push({
  154. pathname: location.pathname,
  155. query: {
  156. start,
  157. end,
  158. },
  159. });
  160. };
  161. renderChartActions(
  162. totalDuration: number,
  163. criticalDuration: number,
  164. warningDuration: number,
  165. waitingForDataDuration: number
  166. ) {
  167. const {rule, organization, project, timePeriod, query} = this.props;
  168. let dataset: DiscoverDatasets | undefined = undefined;
  169. if (shouldUseErrorsDataset(organization, rule.dataset, query)) {
  170. dataset = DiscoverDatasets.ERRORS;
  171. }
  172. const {buttonText, ...props} = makeDefaultCta({
  173. orgSlug: organization.slug,
  174. projects: [project],
  175. rule,
  176. timePeriod,
  177. query,
  178. dataset,
  179. });
  180. const resolvedPercent =
  181. (100 *
  182. Math.max(
  183. totalDuration - waitingForDataDuration - criticalDuration - warningDuration,
  184. 0
  185. )) /
  186. totalDuration;
  187. const criticalPercent = 100 * Math.min(criticalDuration / totalDuration, 1);
  188. const warningPercent = 100 * Math.min(warningDuration / totalDuration, 1);
  189. const waitingForDataPercent =
  190. 100 *
  191. Math.min(
  192. (waitingForDataDuration - criticalDuration - warningDuration) / totalDuration,
  193. 1
  194. );
  195. return (
  196. <StyledChartControls>
  197. <StyledInlineContainer>
  198. <Fragment>
  199. <SectionHeading>{t('Summary')}</SectionHeading>
  200. <StyledSectionValue>
  201. <ValueItem>
  202. <IconCheckmark color="successText" isCircled />
  203. {resolvedPercent ? resolvedPercent.toFixed(2) : 0}%
  204. </ValueItem>
  205. <ValueItem>
  206. <IconWarning color="warningText" />
  207. {warningPercent ? warningPercent.toFixed(2) : 0}%
  208. </ValueItem>
  209. <ValueItem>
  210. <IconFire color="errorText" />
  211. {criticalPercent ? criticalPercent.toFixed(2) : 0}%
  212. </ValueItem>
  213. {waitingForDataPercent > 0 && (
  214. <StyledTooltip
  215. underlineColor="gray200"
  216. showUnderline
  217. title={t(
  218. 'The time spent waiting for metrics matching the filters used.'
  219. )}
  220. >
  221. <ValueItem>
  222. <IconClock />
  223. {waitingForDataPercent.toFixed(2)}%
  224. </ValueItem>
  225. </StyledTooltip>
  226. )}
  227. </StyledSectionValue>
  228. </Fragment>
  229. </StyledInlineContainer>
  230. {!isSessionAggregate(rule.aggregate) && (
  231. <Feature features="discover-basic">
  232. <Button size="sm" {...props}>
  233. {buttonText}
  234. </Button>
  235. </Feature>
  236. )}
  237. </StyledChartControls>
  238. );
  239. }
  240. renderChart(
  241. loading: boolean,
  242. timeseriesData?: Series[],
  243. minutesThresholdToDisplaySeconds?: number,
  244. comparisonTimeseriesData?: Series[]
  245. ) {
  246. const {
  247. router,
  248. selectedIncident,
  249. interval,
  250. filter,
  251. incidents,
  252. rule,
  253. organization,
  254. timePeriod: {start, end},
  255. } = this.props;
  256. const {dateModified, timeWindow} = rule;
  257. if (loading || !timeseriesData) {
  258. return this.renderEmpty();
  259. }
  260. const handleIncidentClick = (incident: Incident) => {
  261. router.push(
  262. normalizeUrl({
  263. pathname: alertDetailsLink(organization, incident),
  264. query: {alert: incident.identifier},
  265. })
  266. );
  267. };
  268. const {
  269. criticalDuration,
  270. warningDuration,
  271. totalDuration,
  272. waitingForDataDuration,
  273. chartOption,
  274. } = getMetricAlertChartOption({
  275. timeseriesData,
  276. rule,
  277. incidents,
  278. selectedIncident,
  279. showWaitingForData:
  280. shouldShowOnDemandMetricAlertUI(organization) && this.props.isOnDemandAlert,
  281. handleIncidentClick,
  282. });
  283. const comparisonSeriesName = capitalize(
  284. COMPARISON_DELTA_OPTIONS.find(({value}) => value === rule.comparisonDelta)?.label ||
  285. ''
  286. );
  287. const additionalSeries: LineSeriesOption[] = [
  288. ...(comparisonTimeseriesData || []).map(({data: _data, ...otherSeriesProps}) =>
  289. LineSeries({
  290. name: comparisonSeriesName,
  291. data: _data.map(({name, value}) => [name, value]),
  292. lineStyle: {color: theme.gray200, type: 'dashed', width: 1},
  293. itemStyle: {color: theme.gray200},
  294. animation: false,
  295. animationThreshold: 1,
  296. animationDuration: 0,
  297. ...otherSeriesProps,
  298. })
  299. ),
  300. ...getRuleChangeSeries(rule, timeseriesData),
  301. ];
  302. const queryFilter =
  303. filter?.join(' ') + t(' over ') + getDuration(rule.timeWindow * 60);
  304. return (
  305. <ChartPanel>
  306. <StyledPanelBody withPadding>
  307. <ChartHeader>
  308. <HeaderTitleLegend>
  309. {AlertWizardAlertNames[getAlertTypeFromAggregateDataset(rule)]}
  310. </HeaderTitleLegend>
  311. </ChartHeader>
  312. <ChartFilters>
  313. <StyledCircleIndicator size={8} />
  314. <Filters>{formatMRIField(rule.aggregate)}</Filters>
  315. <Tooltip
  316. title={queryFilter}
  317. isHoverable
  318. skipWrapper
  319. overlayStyle={{maxWidth: '90vw', lineBreak: 'anywhere', textAlign: 'left'}}
  320. showOnlyOnOverflow
  321. >
  322. <QueryFilters>{queryFilter}</QueryFilters>
  323. </Tooltip>
  324. </ChartFilters>
  325. {getDynamicText({
  326. value: (
  327. <ChartZoom
  328. router={router}
  329. start={start}
  330. end={end}
  331. onZoom={zoomArgs => this.handleZoom(zoomArgs.start, zoomArgs.end)}
  332. >
  333. {zoomRenderProps => (
  334. <AreaChart
  335. {...zoomRenderProps}
  336. {...chartOption}
  337. showTimeInTooltip
  338. minutesThresholdToDisplaySeconds={minutesThresholdToDisplaySeconds}
  339. additionalSeries={additionalSeries}
  340. tooltip={{
  341. formatter: seriesParams => {
  342. // seriesParams can be object instead of array
  343. const pointSeries = toArray(seriesParams);
  344. const {marker, data: pointData, seriesName} = pointSeries[0];
  345. const [pointX, pointY] = pointData as [number, number];
  346. const pointYFormatted = alertTooltipValueFormatter(
  347. pointY,
  348. seriesName ?? '',
  349. rule.aggregate
  350. );
  351. const isModified =
  352. dateModified && pointX <= new Date(dateModified).getTime();
  353. const startTime = formatTooltipDate(moment(pointX), 'MMM D LT');
  354. const {period, periodLength} = parseStatsPeriod(interval) ?? {
  355. periodLength: 'm',
  356. period: `${timeWindow}`,
  357. };
  358. const endTime = formatTooltipDate(
  359. moment(pointX).add(
  360. parseInt(period, 10),
  361. periodLength as StatsPeriodType
  362. ),
  363. 'MMM D LT'
  364. );
  365. const comparisonSeries =
  366. pointSeries.length > 1
  367. ? pointSeries.find(
  368. ({seriesName: _sn}) => _sn === comparisonSeriesName
  369. )
  370. : undefined;
  371. const comparisonPointY = comparisonSeries?.data[1] as
  372. | number
  373. | undefined;
  374. const comparisonPointYFormatted =
  375. comparisonPointY !== undefined
  376. ? alertTooltipValueFormatter(
  377. comparisonPointY,
  378. seriesName ?? '',
  379. rule.aggregate
  380. )
  381. : undefined;
  382. const changePercentage =
  383. comparisonPointY === undefined
  384. ? NaN
  385. : ((pointY - comparisonPointY) * 100) / comparisonPointY;
  386. const changeStatus = getChangeStatus(
  387. changePercentage,
  388. rule.thresholdType,
  389. rule.triggers
  390. );
  391. const changeStatusColor =
  392. changeStatus === AlertRuleTriggerType.CRITICAL
  393. ? theme.red300
  394. : changeStatus === AlertRuleTriggerType.WARNING
  395. ? theme.yellow300
  396. : theme.green300;
  397. return [
  398. `<div class="tooltip-series">`,
  399. isModified &&
  400. `<div><span class="tooltip-label"><strong>${t(
  401. 'Alert Rule Modified'
  402. )}</strong></span></div>`,
  403. `<div><span class="tooltip-label">${marker} <strong>${seriesName}</strong></span>${pointYFormatted}</div>`,
  404. comparisonSeries &&
  405. `<div><span class="tooltip-label">${comparisonSeries.marker} <strong>${comparisonSeriesName}</strong></span>${comparisonPointYFormatted}</div>`,
  406. `</div>`,
  407. `<div class="tooltip-footer">`,
  408. `<span>${startTime} &mdash; ${endTime}</span>`,
  409. comparisonPointY !== undefined &&
  410. Math.abs(changePercentage) !== Infinity &&
  411. !isNaN(changePercentage) &&
  412. `<span style="color:${changeStatusColor};margin-left:10px;">${
  413. Math.sign(changePercentage) === 1 ? '+' : '-'
  414. }${Math.abs(changePercentage).toFixed(2)}%</span>`,
  415. `</div>`,
  416. '<div class="tooltip-arrow"></div>',
  417. ]
  418. .filter(e => e)
  419. .join('');
  420. },
  421. }}
  422. />
  423. )}
  424. </ChartZoom>
  425. ),
  426. fixed: <Placeholder height="200px" testId="skeleton-ui" />,
  427. })}
  428. </StyledPanelBody>
  429. {this.renderChartActions(
  430. totalDuration,
  431. criticalDuration,
  432. warningDuration,
  433. waitingForDataDuration
  434. )}
  435. </ChartPanel>
  436. );
  437. }
  438. renderEmptyOnDemandAlert(
  439. organization: Organization,
  440. timeseriesData: Series[] = [],
  441. loading?: boolean
  442. ) {
  443. if (
  444. loading ||
  445. !this.props.isOnDemandAlert ||
  446. !shouldShowOnDemandMetricAlertUI(organization) ||
  447. !isEmptySeries(timeseriesData[0])
  448. ) {
  449. return null;
  450. }
  451. return (
  452. <OnDemandMetricAlert
  453. dismissable
  454. message={t(
  455. 'This alert lacks historical data due to filters for which we don’t routinely extract metrics.'
  456. )}
  457. />
  458. );
  459. }
  460. renderEmpty(placeholderText = '') {
  461. return (
  462. <ChartPanel>
  463. <PanelBody withPadding>
  464. <TriggerChartPlaceholder>{placeholderText}</TriggerChartPlaceholder>
  465. </PanelBody>
  466. </ChartPanel>
  467. );
  468. }
  469. render() {
  470. const {
  471. api,
  472. rule,
  473. organization,
  474. timePeriod,
  475. project,
  476. interval,
  477. query,
  478. location,
  479. isOnDemandAlert,
  480. } = this.props;
  481. const {aggregate, timeWindow, environment, dataset} = rule;
  482. // Fix for 7 days * 1m interval being over the max number of results from events api
  483. // 10k events is the current max
  484. if (
  485. timePeriod.usingPeriod &&
  486. timePeriod.period === TimePeriod.SEVEN_DAYS &&
  487. interval === '1m'
  488. ) {
  489. timePeriod.start = getUtcDateString(
  490. // -5 minutes provides a small cushion for rounding up minutes. This might be able to be smaller
  491. moment(moment.utc(timePeriod.end).subtract(10000 - 5, 'minutes'))
  492. );
  493. }
  494. // If the chart duration isn't as long as the rollup duration the events-stats
  495. // endpoint will return an invalid timeseriesData dataset
  496. const viableStartDate = getUtcDateString(
  497. moment.min(
  498. moment.utc(timePeriod.start),
  499. moment.utc(timePeriod.end).subtract(timeWindow, 'minutes')
  500. )
  501. );
  502. const viableEndDate = getUtcDateString(
  503. moment.utc(timePeriod.end).add(timeWindow, 'minutes')
  504. );
  505. const queryExtras: Record<string, string> = {
  506. ...getMetricDatasetQueryExtras({
  507. organization,
  508. location,
  509. dataset,
  510. newAlertOrQuery: false,
  511. useOnDemandMetrics: isOnDemandAlert,
  512. }),
  513. ...getForceMetricsLayerQueryExtras(organization, dataset),
  514. };
  515. if (shouldUseErrorsDataset(organization, dataset, query)) {
  516. queryExtras.dataset = 'errors';
  517. }
  518. return isCrashFreeAlert(dataset) ? (
  519. <SessionsRequest
  520. api={api}
  521. organization={organization}
  522. project={project.id ? [Number(project.id)] : []}
  523. environment={environment ? [environment] : undefined}
  524. start={viableStartDate}
  525. end={viableEndDate}
  526. query={query}
  527. interval={interval}
  528. field={SESSION_AGGREGATE_TO_FIELD[aggregate]}
  529. groupBy={['session.status']}
  530. >
  531. {({loading, response}) =>
  532. this.renderChart(
  533. loading,
  534. transformSessionResponseToSeries(response, rule),
  535. MINUTES_THRESHOLD_TO_DISPLAY_SECONDS
  536. )
  537. }
  538. </SessionsRequest>
  539. ) : (
  540. <EventsRequest
  541. api={api}
  542. organization={organization}
  543. query={query}
  544. environment={environment ? [environment] : undefined}
  545. project={project.id ? [Number(project.id)] : []}
  546. interval={interval}
  547. comparisonDelta={rule.comparisonDelta ? rule.comparisonDelta * 60 : undefined}
  548. start={viableStartDate}
  549. end={viableEndDate}
  550. yAxis={aggregate}
  551. includePrevious={false}
  552. currentSeriesNames={[aggregate]}
  553. partial={false}
  554. queryExtras={queryExtras}
  555. referrer="api.alerts.alert-rule-chart"
  556. useOnDemandMetrics
  557. >
  558. {({loading, timeseriesData, comparisonTimeseriesData}) => (
  559. <Fragment>
  560. {this.renderEmptyOnDemandAlert(organization, timeseriesData, loading)}
  561. {this.renderChart(
  562. loading,
  563. timeseriesData,
  564. undefined,
  565. comparisonTimeseriesData
  566. )}
  567. </Fragment>
  568. )}
  569. </EventsRequest>
  570. );
  571. }
  572. }
  573. export default withSentryRouter(MetricChart);
  574. const ChartPanel = styled(Panel)`
  575. margin-top: ${space(2)};
  576. `;
  577. const ChartHeader = styled('div')`
  578. margin-bottom: ${space(3)};
  579. `;
  580. const StyledChartControls = styled(ChartControls)`
  581. display: flex;
  582. justify-content: space-between;
  583. flex-wrap: wrap;
  584. `;
  585. const StyledInlineContainer = styled(InlineContainer)`
  586. grid-auto-flow: column;
  587. grid-column-gap: ${space(1)};
  588. `;
  589. const StyledCircleIndicator = styled(CircleIndicator)`
  590. background: ${p => p.theme.formText};
  591. height: ${space(1)};
  592. margin-right: ${space(0.5)};
  593. `;
  594. const ChartFilters = styled('div')`
  595. font-size: ${p => p.theme.fontSizeSmall};
  596. font-family: ${p => p.theme.text.family};
  597. color: ${p => p.theme.textColor};
  598. display: inline-grid;
  599. grid-template-columns: max-content max-content auto;
  600. align-items: center;
  601. `;
  602. const Filters = styled('span')`
  603. margin-right: ${space(1)};
  604. `;
  605. const QueryFilters = styled('span')`
  606. min-width: 0px;
  607. ${p => p.theme.overflowEllipsis}
  608. `;
  609. const StyledSectionValue = styled(SectionValue)`
  610. display: grid;
  611. grid-template-columns: repeat(4, auto);
  612. gap: ${space(1.5)};
  613. margin: 0 0 0 ${space(1.5)};
  614. `;
  615. const ValueItem = styled('div')`
  616. display: grid;
  617. grid-template-columns: repeat(2, auto);
  618. gap: ${space(0.5)};
  619. align-items: center;
  620. font-variant-numeric: tabular-nums;
  621. text-underline-offset: ${space(4)};
  622. `;
  623. /* Override padding to make chart appear centered */
  624. const StyledPanelBody = styled(PanelBody)`
  625. padding-right: 6px;
  626. `;
  627. const TriggerChartPlaceholder = styled(Placeholder)`
  628. height: 200px;
  629. text-align: center;
  630. padding: ${space(3)};
  631. `;
  632. const StyledTooltip = styled(Tooltip)`
  633. text-underline-offset: ${space(0.5)} !important;
  634. `;