samplingProjectIncompatibleAlert.tsx 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import {useEffect} from 'react';
  2. import Alert from 'sentry/components/alert';
  3. import Button from 'sentry/components/button';
  4. import {t} from 'sentry/locale';
  5. import {Organization, Project} from 'sentry/types';
  6. import trackAdvancedAnalyticsEvent from 'sentry/utils/analytics/trackAdvancedAnalyticsEvent';
  7. import {SERVER_SIDE_SAMPLING_DOC_LINK} from './utils';
  8. type Props = {
  9. isProjectIncompatible: boolean;
  10. organization: Organization;
  11. projectId: Project['id'];
  12. };
  13. export function SamplingProjectIncompatibleAlert({
  14. isProjectIncompatible,
  15. organization,
  16. projectId,
  17. }: Props) {
  18. useEffect(() => {
  19. if (isProjectIncompatible) {
  20. trackAdvancedAnalyticsEvent('sampling.sdk.incompatible.alert', {
  21. organization,
  22. project_id: projectId,
  23. });
  24. }
  25. }, [isProjectIncompatible, organization, projectId]);
  26. if (!isProjectIncompatible) {
  27. return null;
  28. }
  29. return (
  30. <Alert
  31. data-test-id="incompatible-project-alert"
  32. type="error"
  33. showIcon
  34. trailingItems={
  35. <Button
  36. href={`${SERVER_SIDE_SAMPLING_DOC_LINK}getting-started/#current-limitations`}
  37. priority="link"
  38. borderless
  39. external
  40. >
  41. {t('Learn More')}
  42. </Button>
  43. }
  44. >
  45. {t('Your project is currently incompatible with Dynamic Sampling.')}
  46. </Alert>
  47. );
  48. }