transformEventStats.tsx 475 B

1234567891011121314151617
  1. import type {Series} from 'sentry/types/echarts';
  2. import type {EventsStatsData} from 'sentry/types/organization';
  3. export default function transformEventStats(
  4. data: EventsStatsData,
  5. seriesName?: string
  6. ): Series[] {
  7. return [
  8. {
  9. seriesName: seriesName || 'Current',
  10. data: data.map(([timestamp, countsForTimestamp]) => ({
  11. name: timestamp * 1000,
  12. value: countsForTimestamp.reduce((acc, {count}) => acc + count, 0),
  13. })),
  14. },
  15. ];
  16. }