Skip to content

Commit

Permalink
feat(metric-issues): Disable manual resolution for metric issues (#82937
Browse files Browse the repository at this point in the history
  • Loading branch information
snigdhas authored Jan 6, 2025
1 parent 21e1284 commit d3db718
Show file tree
Hide file tree
Showing 12 changed files with 110 additions and 42 deletions.
1 change: 1 addition & 0 deletions static/app/components/stream/group.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@ function BaseGroupRow({
[IssueCategory.CRON]: t('Cron Events'),
[IssueCategory.REPLAY]: t('Replay Events'),
[IssueCategory.UPTIME]: t('Uptime Events'),
[IssueCategory.METRIC_ALERT]: t('Metric Alert Events'),
};

const groupCount = !defined(primaryCount) ? (
Expand Down
1 change: 1 addition & 0 deletions static/app/types/group.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export enum IssueCategory {
CRON = 'cron',
REPLAY = 'replay',
UPTIME = 'uptime',
METRIC_ALERT = 'metric_alert',
}

export enum IssueType {
Expand Down
1 change: 1 addition & 0 deletions static/app/utils/issueTypeConfig/cronConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const cronConfig: IssueCategoryConfigMapping = {
disabledReason: t('Not yet supported for cron issues'),
},
ignore: {enabled: true},
resolve: {enabled: true},
resolveInRelease: {enabled: true},
share: {enabled: true},
},
Expand Down
1 change: 1 addition & 0 deletions static/app/utils/issueTypeConfig/errorConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const errorConfig: IssueCategoryConfigMapping = {
deleteAndDiscard: {enabled: true},
ignore: {enabled: true},
merge: {enabled: true},
resolve: {enabled: true},
resolveInRelease: {enabled: true},
share: {enabled: true},
},
Expand Down
6 changes: 6 additions & 0 deletions static/app/utils/issueTypeConfig/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
errorConfig,
getErrorHelpResource,
} from 'sentry/utils/issueTypeConfig/errorConfig';
import metricIssueConfig from 'sentry/utils/issueTypeConfig/metricIssueConfig';
import performanceConfig from 'sentry/utils/issueTypeConfig/performanceConfig';
import replayConfig from 'sentry/utils/issueTypeConfig/replayConfig';
import type {
Expand All @@ -31,9 +32,13 @@ const BASE_CONFIG: IssueTypeConfig = {
deleteAndDiscard: {enabled: false},
merge: {enabled: false},
ignore: {enabled: false},
resolve: {enabled: true},
resolveInRelease: {enabled: true},
share: {enabled: false},
},
customCopy: {
resolution: 'Resolved',
},
attachments: {enabled: false},
autofix: false,
events: {enabled: true},
Expand Down Expand Up @@ -64,6 +69,7 @@ const issueTypeConfig: Config = {
[IssueCategory.CRON]: cronConfig,
[IssueCategory.REPLAY]: replayConfig,
[IssueCategory.UPTIME]: uptimeConfig,
[IssueCategory.METRIC_ALERT]: metricIssueConfig,
};

/**
Expand Down
34 changes: 34 additions & 0 deletions static/app/utils/issueTypeConfig/metricIssueConfig.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import {t} from 'sentry/locale';
import type {IssueCategoryConfigMapping} from 'sentry/utils/issueTypeConfig/types';

const metricIssueConfig: IssueCategoryConfigMapping = {
_categoryDefaults: {
actions: {
archiveUntilOccurrence: {enabled: false},
delete: {enabled: false},
deleteAndDiscard: {enabled: false},
merge: {enabled: false},
ignore: {enabled: true},
resolve: {enabled: false},
resolveInRelease: {enabled: false},
share: {enabled: true},
},
customCopy: {
resolution: t('Back to baseline'),
},
attachments: {enabled: false},
resources: null,
autofix: false,
events: {enabled: false},
mergedIssues: {enabled: false},
replays: {enabled: false},
similarIssues: {enabled: false},
userFeedback: {enabled: false},
usesIssuePlatform: true,
stats: {enabled: false},
tagsTab: {enabled: false},
issueSummary: {enabled: false},
},
};

export default metricIssueConfig;
3 changes: 3 additions & 0 deletions static/app/utils/issueTypeConfig/performanceConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const performanceConfig: IssueCategoryConfigMapping = {
disabledReason: t('Not yet supported for performance issues'),
},
ignore: {enabled: true},
resolve: {enabled: true},
resolveInRelease: {enabled: true},
share: {enabled: true},
},
Expand Down Expand Up @@ -223,6 +224,7 @@ const performanceConfig: IssueCategoryConfigMapping = {
disabledReason: t('Not yet supported for performance issues'),
},
ignore: {enabled: true},
resolve: {enabled: true},
resolveInRelease: {
enabled: false,
disabledReason: t('Not yet supported for regression issues'),
Expand Down Expand Up @@ -354,6 +356,7 @@ const performanceConfig: IssueCategoryConfigMapping = {
disabledReason: t('Not yet supported for performance issues'),
},
ignore: {enabled: true},
resolve: {enabled: true},
resolveInRelease: {
enabled: false,
disabledReason: t('Not yet supported for regression issues'),
Expand Down
1 change: 1 addition & 0 deletions static/app/utils/issueTypeConfig/replayConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const replayConfig: IssueCategoryConfigMapping = {
disabledReason: t('Not supported for replay issues'),
},
ignore: {enabled: true},
resolve: {enabled: true},
resolveInRelease: {enabled: true},
share: {enabled: true},
},
Expand Down
7 changes: 7 additions & 0 deletions static/app/utils/issueTypeConfig/types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export type IssueTypeConfig = {
deleteAndDiscard: DisabledWithReasonConfig;
ignore: DisabledWithReasonConfig;
merge: DisabledWithReasonConfig;
resolve: DisabledWithReasonConfig;
resolveInRelease: DisabledWithReasonConfig;
share: DisabledWithReasonConfig;
};
Expand All @@ -32,6 +33,12 @@ export type IssueTypeConfig = {
* Should show Autofix for this issue type
*/
autofix: boolean;
/**
* Custom copy for actions and other UI elements
*/
customCopy: {
resolution: string;
};
/**
* Is the "Open in Discover" button available for this issue
*/
Expand Down
1 change: 1 addition & 0 deletions static/app/utils/issueTypeConfig/uptimeConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const uptimeConfig: IssueCategoryConfigMapping = {
deleteAndDiscard: {enabled: false},
merge: {enabled: false},
ignore: {enabled: true},
resolve: {enabled: true},
resolveInRelease: {enabled: true},
share: {enabled: true},
},
Expand Down
92 changes: 50 additions & 42 deletions static/app/views/issueDetails/actions/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,10 @@ export function GroupActions({group, project, disabled, event}: GroupActionsProp
delete: deleteCap,
deleteAndDiscard: deleteDiscardCap,
share: shareCap,
resolve: resolveCap,
resolveInRelease: resolveInReleaseCap,
},
customCopy: {resolution: resolvedCopyCap},
discover: discoverCap,
} = config;

Expand Down Expand Up @@ -365,38 +367,42 @@ export function GroupActions({group, project, disabled, event}: GroupActionsProp
<ResolvedActionWapper>
<ResolvedWrapper>
<IconCheckmark />
{isResolved ? t('Resolved') : t('Archived')}
{isResolved ? resolvedCopyCap || t('Resolved') : t('Archived')}
</ResolvedWrapper>
<Divider />
<Button
size="sm"
disabled={disabled || isAutoResolved}
onClick={() =>
onUpdate({
status: GroupStatus.UNRESOLVED,
statusDetails: {},
substatus: GroupSubstatus.ONGOING,
})
}
>
{isResolved ? t('Unresolve') : t('Unarchive')}
</Button>
{resolveCap.enabled && (
<Button
size="sm"
disabled={disabled || isAutoResolved}
onClick={() =>
onUpdate({
status: GroupStatus.UNRESOLVED,
statusDetails: {},
substatus: GroupSubstatus.ONGOING,
})
}
>
{isResolved ? t('Unresolve') : t('Unarchive')}
</Button>
)}
</ResolvedActionWapper>
) : (
<Fragment>
<ResolveActions
disableResolveInRelease={!resolveInReleaseCap.enabled}
disabled={disabled}
disableDropdown={disabled}
hasRelease={hasRelease}
latestRelease={project.latestRelease}
onUpdate={onUpdate}
projectSlug={project.slug}
isResolved={isResolved}
isAutoResolved={isAutoResolved}
size="sm"
priority="primary"
/>
{resolveCap.enabled && (
<ResolveActions
disableResolveInRelease={!resolveInReleaseCap.enabled}
disabled={disabled}
disableDropdown={disabled}
hasRelease={hasRelease}
latestRelease={project.latestRelease}
onUpdate={onUpdate}
projectSlug={project.slug}
isResolved={isResolved}
isAutoResolved={isAutoResolved}
size="sm"
priority="primary"
/>
)}
<ArchiveActions
className={hasStreamlinedUI ? undefined : 'hidden-xs'}
size="sm"
Expand Down Expand Up @@ -568,21 +574,23 @@ export function GroupActions({group, project, disabled, event}: GroupActionsProp
disabled={disabled}
disableArchiveUntilOccurrence={!archiveUntilOccurrenceCap.enabled}
/>
<GuideAnchor target="resolve" position="bottom" offset={20}>
<ResolveActions
disableResolveInRelease={!resolveInReleaseCap.enabled}
disabled={disabled}
disableDropdown={disabled}
hasRelease={hasRelease}
latestRelease={project.latestRelease}
onUpdate={onUpdate}
projectSlug={project.slug}
isResolved={isResolved}
isAutoResolved={isAutoResolved}
size="sm"
priority="primary"
/>
</GuideAnchor>
{resolveCap.enabled && (
<GuideAnchor target="resolve" position="bottom" offset={20}>
<ResolveActions
disableResolveInRelease={!resolveInReleaseCap.enabled}
disabled={disabled}
disableDropdown={disabled}
hasRelease={hasRelease}
latestRelease={project.latestRelease}
onUpdate={onUpdate}
projectSlug={project.slug}
isResolved={isResolved}
isAutoResolved={isAutoResolved}
size="sm"
priority="primary"
/>
</GuideAnchor>
)}
</Fragment>
)}
</Fragment>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,13 @@ describe('SolutionsSection', () => {
deleteAndDiscard: {enabled: false},
ignore: {enabled: false},
merge: {enabled: false},
resolve: {enabled: true},
resolveInRelease: {enabled: false},
share: {enabled: false},
},
customCopy: {
resolution: 'Resolved',
},
attachments: {enabled: false},
autofix: true,
discover: {enabled: false},
Expand Down

0 comments on commit d3db718

Please sign in to comment.