diff --git a/src/sentry/dynamic_sampling/rules/utils.py b/src/sentry/dynamic_sampling/rules/utils.py index 8329911463ae7c..9b660bc3452e3c 100644 --- a/src/sentry/dynamic_sampling/rules/utils.py +++ b/src/sentry/dynamic_sampling/rules/utils.py @@ -79,16 +79,12 @@ class RuleType(Enum): REVERSE_RESERVED_IDS = {value: key for key, value in RESERVED_IDS.items()} -SamplingValueType = Literal["sampleRate", "factor", "reservoir", "minimumSampleRate"] +SamplingValueType = Literal["sampleRate", "factor", "minimumSampleRate"] -# (RaduW) Maybe we can split in two types, one for reservoir and one for sampleRate and factor -# Wanted to do this but couldn't think of three good names for the types (SamplingValue, ReservoirSamplingValue and ? -# some type name for the old SamplingValue type) class SamplingValue(TypedDict): type: SamplingValueType - value: NotRequired[float] - limit: NotRequired[int] + value: float class TimeRange(TypedDict): diff --git a/static/gsAdmin/views/dynamicSamplingPanel.spec.tsx b/static/gsAdmin/views/dynamicSamplingPanel.spec.tsx index e850f1d7469f62..a56f91e3aeb8f2 100644 --- a/static/gsAdmin/views/dynamicSamplingPanel.spec.tsx +++ b/static/gsAdmin/views/dynamicSamplingPanel.spec.tsx @@ -146,8 +146,8 @@ describe('Dynamic Sampling Panel', () => { const rule1 = { samplingValue: { - type: 'reservoir', - limit: 100, + type: 'minimumSampleRate', + value: 1, }, type: 'transaction', id: 3005, @@ -163,8 +163,8 @@ describe('Dynamic Sampling Panel', () => { const rule2 = { samplingValue: { - type: 'reservoir', - limit: 300, + type: 'minimumSampleRate', + value: 0.5, }, type: 'transaction', id: 3001, @@ -290,8 +290,9 @@ describe('Dynamic Sampling Panel', () => { expect(timeRanges[0]).toHaveTextContent('Start:Jun 19, 2024 9:03 AM'); expect(timeRanges[0]).toHaveTextContent('End:Jun 21, 2024 9:03 AM'); - // Check that the limit is displayed if available - const limits = screen.queryAllByTestId('limit'); - expect(limits[0]).toHaveTextContent('Limit:100'); + // Check that minimum sample rate values are displayed. + expect(screen.getAllByText('Minimum Sample Rate')).toHaveLength(2); + expect(screen.getByText('50%')).toBeInTheDocument(); + expect(screen.getAllByText('100%')).toHaveLength(3); }); }); diff --git a/static/gsAdmin/views/dynamicSamplingPanel.tsx b/static/gsAdmin/views/dynamicSamplingPanel.tsx index 221f7419e70eb7..433071045ea809 100644 --- a/static/gsAdmin/views/dynamicSamplingPanel.tsx +++ b/static/gsAdmin/views/dynamicSamplingPanel.tsx @@ -50,11 +50,10 @@ type RuleV2 = { }; id: number; samplingValue: { - type: 'factor' | 'sampleRate' | 'reservoir'; + type: 'factor' | 'sampleRate' | 'minimumSampleRate'; value: number; - limit?: number; }; - type: 'trace' | 'transaction'; + type: 'trace' | 'transaction' | 'project'; timeRange?: { end: string; start: string; @@ -335,9 +334,6 @@ function DynamicSamplingRulesTable({ ) { return `${round(samplingValue.value * 100)}%`; } - if (samplingValue.type === 'reservoir') { - return '100%'; - } return `* ${round(samplingValue.value)}`; }; @@ -345,12 +341,12 @@ function DynamicSamplingRulesTable({ if (getRuleType(rule) === RuleType.BOOST_LOW_VOLUME_PROJECTS) { return 0; } - if (rule.samplingValue.type === 'sampleRate') { + if ( + rule.samplingValue.type === 'sampleRate' || + rule.samplingValue.type === 'minimumSampleRate' + ) { return round(rule.samplingValue.value - baseSampleRate); } - if (rule.samplingValue.type === 'reservoir') { - return 1; - } return round(rule.samplingValue.value - 1); }; @@ -380,12 +376,6 @@ function DynamicSamplingRulesTable({ {row.type} - {defined(row.samplingValue.limit) && ( - - Limit: - {row.samplingValue.limit} - - )} {defined(row.timeRange) && (