replayProcessingError.tsx 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. import {useEffect} from 'react';
  2. import styled from '@emotion/styled';
  3. import * as Sentry from '@sentry/react';
  4. import {Alert} from 'sentry/components/alert';
  5. import ExternalLink from 'sentry/components/links/externalLink';
  6. import {t, tct} from 'sentry/locale';
  7. import {space} from 'sentry/styles/space';
  8. import {useReplayContext} from './replayContext';
  9. interface Props {
  10. processingErrors: readonly string[];
  11. className?: string;
  12. }
  13. export default function ReplayProcessingError({className, processingErrors}: Props) {
  14. const {replay} = useReplayContext();
  15. const {sdk} = replay?.getReplay() || {};
  16. useEffect(() => {
  17. Sentry.withScope(scope => {
  18. scope.setLevel('warning');
  19. scope.setFingerprint(['replay-processing-error']);
  20. sdk && scope.setTag('sdk.version', sdk.version);
  21. processingErrors.forEach(error => {
  22. Sentry.metrics.increment(`replay.processing-error`, 1, {
  23. tags: {
  24. 'sdk.version': sdk?.version ?? 'unknown',
  25. // There are only 2 different error types
  26. type:
  27. error.toLowerCase() === 'missing meta frame'
  28. ? 'missing-meta-frame'
  29. : 'insufficient-replay-frames',
  30. },
  31. });
  32. });
  33. });
  34. }, [processingErrors, sdk]);
  35. return (
  36. <StyledAlert type="error" showIcon className={className}>
  37. <Heading>{t('Replay Not Found')}</Heading>
  38. <p>{t('The replay you are looking for was not found.')}</p>
  39. <p>{t('The replay might be missing events or metadata.')}</p>
  40. <p>
  41. {t(
  42. 'Or there may be an issue loading the actions from the server, click to try loading the Replay again.'
  43. )}
  44. </p>
  45. <ul>
  46. <li>
  47. {t(
  48. `If you followed a link here, try hitting back and reloading the
  49. page. It's possible the resource was moved out from under you.`
  50. )}
  51. </li>
  52. <li>
  53. {tct('If all else fails, [link:contact us] with more details', {
  54. link: (
  55. <ExternalLink href="https://github.com/getsentry/sentry/issues/new/choose" />
  56. ),
  57. })}
  58. </li>
  59. </ul>
  60. </StyledAlert>
  61. );
  62. }
  63. const StyledAlert = styled(Alert)`
  64. margin: 0;
  65. height: 100%;
  66. `;
  67. const Heading = styled('h1')`
  68. font-size: ${p => p.theme.fontSizeLarge};
  69. line-height: 1.4;
  70. margin-bottom: ${space(1)};
  71. `;