isLowConfidenceTimeSeries.tsx 627 B

1234567891011121314151617
  1. import type {EventsStats, MultiSeriesEventsStats} from 'sentry/types/organization';
  2. import {isEventsStats} from 'sentry/views/insights/common/queries/useSortedTimeSeries';
  3. // Returns true if any of the time series data has a low confidence interval
  4. export function isLowConfidenceTimeSeries(
  5. data: EventsStats | MultiSeriesEventsStats | null
  6. ) {
  7. if (data) {
  8. if (isEventsStats(data)) {
  9. return data.data.some(series => series[1][0].confidence === 'LOW');
  10. }
  11. return Object.values(data).some(eventsStats =>
  12. eventsStats.data.some(series => series[1][0].confidence === 'LOW')
  13. );
  14. }
  15. return false;
  16. }