Skip to content

Commit 1c344e7

Browse files
authored
chore(perf-issues): Allow Perf Issue Admin UI without the access flag (#92118)
Requires #92116. The flag is GA'd so nothing should be changing for customers.
1 parent b80e34b commit 1c344e7

File tree

3 files changed

+31
-54
lines changed

3 files changed

+31
-54
lines changed

static/app/types/project.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,6 @@ export type Project = {
8080
latestDeploys?: Record<string, Pick<Deploy, 'dateFinished' | 'version'>> | null;
8181
latestRelease?: {version: string} | null;
8282
options?: Record<string, boolean | string>;
83-
performanceIssueCreationRate?: number;
84-
performanceIssueCreationThroughPlatform?: boolean;
85-
performanceIssueSendToPlatform?: boolean;
8683
securityToken?: string;
8784
securityTokenHeader?: string;
8885
sessionStats?: {

static/app/views/settings/projectPerformance/projectPerformance.spec.tsx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ describe('projectPerformance', function () {
163163
MockApiClient.addMockResponse({
164164
url: '/projects/org-slug/project-slug/performance-issues/configure/',
165165
method: 'GET',
166-
body: {n_plus_one_db_queries_detection_enabled: false},
166+
body: {transaction_duration_regression_detection_enabled: false},
167167
statusCode: 200,
168168
});
169169
const performanceIssuesPutMock = MockApiClient.addMockResponse({
@@ -173,22 +173,23 @@ describe('projectPerformance', function () {
173173

174174
render(<ProjectPerformance />, {
175175
organization: org,
176-
177176
initialRouterConfig,
178177
});
179178

180-
expect(await screen.findByText('N+1 DB Queries Detection')).toBeInTheDocument();
181-
expect(screen.getByText('Slow DB Queries Detection')).toBeInTheDocument();
179+
expect(
180+
await screen.findByText('Transaction Duration Regression Enabled')
181+
).toBeInTheDocument();
182+
expect(screen.getByText('Function Duration Regression Enabled')).toBeInTheDocument();
182183

183184
const toggle = screen.getByRole('checkbox', {
184-
name: 'N+1 DB Queries Detection',
185+
name: 'Transaction Duration Regression Enabled',
185186
});
186187
await userEvent.click(toggle);
187188

188189
expect(performanceIssuesPutMock).toHaveBeenCalledWith(
189190
'/projects/org-slug/project-slug/performance-issues/configure/',
190191
expect.objectContaining({
191-
data: {n_plus_one_db_queries_detection_enabled: true},
192+
data: {transaction_duration_regression_detection_enabled: true},
192193
})
193194
);
194195
});
@@ -462,7 +463,7 @@ describe('projectPerformance', function () {
462463

463464
render(<ProjectPerformance />, {
464465
organization: OrganizationFixture({
465-
features: ['performance-view', 'performance-manage-detectors'],
466+
features: ['performance-view'],
466467
}),
467468
initialRouterConfig,
468469
});
@@ -525,7 +526,7 @@ describe('projectPerformance', function () {
525526

526527
render(<ProjectPerformance />, {
527528
organization: OrganizationFixture({
528-
features: ['performance-view', 'performance-manage-detectors'],
529+
features: ['performance-view'],
529530
access: ['project:read'],
530531
}),
531532
initialRouterConfig,

static/app/views/settings/projectPerformance/projectPerformance.tsx

Lines changed: 22 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import PanelHeader from 'sentry/components/panels/panelHeader';
2020
import PanelItem from 'sentry/components/panels/panelItem';
2121
import SentryDocumentTitle from 'sentry/components/sentryDocumentTitle';
2222
import {t, tct} from 'sentry/locale';
23-
import ConfigStore from 'sentry/stores/configStore';
2423
import ProjectsStore from 'sentry/stores/projectsStore';
2524
import {space} from 'sentry/styles/space';
2625
import type {Scope} from 'sentry/types/core';
@@ -275,10 +274,6 @@ function ProjectPerformance() {
275274
}
276275

277276
const requiredScopes: Scope[] = ['project:write'];
278-
const hasManageDetectors = organization.features.includes(
279-
'performance-manage-detectors'
280-
);
281-
282277
const projectEndpoint = `/projects/${organization.slug}/${projectSlug}/`;
283278
const performanceIssuesEndpoint = `/projects/${organization.slug}/${projectSlug}/performance-issues/configure/`;
284279
const isSuperUser = isActiveSuperuser();
@@ -550,22 +545,8 @@ function ProjectPerformance() {
550545
},
551546
];
552547

553-
const performanceIssueDetectorAdminFields = hasManageDetectors
554-
? performanceRegressionAdminFields
555-
: Object.values(performanceIssueDetectorAdminFieldMapping).concat(
556-
performanceRegressionAdminFields
557-
);
558-
559548
const project_owner_detector_settings = (hasAccess: boolean): JsonFormObject[] => {
560-
const supportMail = ConfigStore.get('supportEmail');
561-
const disabledText = hasManageDetectors
562-
? t('Detection of this issue has been disabled.')
563-
: t(
564-
'Detection of this issue has been disabled. Contact our support team at [link:support@sentry.io].',
565-
{
566-
link: <ExternalLink href={'mailto:' + supportMail} />,
567-
}
568-
);
549+
const disabledText = t('Detection of this issue has been disabled.');
569550

570551
const disabledReason = hasAccess ? disabledText : null;
571552

@@ -895,29 +876,27 @@ function ProjectPerformance() {
895876
];
896877

897878
// If the organization can manage detectors, add the admin field to the existing settings
898-
return hasManageDetectors
899-
? baseDetectorFields.map(fieldGroup => {
900-
const manageField =
901-
performanceIssueDetectorAdminFieldMapping[fieldGroup.title as string];
879+
return baseDetectorFields.map(fieldGroup => {
880+
const manageField =
881+
performanceIssueDetectorAdminFieldMapping[fieldGroup.title as string];
902882

903-
return manageField
904-
? {
905-
...fieldGroup,
906-
fields: [
907-
{
908-
...manageField,
909-
help: t(
910-
'Controls whether or not Sentry should detect this type of issue.'
911-
),
912-
disabled: !hasAccess,
913-
disabledReason: t('You do not have permission to manage detectors.'),
914-
},
915-
...fieldGroup.fields,
916-
],
917-
}
918-
: fieldGroup;
919-
})
920-
: baseDetectorFields;
883+
return manageField
884+
? {
885+
...fieldGroup,
886+
fields: [
887+
{
888+
...manageField,
889+
help: t(
890+
'Controls whether or not Sentry should detect this type of issue.'
891+
),
892+
disabled: !hasAccess,
893+
disabledReason: t('You do not have permission to manage detectors.'),
894+
},
895+
...fieldGroup.fields,
896+
],
897+
}
898+
: fieldGroup;
899+
});
921900
};
922901

923902
return (
@@ -1062,7 +1041,7 @@ function ProjectPerformance() {
10621041
title={t(
10631042
'### INTERNAL ONLY ### - Performance Issues Admin Detector Settings'
10641043
)}
1065-
fields={performanceIssueDetectorAdminFields}
1044+
fields={performanceRegressionAdminFields}
10661045
disabled={!isSuperUser}
10671046
/>
10681047
</Form>

0 commit comments

Comments
 (0)