index.tsx 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import {Fragment} from 'react';
  2. import {Alert} from 'sentry/components/alert';
  3. import FeatureBadge from 'sentry/components/badge/featureBadge';
  4. import {LinkButton} from 'sentry/components/button';
  5. import SentryDocumentTitle from 'sentry/components/sentryDocumentTitle';
  6. import {t} from 'sentry/locale';
  7. import {hasDynamicSamplingCustomFeature} from 'sentry/utils/dynamicSampling/features';
  8. import useOrganization from 'sentry/utils/useOrganization';
  9. import SettingsPageHeader from 'sentry/views/settings/components/settingsPageHeader';
  10. import {OrganizationSampling} from 'sentry/views/settings/dynamicSampling/organizationSampling';
  11. import {ProjectSampling} from 'sentry/views/settings/dynamicSampling/projectSampling';
  12. import {useHasDynamicSamplingWriteAccess} from 'sentry/views/settings/dynamicSampling/utils/access';
  13. export default function DynamicSamplingSettings() {
  14. const organization = useOrganization();
  15. const hasWriteAccess = useHasDynamicSamplingWriteAccess();
  16. if (!hasDynamicSamplingCustomFeature(organization)) {
  17. return <Alert type="warning">{t("You don't have access to this feature")}</Alert>;
  18. }
  19. return (
  20. <Fragment>
  21. <SentryDocumentTitle title={t('Dynamic Sampling')} orgSlug={organization.slug} />
  22. <SettingsPageHeader
  23. title={
  24. <Fragment>
  25. {t('Dynamic Sampling')}
  26. <FeatureBadge type="alpha" />
  27. </Fragment>
  28. }
  29. action={
  30. <LinkButton
  31. external
  32. href="https://docs.sentry.io/product/performance/retention-priorities/"
  33. >
  34. {t('Read the docs')}
  35. </LinkButton>
  36. }
  37. />
  38. {!hasWriteAccess && (
  39. <Alert type="warning">
  40. {t(
  41. 'These settings can only be edited by users with the organization owner or manager role.'
  42. )}
  43. </Alert>
  44. )}
  45. <p>
  46. {t(
  47. 'Dynamic sampling adaptively reduces the number of spans stored in Sentry without changing SDK sample rates. It allows you to keep the most relevant samples and obtain accurate high-level insights while limiting redundancy and stored span volume. You can customize sample rates and priorities in these settings to control which data is stored.'
  48. )}
  49. </p>
  50. {organization.samplingMode === 'organization' ? (
  51. <OrganizationSampling />
  52. ) : (
  53. <ProjectSampling />
  54. )}
  55. </Fragment>
  56. );
  57. }