Skip to content

Commit a50e278

Browse files
feat(crons): Implement an all checks page for crons (#85202)
Adds an all monitor checks page for cron issues with some custom cells. There is one thing that should be addressed though but it requires a backend fix, the schedule from the API currently returns the enum integer for the schedule (e.g. `1` instead of `crontab`). I will put up a PR to fix this serialization, since without it, the number appears in the tool tip, along with 'Unknown Schedule'. <img width="1197" alt="image" src="https://github.com/user-attachments/assets/4f93ed4d-6740-4f30-adee-e1b715655aa7" /> **todo** - [x] Add tests - [x] Put up the PR to change the serialization - #85211 --------- Co-authored-by: Evan Purkhiser <evanpurkhiser@gmail.com>
1 parent 33c0f2d commit a50e278

18 files changed

+500
-35
lines changed

static/app/routes.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2066,6 +2066,10 @@ function buildRoutes() {
20662066
path={TabPaths[Tab.UPTIME_CHECKS]}
20672067
component={make(() => import('sentry/views/issueDetails/groupUptimeChecks'))}
20682068
/>
2069+
<Route
2070+
path={TabPaths[Tab.CHECK_INS]}
2071+
component={make(() => import('sentry/views/issueDetails/groupCheckIns'))}
2072+
/>
20692073
<Route
20702074
path={TabPaths[Tab.TAGS]}
20712075
component={make(() => import('sentry/views/issueDetails/groupTags/groupTagsTab'))}

static/app/utils/issueTypeConfig/cronConfig.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const cronConfig: IssueCategoryConfigMapping = {
3939
events: {enabled: true},
4040
openPeriods: {enabled: false},
4141
uptimeChecks: {enabled: false},
42-
cronChecks: {enabled: false},
42+
checkIns: {enabled: true},
4343
attachments: {enabled: false},
4444
userFeedback: {enabled: false},
4545
replays: {enabled: false},

static/app/utils/issueTypeConfig/errorConfig.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export const errorConfig: IssueCategoryConfigMapping = {
2626
landingPage: Tab.DETAILS,
2727
events: {enabled: true},
2828
openPeriods: {enabled: false},
29-
cronChecks: {enabled: false},
29+
checkIns: {enabled: false},
3030
uptimeChecks: {enabled: false},
3131
attachments: {enabled: true},
3232
userFeedback: {enabled: true},

static/app/utils/issueTypeConfig/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ const BASE_CONFIG: IssueTypeConfig = {
5151
landingPage: Tab.DETAILS,
5252
events: {enabled: true},
5353
openPeriods: {enabled: false},
54-
cronChecks: {enabled: false},
54+
checkIns: {enabled: false},
5555
uptimeChecks: {enabled: false},
5656
attachments: {enabled: false},
5757
userFeedback: {enabled: false},

static/app/utils/issueTypeConfig/metricIssueConfig.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const metricIssueConfig: IssueCategoryConfigMapping = {
3333
landingPage: Tab.DETAILS,
3434
events: {enabled: false},
3535
openPeriods: {enabled: true},
36-
cronChecks: {enabled: false},
36+
checkIns: {enabled: false},
3737
uptimeChecks: {enabled: false},
3838
attachments: {enabled: false},
3939
userFeedback: {enabled: false},

static/app/utils/issueTypeConfig/performanceConfig.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const performanceConfig: IssueCategoryConfigMapping = {
2828
landingPage: Tab.DETAILS,
2929
events: {enabled: true},
3030
openPeriods: {enabled: false},
31-
cronChecks: {enabled: false},
31+
checkIns: {enabled: false},
3232
uptimeChecks: {enabled: false},
3333
attachments: {enabled: false},
3434
userFeedback: {enabled: false},
@@ -208,7 +208,7 @@ const performanceConfig: IssueCategoryConfigMapping = {
208208
landingPage: Tab.DETAILS,
209209
events: {enabled: true},
210210
openPeriods: {enabled: false},
211-
cronChecks: {enabled: false},
211+
checkIns: {enabled: false},
212212
uptimeChecks: {enabled: false},
213213
attachments: {enabled: false},
214214
userFeedback: {enabled: false},
@@ -253,7 +253,7 @@ const performanceConfig: IssueCategoryConfigMapping = {
253253
landingPage: Tab.DETAILS,
254254
events: {enabled: false},
255255
openPeriods: {enabled: false},
256-
cronChecks: {enabled: false},
256+
checkIns: {enabled: false},
257257
uptimeChecks: {enabled: false},
258258
attachments: {enabled: false},
259259
userFeedback: {enabled: false},
@@ -358,7 +358,7 @@ const performanceConfig: IssueCategoryConfigMapping = {
358358
events: {enabled: false},
359359
openPeriods: {enabled: false},
360360
uptimeChecks: {enabled: false},
361-
cronChecks: {enabled: false},
361+
checkIns: {enabled: false},
362362
attachments: {enabled: false},
363363
userFeedback: {enabled: false},
364364
replays: {enabled: false},
@@ -403,7 +403,7 @@ const performanceConfig: IssueCategoryConfigMapping = {
403403
events: {enabled: false},
404404
openPeriods: {enabled: false},
405405
uptimeChecks: {enabled: false},
406-
cronChecks: {enabled: false},
406+
checkIns: {enabled: false},
407407
attachments: {enabled: false},
408408
userFeedback: {enabled: false},
409409
replays: {enabled: false},

static/app/utils/issueTypeConfig/replayConfig.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const replayConfig: IssueCategoryConfigMapping = {
2828
events: {enabled: true},
2929
openPeriods: {enabled: false},
3030
uptimeChecks: {enabled: false},
31-
cronChecks: {enabled: false},
31+
checkIns: {enabled: false},
3232
attachments: {enabled: false},
3333
userFeedback: {enabled: true},
3434
replays: {enabled: true},

static/app/utils/issueTypeConfig/types.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export type IssueTypeConfig = {
9999
/**
100100
* Is the Cron Checks page shown for this issue
101101
*/
102-
cronChecks: DisabledWithReasonConfig;
102+
checkIns: DisabledWithReasonConfig;
103103
/**
104104
* Is the All Events/Occurrences page shown for this issue
105105
*/

static/app/utils/issueTypeConfig/uptimeConfig.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const uptimeConfig: IssueCategoryConfigMapping = {
3333
landingPage: Tab.EVENTS,
3434
events: {enabled: true},
3535
openPeriods: {enabled: false},
36-
cronChecks: {enabled: false},
36+
checkIns: {enabled: false},
3737
uptimeChecks: {enabled: true},
3838
attachments: {enabled: false},
3939
userFeedback: {enabled: false},
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
import {CheckInFixture} from 'sentry-fixture/checkIn';
2+
import {EventFixture} from 'sentry-fixture/event';
3+
import {GroupFixture} from 'sentry-fixture/group';
4+
import {OrganizationFixture} from 'sentry-fixture/organization';
5+
import {ProjectFixture} from 'sentry-fixture/project';
6+
import {RouterFixture} from 'sentry-fixture/routerFixture';
7+
8+
import {render, screen} from 'sentry-test/reactTestingLibrary';
9+
10+
import GroupStore from 'sentry/stores/groupStore';
11+
import {IssueCategory, IssueType} from 'sentry/types/group';
12+
import GroupCheckIns from 'sentry/views/issueDetails/groupCheckIns';
13+
import {statusToText} from 'sentry/views/monitors/utils';
14+
15+
describe('GroupCheckIns', () => {
16+
const monitorId = 'f75a223c-aae1-47e4-8f77-6c72243cb76e';
17+
const event = EventFixture({
18+
tags: [
19+
{
20+
key: 'monitor.id',
21+
value: monitorId,
22+
},
23+
],
24+
});
25+
const project = ProjectFixture();
26+
const group = GroupFixture({
27+
issueCategory: IssueCategory.CRON,
28+
issueType: IssueType.MONITOR_CHECK_IN_FAILURE,
29+
project,
30+
});
31+
const organization = OrganizationFixture();
32+
const router = RouterFixture({params: {groupId: group.id}});
33+
34+
beforeEach(() => {
35+
GroupStore.init();
36+
GroupStore.add([group]);
37+
MockApiClient.clearMockResponses();
38+
MockApiClient.addMockResponse({
39+
url: `/organizations/${organization.slug}/issues/${group.id}/`,
40+
body: group,
41+
});
42+
MockApiClient.addMockResponse({
43+
url: `/organizations/${organization.slug}/issues/${group.id}/events/recommended/`,
44+
body: event,
45+
});
46+
});
47+
48+
it('renders the empty check-in table', async () => {
49+
MockApiClient.addMockResponse({
50+
url: `/projects/${organization.slug}/${project.slug}/monitors/${monitorId}/checkins/`,
51+
body: [],
52+
});
53+
54+
render(<GroupCheckIns />, {organization, router});
55+
expect(await screen.findByText('All Check-Ins')).toBeInTheDocument();
56+
for (const column of [
57+
'Timestamp',
58+
'Status',
59+
'Duration',
60+
'Environment',
61+
'Monitor Config',
62+
'ID',
63+
]) {
64+
expect(screen.getByText(column)).toBeInTheDocument();
65+
}
66+
expect(screen.getByText('No matching check-ins found')).toBeInTheDocument();
67+
});
68+
69+
it('renders the check-in table with data', async () => {
70+
const check = CheckInFixture();
71+
MockApiClient.addMockResponse({
72+
url: `/projects/${organization.slug}/${project.slug}/monitors/${monitorId}/checkins/`,
73+
body: [check],
74+
});
75+
76+
render(<GroupCheckIns />, {organization, router});
77+
expect(await screen.findByText('All Check-Ins')).toBeInTheDocument();
78+
expect(screen.queryByText('No matching check-ins found')).not.toBeInTheDocument();
79+
expect(screen.getByText('Showing 1-1 matching check-ins')).toBeInTheDocument();
80+
expect(screen.getByRole('button', {name: 'Previous Page'})).toBeInTheDocument();
81+
expect(screen.getByRole('button', {name: 'Next Page'})).toBeInTheDocument();
82+
83+
expect(screen.getByRole('time')).toHaveTextContent(/Jan 1, 2025/);
84+
expect(screen.getByText(statusToText[check.status])).toBeInTheDocument();
85+
expect(screen.getByText(`${check.duration}ms`)).toBeInTheDocument();
86+
expect(screen.getByText(check.environment)).toBeInTheDocument();
87+
expect(screen.getByText(check.id)).toBeInTheDocument();
88+
});
89+
});

0 commit comments

Comments
 (0)