import styled from '@emotion/styled'; import FieldGroup from 'sentry/components/forms/fieldGroup'; import ExternalLink from 'sentry/components/links/externalLink'; import QuestionTooltip from 'sentry/components/questionTooltip'; import {SegmentedControl} from 'sentry/components/segmentedControl'; import {t, tct} from 'sentry/locale'; import {space} from 'sentry/styles/space'; import useOrganization from 'sentry/utils/useOrganization'; import {openSamplingModeSwitchModal} from 'sentry/views/settings/dynamicSampling/samplingModeSwitchModal'; import {useHasDynamicSamplingWriteAccess} from 'sentry/views/settings/dynamicSampling/utils/access'; interface Props { /** * The initial target rate for the automatic sampling mode. */ initialTargetRate?: number; } export function SamplingModeField({initialTargetRate}: Props) { const {samplingMode} = useOrganization(); const hasAccess = useHasDynamicSamplingWriteAccess(); const handleSwitchMode = () => { openSamplingModeSwitchModal({ samplingMode: samplingMode === 'organization' ? 'project' : 'organization', initialTargetRate, }); }; return ( {t('Automatic')} ), } )} /> {t('Manual')} ), } )} /> ); } const ControlWrapper = styled('div')` width: max-content; `; const LabelWrapper = styled('div')` display: flex; align-items: center; gap: ${space(1)}; `;