Browse Source

feat(perf-issues): Add system options threshold to UI (#38744)

Splitting this off of #38742, this will let us manage these in
manage/settings for the time being. We're considering moving those
settings to _admin long-term though since it's not really required for
ST, since project options should be sufficient.
Kev 2 years ago
parent
commit
f9911be314
2 changed files with 44 additions and 2 deletions
  1. 4 2
      static/app/views/admin/adminSettings.tsx
  2. 40 0
      static/app/views/admin/options.tsx

+ 4 - 2
static/app/views/admin/adminSettings.tsx

@@ -98,8 +98,10 @@ export default class AdminSettings extends AsyncView<{}, State> {
               <PanelHeader>Performance Issues</PanelHeader>
               {fields['performance.issues.all.problem-detection']}
               {fields['performance.issues.all.problem-creation']}
-              {fields['performance.issues.n_plus_one.problem-detection']}
-              {fields['performance.issues.n_plus_one.problem-creation']}
+              {fields['performance.issues.n_plus_one_db.problem-detection']}
+              {fields['performance.issues.n_plus_one_db.problem-creation']}
+              {fields['performance.issues.n_plus_one_db.count_threshold']}
+              {fields['performance.issues.n_plus_one_db.duration_threshold']}
             </Panel>
           </Feature>
         </Form>

+ 40 - 0
static/app/views/admin/options.tsx

@@ -94,6 +94,46 @@ const performanceOptionDefinitions: Field[] = [
     ),
     ...HIGH_THROUGHPUT_RATE_OPTION,
   },
+  {
+    key: 'performance.issues.n_plus_one_db.problem-detection',
+    label: t('N+1 (DB) detection rate'),
+    help: t(
+      'Controls the rate at which performance problems are detected specifically for N+1 detection. Value of 0 will disable detection, a value of 1.0 fully enables it.'
+    ),
+    ...HIGH_THROUGHPUT_RATE_OPTION,
+  },
+  {
+    key: 'performance.issues.n_plus_one_db.problem-creation',
+    label: t('N+1 (DB) creation rate'),
+    help: t(
+      'Controls the rate at which performance issues are created specifically for N+1 detection. Value of 0 will disable creation, a value of 1.0 fully enables it.'
+    ),
+    ...HIGH_THROUGHPUT_RATE_OPTION,
+  },
+  {
+    key: 'performance.issues.n_plus_one_db.count_threshold',
+    label: t('N+1 (DB) count threshold'),
+    help: t(
+      'Detector threshold. Controls the number of spans required to trigger performance issues. This affects all organizations system-wide.'
+    ),
+    defaultValue: () => '5',
+    component: NumberField,
+    min: 0,
+    max: Number.MAX_SAFE_INTEGER,
+    step: 1,
+  },
+  {
+    key: 'performance.issues.n_plus_one_db.duration_threshold',
+    label: t('N+1 (DB) duration threshold'),
+    help: t(
+      'Detector threshold. Controls the threshold for the cumulative duration of involved spans required to trigger performance issues. This affects all organizations system-wide.'
+    ),
+    defaultValue: () => '100',
+    component: NumberField,
+    min: 0,
+    max: Number.MAX_SAFE_INTEGER,
+    step: 1,
+  },
 ];
 
 // This are ordered based on their display order visually