Skip to content

Commit

Permalink
feat(metric-issues): Add detector details to sidebar (#82972)
Browse files Browse the repository at this point in the history
  • Loading branch information
snigdhas authored Jan 8, 2025
1 parent 285b9fb commit 16ef944
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
5 changes: 5 additions & 0 deletions static/app/types/event.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,10 @@ export interface ThreadPoolInfoContext {
[ThreadPoolInfoContextKey.AVAILABLE_COMPLETION_PORT_THREADS]: number;
}

export type MetricAlertContextType = {
alert_rule_id?: string;
};

export enum ProfileContextKey {
PROFILE_ID = 'profile_id',
PROFILER_ID = 'profiler_id',
Expand Down Expand Up @@ -657,6 +661,7 @@ export type EventContexts = {
feedback?: Record<string, any>;
flags?: Flags;
memory_info?: MemoryInfoContext;
metric_alert?: MetricAlertContextType;
missing_instrumentation?: MissingInstrumentationContext;
os?: OSContext;
otel?: OtelContext;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import {LinkButton} from 'sentry/components/button';
import {Flex} from 'sentry/components/container/flex';
import {t} from 'sentry/locale';
import type {Event} from 'sentry/types/event';
import useOrganization from 'sentry/utils/useOrganization';

export function MetricIssueSidebarSection({event}: {event?: Event}) {
const organization = useOrganization();
const alert_rule_id = event?.contexts?.metric_alert?.alert_rule_id;

if (!alert_rule_id) {
return null;
}

return (
<Flex>
<LinkButton
aria-label={t('View detector details')}
href={`/organizations/${organization.slug}/alerts/rules/details/${alert_rule_id}/`}
style={{width: '100%'}}
>
{t('View detector details')}
</LinkButton>
</Flex>
);
}
8 changes: 8 additions & 0 deletions static/app/views/issueDetails/streamline/sidebar/sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import StreamlinedActivitySection from 'sentry/views/issueDetails/streamline/sid
import {ExternalIssueList} from 'sentry/views/issueDetails/streamline/sidebar/externalIssueList';
import FirstLastSeenSection from 'sentry/views/issueDetails/streamline/sidebar/firstLastSeenSection';
import {MergedIssuesSidebarSection} from 'sentry/views/issueDetails/streamline/sidebar/mergedSidebarSection';
import {MetricIssueSidebarSection} from 'sentry/views/issueDetails/streamline/sidebar/metricIssueSidebarSection';
import PeopleSection from 'sentry/views/issueDetails/streamline/sidebar/peopleSection';
import {SimilarIssuesSidebarSection} from 'sentry/views/issueDetails/streamline/sidebar/similarIssuesSidebarSection';
import SolutionsSection from 'sentry/views/issueDetails/streamline/sidebar/solutionsSection';
Expand Down Expand Up @@ -44,6 +45,7 @@ export default function StreamlinedSidebar({group, event, project}: Props) {

const showPeopleSection = group.participants.length > 0 || viewers.length > 0;
const issueTypeConfig = getConfigForIssueType(group, group.project);
const showMetricIssueSection = event?.contexts?.metric_alert?.alert_rule_id;

return (
<Side>
Expand Down Expand Up @@ -89,6 +91,12 @@ export default function StreamlinedSidebar({group, event, project}: Props) {
<MergedIssuesSidebarSection />
</Fragment>
)}
{showMetricIssueSection && (
<Fragment>
<StyledBreak />
<MetricIssueSidebarSection event={event} />
</Fragment>
)}
</Side>
);
}
Expand Down

0 comments on commit 16ef944

Please sign in to comment.