isInsightsMetricAlert.tsx 1002 B

12345678910111213141516171819202122232425262728293031323334
  1. import {parseField} from 'sentry/utils/metrics/mri';
  2. export const INSIGHTS_METRICS_OPERATIONS = [
  3. {
  4. label: 'spm',
  5. value: 'spm',
  6. },
  7. ];
  8. export const INSIGHTS_METRICS = [
  9. 'd:spans/webvital.inp@millisecond',
  10. 'd:spans/duration@millisecond',
  11. 'd:spans/exclusive_time@millisecond',
  12. 'd:spans/http.response_content_length@byte',
  13. 'd:spans/http.decoded_response_content_length@byte',
  14. 'd:spans/http.response_transfer_size@byte',
  15. 'd:spans/cache.item_size@byte',
  16. 'g:spans/messaging.message.receive.latency@millisecond',
  17. 'g:spans/mobile.frames_delay@second',
  18. 'g:spans/mobile.total_frames@none',
  19. 'g:spans/mobile.frozen_frames@none',
  20. 'g:spans/mobile.slow_frames@none',
  21. ];
  22. export const isInsightsMetricAlert = (aggregate: string) => {
  23. const {mri, aggregation} = parseField(aggregate) ?? {};
  24. if (
  25. INSIGHTS_METRICS.includes(mri as string) ||
  26. INSIGHTS_METRICS_OPERATIONS.map(({value}) => value).includes(aggregation as string)
  27. ) {
  28. return true;
  29. }
  30. return false;
  31. };