metricsIngestionStopAlert.tsx 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import Alert from 'sentry/components/alert';
  2. import {Button} from 'sentry/components/button';
  3. import ExternalLink from 'sentry/components/links/externalLink';
  4. import {IconClose} from 'sentry/icons/iconClose';
  5. import {t, tct} from 'sentry/locale';
  6. import useDismissAlert from 'sentry/utils/useDismissAlert';
  7. const LOCAL_STORAGE_KEY = 'custom-metrics-stop-being-ingested-alert-dismissed';
  8. export function MetricsStopIngestionAlert() {
  9. const {dismiss, isDismissed} = useDismissAlert({
  10. key: LOCAL_STORAGE_KEY,
  11. expirationDays: 14, // 2 weeks
  12. });
  13. if (isDismissed) {
  14. return null;
  15. }
  16. return (
  17. <Alert
  18. type="error"
  19. showIcon
  20. trailingItems={
  21. <Button
  22. aria-label={t('Dismiss banner')}
  23. icon={<IconClose />}
  24. onClick={dismiss}
  25. size="zero"
  26. borderless
  27. />
  28. }
  29. >
  30. {
  31. // the exact date will be provided later
  32. tct(
  33. "We've released a new API to submit metrics. Metrics using with the old API will stop being ingested soon. Read the [link:FAQs] for more details.",
  34. {
  35. link: (
  36. <ExternalLink href="https://sentry.zendesk.com/hc/en-us/articles/26369339769883-Upcoming-API-Changes-to-Metrics" />
  37. ),
  38. }
  39. )
  40. }
  41. </Alert>
  42. );
  43. }