index.tsx 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. import {Fragment} from 'react';
  2. import styled from '@emotion/styled';
  3. import {Alert} from 'sentry/components/alert';
  4. import FeatureBadge from 'sentry/components/badge/featureBadge';
  5. import {LinkButton} from 'sentry/components/button';
  6. import SentryDocumentTitle from 'sentry/components/sentryDocumentTitle';
  7. import {t} from 'sentry/locale';
  8. import {space} from 'sentry/styles/space';
  9. import {hasDynamicSamplingCustomFeature} from 'sentry/utils/dynamicSampling/features';
  10. import useOrganization from 'sentry/utils/useOrganization';
  11. import SettingsPageHeader from 'sentry/views/settings/components/settingsPageHeader';
  12. import {OrganizationSampling} from 'sentry/views/settings/dynamicSampling/organizationSampling';
  13. import {ProjectSampling} from 'sentry/views/settings/dynamicSampling/projectSampling';
  14. import {useHasDynamicSamplingWriteAccess} from 'sentry/views/settings/dynamicSampling/utils/access';
  15. export default function DynamicSamplingSettings() {
  16. const organization = useOrganization();
  17. const hasWriteAccess = useHasDynamicSamplingWriteAccess();
  18. if (!hasDynamicSamplingCustomFeature(organization)) {
  19. return <Alert type="warning">{t("You don't have access to this feature")}</Alert>;
  20. }
  21. return (
  22. <Fragment>
  23. <SentryDocumentTitle title={t('Dynamic Sampling')} orgSlug={organization.slug} />
  24. <SettingsPageHeader
  25. title={
  26. <Fragment>
  27. {t('Dynamic Sampling')}
  28. <FeatureBadge type="alpha" />
  29. </Fragment>
  30. }
  31. action={
  32. <LinkButton
  33. external
  34. href="https://docs.sentry.io/product/performance/retention-priorities/"
  35. >
  36. {t('Read the docs')}
  37. </LinkButton>
  38. }
  39. />
  40. {!hasWriteAccess && (
  41. <Alert type="warning">
  42. {t(
  43. 'These settings can only be edited by users with the organization owner or manager role.'
  44. )}
  45. </Alert>
  46. )}
  47. <Paragraph>
  48. {t(
  49. 'Dynamic Sampling lets you manage span storage in Sentry. This prioritizes important events and increases visibility into lower-volume projects, keeping the most relevant data while minimizing redundancy. You can customize sample rates and priorities in the settings to control which data is retained.'
  50. )}
  51. </Paragraph>
  52. {organization.samplingMode === 'organization' ? (
  53. <OrganizationSampling />
  54. ) : (
  55. <ProjectSampling />
  56. )}
  57. </Fragment>
  58. );
  59. }
  60. const Paragraph = styled('p')`
  61. margin-bottom: ${space(1.5)};
  62. `;