Browse Source

ref(sampling): Remove 'Filters &' copies (#35136)

Priscila Oliveira 2 years ago
parent
commit
763d71671a

+ 3 - 3
static/app/routes.tsx

@@ -484,9 +484,9 @@ function buildRoutes() {
         <Route path=":filterType/" />
       </Route>
       <Route
-        path="filters-and-sampling/"
-        name={t('Filters & Sampling')}
-        component={make(() => import('sentry/views/settings/project/filtersAndSampling'))}
+        path="sampling/"
+        name={t('Sampling')}
+        component={make(() => import('sentry/views/settings/project/sampling'))}
       />
       <Route
         path="issue-grouping/"

+ 2 - 2
static/app/types/project.tsx

@@ -1,11 +1,11 @@
 import type {PlatformKey} from 'sentry/data/platformCategories';
 
 import type {TimeseriesValue} from './core';
-import type {DynamicSamplingRules} from './dynamicSampling';
 import type {SDKUpdatesSuggestion} from './event';
 import type {Plugin} from './integrations';
 import type {Organization, Team} from './organization';
 import type {Deploy, Release} from './release';
+import type {SamplingRules} from './sampling';
 
 // Minimal project representation for use with avatars.
 export type AvatarProject = {
@@ -21,7 +21,7 @@ export type Project = {
   // XXX: These are part of the DetailedProject serializer
   dynamicSampling: {
     next_id: number;
-    rules: DynamicSamplingRules;
+    rules: SamplingRules;
   } | null;
   environments: string[];
   eventProcessing: {

+ 50 - 50
static/app/types/dynamicSampling.tsx → static/app/types/sampling.tsx

@@ -1,4 +1,4 @@
-export enum DynamicSamplingRuleType {
+export enum SamplingRuleType {
   /**
    * The rule applies to traces (transaction events considered in the context of a trace)
    */
@@ -9,14 +9,14 @@ export enum DynamicSamplingRuleType {
   TRANSACTION = 'transaction',
 }
 
-export enum DynamicSamplingConditionOperator {
+export enum SamplingConditionOperator {
   /**
    * Combine multiple sub-conditions with the operator 'and'
    */
   AND = 'and',
 }
 
-export enum DynamicSamplingRuleOperator {
+export enum SamplingRuleOperator {
   /**
    * The first rule on the list
    */
@@ -31,7 +31,7 @@ export enum DynamicSamplingRuleOperator {
   ELSE = 'else',
 }
 
-export enum DynamicSamplingInnerOperator {
+export enum SamplingInnerOperator {
   /**
    * It uses glob matches for checking (e.g. releases use glob matching "1.1.*" will match release 1.1.1 and 1.1.2)
    */
@@ -51,7 +51,7 @@ export enum DynamicSamplingInnerOperator {
  * Default naming strategy should be based on the path in the event, prefixed with `event.`.
  * To see the path in the event, click on the JSON button on the issue details page.
  */
-export enum DynamicSamplingInnerName {
+export enum SamplingInnerName {
   TRACE_RELEASE = 'trace.release',
   TRACE_ENVIRONMENT = 'trace.environment',
   TRACE_USER_ID = 'trace.user.id',
@@ -88,80 +88,80 @@ export enum LegacyBrowser {
   ANDROID_PRE_4 = 'android_pre_4',
 }
 
-type DynamicSamplingConditionLogicalInnerGlob = {
+type SamplingConditionLogicalInnerGlob = {
   name:
-    | DynamicSamplingInnerName.EVENT_RELEASE
-    | DynamicSamplingInnerName.TRACE_RELEASE
-    | DynamicSamplingInnerName.EVENT_TRANSACTION
-    | DynamicSamplingInnerName.TRACE_TRANSACTION
-    | DynamicSamplingInnerName.EVENT_OS_NAME
-    | DynamicSamplingInnerName.EVENT_OS_VERSION
-    | DynamicSamplingInnerName.EVENT_DEVICE_FAMILY
-    | DynamicSamplingInnerName.EVENT_DEVICE_NAME
-    | DynamicSamplingInnerName.EVENT_CUSTOM_TAG
+    | SamplingInnerName.EVENT_RELEASE
+    | SamplingInnerName.TRACE_RELEASE
+    | SamplingInnerName.EVENT_TRANSACTION
+    | SamplingInnerName.TRACE_TRANSACTION
+    | SamplingInnerName.EVENT_OS_NAME
+    | SamplingInnerName.EVENT_OS_VERSION
+    | SamplingInnerName.EVENT_DEVICE_FAMILY
+    | SamplingInnerName.EVENT_DEVICE_NAME
+    | SamplingInnerName.EVENT_CUSTOM_TAG
     | string; // for custom tags
-  op: DynamicSamplingInnerOperator.GLOB_MATCH;
+  op: SamplingInnerOperator.GLOB_MATCH;
   value: Array<string>;
 };
 
-type DynamicSamplingConditionLogicalInnerEq = {
+type SamplingConditionLogicalInnerEq = {
   name:
-    | DynamicSamplingInnerName.EVENT_ENVIRONMENT
-    | DynamicSamplingInnerName.TRACE_ENVIRONMENT
-    | DynamicSamplingInnerName.EVENT_USER_ID
-    | DynamicSamplingInnerName.TRACE_USER_ID
-    | DynamicSamplingInnerName.EVENT_USER_SEGMENT
-    | DynamicSamplingInnerName.TRACE_USER_SEGMENT;
-  op: DynamicSamplingInnerOperator.EQUAL;
+    | SamplingInnerName.EVENT_ENVIRONMENT
+    | SamplingInnerName.TRACE_ENVIRONMENT
+    | SamplingInnerName.EVENT_USER_ID
+    | SamplingInnerName.TRACE_USER_ID
+    | SamplingInnerName.EVENT_USER_SEGMENT
+    | SamplingInnerName.TRACE_USER_SEGMENT;
+  op: SamplingInnerOperator.EQUAL;
   options: {
     ignoreCase: boolean;
   };
   value: Array<string>;
 };
 
-type DynamicSamplingConditionLogicalInnerEqBoolean = {
+type SamplingConditionLogicalInnerEqBoolean = {
   name:
-    | DynamicSamplingInnerName.EVENT_BROWSER_EXTENSIONS
-    | DynamicSamplingInnerName.EVENT_LOCALHOST
-    | DynamicSamplingInnerName.EVENT_WEB_CRAWLERS;
-  op: DynamicSamplingInnerOperator.EQUAL;
+    | SamplingInnerName.EVENT_BROWSER_EXTENSIONS
+    | SamplingInnerName.EVENT_LOCALHOST
+    | SamplingInnerName.EVENT_WEB_CRAWLERS;
+  op: SamplingInnerOperator.EQUAL;
   value: boolean;
 };
 
-type DynamicSamplingConditionLogicalInnerCustom = {
+type SamplingConditionLogicalInnerCustom = {
   name:
-    | DynamicSamplingInnerName.EVENT_CSP
-    | DynamicSamplingInnerName.EVENT_ERROR_MESSAGES
-    | DynamicSamplingInnerName.EVENT_IP_ADDRESSES;
-  op: DynamicSamplingInnerOperator.CUSTOM;
+    | SamplingInnerName.EVENT_CSP
+    | SamplingInnerName.EVENT_ERROR_MESSAGES
+    | SamplingInnerName.EVENT_IP_ADDRESSES;
+  op: SamplingInnerOperator.CUSTOM;
   value: Array<string>;
 };
 
-type DynamicSamplingConditionLogicalInnerCustomLegacyBrowser = {
-  name: DynamicSamplingInnerName.EVENT_LEGACY_BROWSER;
-  op: DynamicSamplingInnerOperator.CUSTOM;
+type SamplingConditionLogicalInnerCustomLegacyBrowser = {
+  name: SamplingInnerName.EVENT_LEGACY_BROWSER;
+  op: SamplingInnerOperator.CUSTOM;
   value: Array<LegacyBrowser>;
 };
 
-export type DynamicSamplingConditionLogicalInner =
-  | DynamicSamplingConditionLogicalInnerGlob
-  | DynamicSamplingConditionLogicalInnerEq
-  | DynamicSamplingConditionLogicalInnerEqBoolean
-  | DynamicSamplingConditionLogicalInnerCustom
-  | DynamicSamplingConditionLogicalInnerCustomLegacyBrowser;
+export type SamplingConditionLogicalInner =
+  | SamplingConditionLogicalInnerGlob
+  | SamplingConditionLogicalInnerEq
+  | SamplingConditionLogicalInnerEqBoolean
+  | SamplingConditionLogicalInnerCustom
+  | SamplingConditionLogicalInnerCustomLegacyBrowser;
 
-export type DynamicSamplingCondition = {
-  inner: Array<DynamicSamplingConditionLogicalInner>;
-  op: DynamicSamplingConditionOperator.AND;
+export type SamplingCondition = {
+  inner: Array<SamplingConditionLogicalInner>;
+  op: SamplingConditionOperator.AND;
 };
 
-export type DynamicSamplingRule = {
+export type SamplingRule = {
   /**
    * It is a possibly empty list of conditions to which the rule applies.
    * The conditions are combined using the and operator (so all the conditions must be satisfied for the rule to apply).
    * If the conditions field is an empty list the rule applies for all events that satisfy the projectIds and the ty fields.
    */
-  condition: DynamicSamplingCondition;
+  condition: SamplingCondition;
   /**
    * This is a unique number within a project
    */
@@ -173,11 +173,11 @@ export type DynamicSamplingRule = {
   /**
    * Describes the type of rule
    */
-  type: DynamicSamplingRuleType;
+  type: SamplingRuleType;
   /**
    * A rule can be disabled if it doesn't contain a condition (Else case)
    */
   disabled?: boolean;
 };
 
-export type DynamicSamplingRules = Array<DynamicSamplingRule>;
+export type SamplingRules = Array<SamplingRule>;

+ 3 - 3
static/app/utils/analytics/samplingAnalyticsEvents.tsx

@@ -1,7 +1,7 @@
-import {DynamicSamplingInnerName} from 'sentry/types/dynamicSampling';
+import {SamplingInnerName} from 'sentry/types/sampling';
 
 type Rule = {
-  conditions: DynamicSamplingInnerName[] | string[];
+  conditions: SamplingInnerName[] | string[];
   conditions_stringified: string;
   project_id: string;
   sampling_rate: number | null;
@@ -9,7 +9,7 @@ type Rule = {
 
 export type SamplingEventParameters = {
   'sampling.settings.condition.add': {
-    conditions: DynamicSamplingInnerName[] | string[];
+    conditions: SamplingInnerName[] | string[];
     project_id: string;
   };
   'sampling.settings.rule.create': Rule;

+ 1 - 1
static/app/views/performance/landing/samplingModal.tsx

@@ -40,7 +40,7 @@ const SamplingModal = (props: Props) => {
       <Body>
         <Instruction>
           {tct(
-            "The visualizations shown are based on your data without any filters or sampling. This does not contribute to your quota usage but transaction details are limited. If you'd like to improve accuracy, we recommend adding more transactions to your quota. or modifying your dataset through [projectSettings: Filters & Sampling in settings].",
+            "The visualizations shown are based on your data without any filters or sampling. This does not contribute to your quota usage but transaction details are limited. If you'd like to improve accuracy, we recommend adding more transactions to your quota. or modifying your dataset through [projectSettings: Sampling in settings].",
             {
               projectSettings: (
                 <Link

+ 2 - 2
static/app/views/settings/project/navigationConfiguration.tsx

@@ -68,8 +68,8 @@ export default function getConfiguration({
           ),
         },
         {
-          path: `${pathPrefix}/filters-and-sampling/`,
-          title: t('Filters & Sampling'),
+          path: `${pathPrefix}/sampling/`,
+          title: t('Sampling'),
           show: () => !!organization?.features?.includes('filters-and-sampling'),
           description: t("Manage an organization's inbound data"),
           badge: () => 'new',

+ 3 - 7
static/app/views/settings/project/filtersAndSampling/index.tsx → static/app/views/settings/project/sampling/index.tsx

@@ -6,7 +6,7 @@ import {t} from 'sentry/locale';
 import {Project} from 'sentry/types';
 import useOrganization from 'sentry/utils/useOrganization';
 
-import FiltersAndSampling from './filtersAndSampling';
+import {Sampling} from './sampling';
 
 type Props = {
   project: Project;
@@ -23,17 +23,13 @@ function Index(props: Props) {
         <FeatureDisabled
           alert={PanelAlert}
           features={['organization:filters-and-sampling']}
-          featureName={t('Filters & Sampling')}
+          featureName={t('Sampling')}
         />
       )}
     >
       <Access organization={organization} access={['project:write']}>
         {({hasAccess}) => (
-          <FiltersAndSampling
-            {...props}
-            hasAccess={hasAccess}
-            organization={organization}
-          />
+          <Sampling {...props} hasAccess={hasAccess} organization={organization} />
         )}
       </Access>
     </Feature>

+ 15 - 16
static/app/views/settings/project/filtersAndSampling/modal/conditions.tsx → static/app/views/settings/project/sampling/modal/conditions.tsx

@@ -8,7 +8,7 @@ import {IconDelete} from 'sentry/icons/iconDelete';
 import {t} from 'sentry/locale';
 import space from 'sentry/styles/space';
 import {Project, Tag} from 'sentry/types';
-import {DynamicSamplingInnerName, LegacyBrowser} from 'sentry/types/dynamicSampling';
+import {LegacyBrowser, SamplingInnerName} from 'sentry/types/sampling';
 import useApi from 'sentry/utils/useApi';
 
 import {
@@ -24,7 +24,7 @@ import {TagValueAutocomplete} from './tagValueAutocomplete';
 import {getMatchFieldPlaceholder, getTagKey} from './utils';
 
 type Condition = {
-  category: DynamicSamplingInnerName | string; // string is used for custom tags
+  category: SamplingInnerName | string; // string is used for custom tags
   legacyBrowsers?: Array<LegacyBrowser>;
   match?: string;
 };
@@ -73,26 +73,25 @@ function Conditions({
     <Fragment>
       {conditions.map((condition, index) => {
         const {category, match, legacyBrowsers} = condition;
-        const displayLegacyBrowsers =
-          category === DynamicSamplingInnerName.EVENT_LEGACY_BROWSER;
+        const displayLegacyBrowsers = category === SamplingInnerName.EVENT_LEGACY_BROWSER;
         const isCustomTag = isCustomTagName(category);
 
         const isBooleanField =
-          category === DynamicSamplingInnerName.EVENT_BROWSER_EXTENSIONS ||
-          category === DynamicSamplingInnerName.EVENT_LOCALHOST ||
-          category === DynamicSamplingInnerName.EVENT_WEB_CRAWLERS;
+          category === SamplingInnerName.EVENT_BROWSER_EXTENSIONS ||
+          category === SamplingInnerName.EVENT_LOCALHOST ||
+          category === SamplingInnerName.EVENT_WEB_CRAWLERS;
         displayLegacyBrowsers;
 
         const isAutoCompleteField =
-          category === DynamicSamplingInnerName.EVENT_ENVIRONMENT ||
-          category === DynamicSamplingInnerName.EVENT_RELEASE ||
-          category === DynamicSamplingInnerName.EVENT_TRANSACTION ||
-          category === DynamicSamplingInnerName.EVENT_OS_NAME ||
-          category === DynamicSamplingInnerName.EVENT_DEVICE_FAMILY ||
-          category === DynamicSamplingInnerName.EVENT_DEVICE_NAME ||
-          category === DynamicSamplingInnerName.TRACE_ENVIRONMENT ||
-          category === DynamicSamplingInnerName.TRACE_RELEASE ||
-          category === DynamicSamplingInnerName.TRACE_TRANSACTION ||
+          category === SamplingInnerName.EVENT_ENVIRONMENT ||
+          category === SamplingInnerName.EVENT_RELEASE ||
+          category === SamplingInnerName.EVENT_TRANSACTION ||
+          category === SamplingInnerName.EVENT_OS_NAME ||
+          category === SamplingInnerName.EVENT_DEVICE_FAMILY ||
+          category === SamplingInnerName.EVENT_DEVICE_NAME ||
+          category === SamplingInnerName.TRACE_ENVIRONMENT ||
+          category === SamplingInnerName.TRACE_RELEASE ||
+          category === SamplingInnerName.TRACE_TRANSACTION ||
           isCustomTag;
 
         return (

+ 36 - 36
static/app/views/settings/project/filtersAndSampling/modal/index.tsx → static/app/views/settings/project/sampling/modal/index.tsx

@@ -11,15 +11,15 @@ import Tooltip from 'sentry/components/tooltip';
 import {t, tct} from 'sentry/locale';
 import space from 'sentry/styles/space';
 import {
-  DynamicSamplingConditionOperator,
-  DynamicSamplingInnerName,
-  DynamicSamplingRule,
-  DynamicSamplingRules,
-  DynamicSamplingRuleType,
-} from 'sentry/types/dynamicSampling';
+  SamplingConditionOperator,
+  SamplingInnerName,
+  SamplingRule,
+  SamplingRules,
+  SamplingRuleType,
+} from 'sentry/types/sampling';
 import {defined} from 'sentry/utils';
 
-import {DYNAMIC_SAMPLING_DOC_LINK} from '../utils';
+import {SAMPLING_DOC_LINK} from '../utils';
 
 import RuleModal from './ruleModal';
 import {generateConditionCategoriesOptions, getNewCondition} from './utils';
@@ -35,14 +35,14 @@ type Props = Omit<
   | 'emptyMessage'
   | 'onChage'
 > & {
-  rules: DynamicSamplingRules;
+  rules: SamplingRules;
 };
 
 function TransactionRuleModal({rule: ruleToUpdate, rules, ...props}: Props) {
   const theme = useTheme();
 
   const [tracing, setTracing] = useState(
-    ruleToUpdate ? ruleToUpdate.type === DynamicSamplingRuleType.TRACE : true
+    ruleToUpdate ? ruleToUpdate.type === SamplingRuleType.TRACE : true
   );
 
   const [isTracingDisabled, setIsTracingDisabled] = useState(
@@ -64,12 +64,12 @@ function TransactionRuleModal({rule: ruleToUpdate, rules, ...props}: Props) {
       return;
     }
 
-    const newRule: DynamicSamplingRule = {
+    const newRule: SamplingRule = {
       // All new/updated rules must have id equal to 0
       id: 0,
-      type: tracing ? DynamicSamplingRuleType.TRACE : DynamicSamplingRuleType.TRANSACTION,
+      type: tracing ? SamplingRuleType.TRACE : SamplingRuleType.TRANSACTION,
       condition: {
-        op: DynamicSamplingConditionOperator.AND,
+        op: SamplingConditionOperator.AND,
         inner: !conditions.length ? [] : conditions.map(getNewCondition),
       },
       sampleRate: sampleRate / 100,
@@ -81,7 +81,7 @@ function TransactionRuleModal({rule: ruleToUpdate, rules, ...props}: Props) {
 
     const [transactionTraceRules, individualTransactionRules] = partition(
       newTransactionRules,
-      transactionRule => transactionRule.type === DynamicSamplingRuleType.TRACE
+      transactionRule => transactionRule.type === SamplingRuleType.TRACE
     );
 
     const newRules = [...transactionTraceRules, ...individualTransactionRules];
@@ -102,30 +102,30 @@ function TransactionRuleModal({rule: ruleToUpdate, rules, ...props}: Props) {
       conditionCategories={generateConditionCategoriesOptions(
         tracing
           ? [
-              DynamicSamplingInnerName.TRACE_RELEASE,
-              DynamicSamplingInnerName.TRACE_ENVIRONMENT,
-              DynamicSamplingInnerName.TRACE_USER_ID,
-              DynamicSamplingInnerName.TRACE_USER_SEGMENT,
-              DynamicSamplingInnerName.TRACE_TRANSACTION,
+              SamplingInnerName.TRACE_RELEASE,
+              SamplingInnerName.TRACE_ENVIRONMENT,
+              SamplingInnerName.TRACE_USER_ID,
+              SamplingInnerName.TRACE_USER_SEGMENT,
+              SamplingInnerName.TRACE_TRANSACTION,
             ]
           : [
-              DynamicSamplingInnerName.EVENT_RELEASE,
-              DynamicSamplingInnerName.EVENT_ENVIRONMENT,
-              DynamicSamplingInnerName.EVENT_USER_ID,
-              DynamicSamplingInnerName.EVENT_USER_SEGMENT,
-              DynamicSamplingInnerName.EVENT_BROWSER_EXTENSIONS,
-              DynamicSamplingInnerName.EVENT_LOCALHOST,
-              DynamicSamplingInnerName.EVENT_LEGACY_BROWSER,
-              DynamicSamplingInnerName.EVENT_WEB_CRAWLERS,
-              DynamicSamplingInnerName.EVENT_IP_ADDRESSES,
-              DynamicSamplingInnerName.EVENT_CSP,
-              DynamicSamplingInnerName.EVENT_ERROR_MESSAGES,
-              DynamicSamplingInnerName.EVENT_TRANSACTION,
-              DynamicSamplingInnerName.EVENT_OS_NAME,
-              DynamicSamplingInnerName.EVENT_OS_VERSION,
-              DynamicSamplingInnerName.EVENT_DEVICE_FAMILY,
-              DynamicSamplingInnerName.EVENT_DEVICE_NAME,
-              DynamicSamplingInnerName.EVENT_CUSTOM_TAG,
+              SamplingInnerName.EVENT_RELEASE,
+              SamplingInnerName.EVENT_ENVIRONMENT,
+              SamplingInnerName.EVENT_USER_ID,
+              SamplingInnerName.EVENT_USER_SEGMENT,
+              SamplingInnerName.EVENT_BROWSER_EXTENSIONS,
+              SamplingInnerName.EVENT_LOCALHOST,
+              SamplingInnerName.EVENT_LEGACY_BROWSER,
+              SamplingInnerName.EVENT_WEB_CRAWLERS,
+              SamplingInnerName.EVENT_IP_ADDRESSES,
+              SamplingInnerName.EVENT_CSP,
+              SamplingInnerName.EVENT_ERROR_MESSAGES,
+              SamplingInnerName.EVENT_TRANSACTION,
+              SamplingInnerName.EVENT_OS_NAME,
+              SamplingInnerName.EVENT_OS_VERSION,
+              SamplingInnerName.EVENT_DEVICE_FAMILY,
+              SamplingInnerName.EVENT_DEVICE_NAME,
+              SamplingInnerName.EVENT_CUSTOM_TAG,
             ]
       )}
       rule={ruleToUpdate}
@@ -157,7 +157,7 @@ function TransactionRuleModal({rule: ruleToUpdate, rules, ...props}: Props) {
                 {
                   link: (
                     <ExternalLink
-                      href={DYNAMIC_SAMPLING_DOC_LINK}
+                      href={SAMPLING_DOC_LINK}
                       onClick={event => event.stopPropagation()}
                     />
                   ),

+ 1 - 1
static/app/views/settings/project/filtersAndSampling/modal/legacyBrowsers.tsx → static/app/views/settings/project/sampling/modal/legacyBrowsers.tsx

@@ -5,7 +5,7 @@ import BulkController from 'sentry/components/bulkController';
 import Switch from 'sentry/components/switchButton';
 import {t} from 'sentry/locale';
 import space from 'sentry/styles/space';
-import {LegacyBrowser} from 'sentry/types/dynamicSampling';
+import {LegacyBrowser} from 'sentry/types/sampling';
 
 import {LEGACY_BROWSER_LIST} from '../utils';
 

Some files were not shown because too many files changed in this diff