traceWarnings.tsx 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. import {useEffect} from 'react';
  2. import * as Sentry from '@sentry/react';
  3. import Alert from 'sentry/components/alert';
  4. import ExternalLink from 'sentry/components/links/externalLink';
  5. import {t, tct} from 'sentry/locale';
  6. import useOrganization from 'sentry/utils/useOrganization';
  7. import {traceAnalytics} from 'sentry/views/performance/newTraceDetails/traceAnalytics';
  8. import {TraceType} from './traceType';
  9. type TraceWarningsProps = {
  10. type: TraceType;
  11. };
  12. export function TraceWarnings({type}: TraceWarningsProps) {
  13. const organization = useOrganization();
  14. useEffect(() => {
  15. traceAnalytics.trackTraceWarningType(type, organization);
  16. }, [type, organization]);
  17. switch (type) {
  18. case TraceType.NO_ROOT:
  19. return (
  20. <Alert type="info" showIcon>
  21. <ExternalLink href="https://docs.sentry.io/product/performance/trace-view/#orphan-traces-and-broken-subtraces">
  22. {t(
  23. 'A root transaction is missing. Transactions linked by a dashed line have been orphaned and cannot be directly linked to the root.'
  24. )}
  25. </ExternalLink>
  26. </Alert>
  27. );
  28. case TraceType.BROKEN_SUBTRACES:
  29. return (
  30. <Alert type="info" showIcon>
  31. <ExternalLink href="https://docs.sentry.io/product/performance/trace-view/#orphan-traces-and-broken-subtraces">
  32. {t(
  33. 'This trace has broken subtraces. Transactions linked by a dashed line have been orphaned and cannot be directly linked to the root.'
  34. )}
  35. </ExternalLink>
  36. </Alert>
  37. );
  38. case TraceType.MULTIPLE_ROOTS:
  39. return (
  40. <Alert type="info" showIcon>
  41. <ExternalLink href="https://docs.sentry.io/product/sentry-basics/tracing/trace-view/#multiple-roots">
  42. {t('Multiple root transactions have been found with this trace ID.')}
  43. </ExternalLink>
  44. </Alert>
  45. );
  46. case TraceType.ONLY_ERRORS:
  47. return (
  48. <Alert type="info" showIcon>
  49. {tct(
  50. "The good news is we know these errors are related to each other. The bad news is that we can't tell you more than that. If you haven't already, [tracingLink: configure performance monitoring for your SDKs] to learn more about service interactions.",
  51. {
  52. tracingLink: (
  53. <ExternalLink href="https://docs.sentry.io/product/performance/getting-started/" />
  54. ),
  55. }
  56. )}
  57. </Alert>
  58. );
  59. case TraceType.ONE_ROOT:
  60. case TraceType.EMPTY_TRACE:
  61. return null;
  62. default:
  63. Sentry.captureMessage(`Unhandled trace type - ${type}`);
  64. return null;
  65. }
  66. }