Skip to content

Commit 6ebaa66

Browse files
authored
feat: rename the TLS certificate expiry alert (#1102)
The underlying metric for the alert rule is the same for multiple check types (HTTP, gRPC, TCP), therefore, since the alert can be reused for these types, replace the 'HTTP' prefix, which referenced the check type, for 'TLS'. Related grafana/synthetic-monitoring-api/pull/1300
1 parent 6b62ea1 commit 6ebaa66

File tree

8 files changed

+12
-12
lines changed

8 files changed

+12
-12
lines changed

‎src/components/CheckForm/AlertsPerCheck/AlertItem.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { useMetricsDS } from 'hooks/useMetricsDS';
99

1010
import { PredefinedAlertInterface } from './AlertsPerCheck.constants';
1111
import { FailedExecutionsAlert } from './FailedExecutionsAlert';
12-
import { HTTPTargetCertificateCloseToExpiringAlert } from './HTTPTargetCertificateCloseToExpiringAlert';
12+
import { TLSTargetCertificateCloseToExpiringAlert } from './TLSTargetCertificateCloseToExpiringAlert';
1313

1414
function createExploreLink(dataSourceName: string, query: string) {
1515
return urlUtil.renderUrl(`/explore`, {
@@ -72,8 +72,8 @@ export const AlertItem = ({
7272
/>
7373
)}
7474

75-
{alert.type === CheckAlertType.HTTPTargetCertificateCloseToExpiring && (
76-
<HTTPTargetCertificateCloseToExpiringAlert
75+
{alert.type === CheckAlertType.TLSTargetCertificateCloseToExpiring && (
76+
<TLSTargetCertificateCloseToExpiringAlert
7777
alert={alert}
7878
selected={selected}
7979
onSelectionChange={handleToggleAlert}

‎src/components/CheckForm/AlertsPerCheck/AlertsPerCheck.constants.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export const GLOBAL_PREDEFINED_ALERTS: PredefinedAlertInterface[] = [
5757

5858
export const HTTP_PREDEFINED_ALERTS: PredefinedAlertInterface[] = [
5959
{
60-
type: CheckAlertType.HTTPTargetCertificateCloseToExpiring,
60+
type: CheckAlertType.TLSTargetCertificateCloseToExpiring,
6161
name: 'HTTP Target Certificate Close To Expiring',
6262
description: 'Trigger an alert if the target certificate will expire in less than $threshold days.',
6363
supportsPeriod: false,

‎src/components/CheckForm/AlertsPerCheck/HTTPTargetCertificateCloseToExpiringAlert.tsx renamed to ‎src/components/CheckForm/AlertsPerCheck/TLSTargetCertificateCloseToExpiringAlert.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { useCheckFormContext } from '../CheckFormContext/CheckFormContext';
1818
import { getAlertItemStyles } from './AlertItem';
1919
import { PredefinedAlertInterface } from './AlertsPerCheck.constants';
2020

21-
export const HTTPTargetCertificateCloseToExpiringAlert = ({
21+
export const TLSTargetCertificateCloseToExpiringAlert = ({
2222
alert,
2323
selected,
2424
onSelectionChange,

‎src/datasource/__mocks__/checkAlerts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export function mockAlertsForCheckData(mockData: CheckAlertsResponse = alertsFro
1010
export const alertsFromApi: CheckAlertsResponse = {
1111
alerts: [
1212
{
13-
name: CheckAlertType['HTTPTargetCertificateCloseToExpiring'],
13+
name: CheckAlertType['TLSTargetCertificateCloseToExpiring'],
1414
threshold: 90,
1515
created: 1724854935,
1616
modified: 1724854935,

‎src/page/NewCheck/__tests__/ApiEndPointChecks/HTTPCheck/4-alerting.payload.test.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ describe(`HttpCheck - Section 4 (Alerting) payload`, () => {
3535

3636
expect(screen.getByText(`Alert if the target's certificate expires in less than`)).toBeInTheDocument();
3737

38-
const thresholdsInput = screen.getByTestId('alert-threshold-HTTPTargetCertificateCloseToExpiring');
38+
const thresholdsInput = screen.getByTestId('alert-threshold-TLSTargetCertificateCloseToExpiring');
3939

40-
await user.click(screen.getByTestId('checkbox-alert-HTTPTargetCertificateCloseToExpiring'));
40+
await user.click(screen.getByTestId('checkbox-alert-TLSTargetCertificateCloseToExpiring'));
4141
await user.clear(thresholdsInput);
4242
await user.type(thresholdsInput, '1');
4343

@@ -48,7 +48,7 @@ describe(`HttpCheck - Section 4 (Alerting) payload`, () => {
4848
expect(alertsBody).toEqual({
4949
alerts: [
5050
{
51-
name: 'HTTPTargetCertificateCloseToExpiring',
51+
name: 'TLSTargetCertificateCloseToExpiring',
5252
threshold: 1,
5353
},
5454
],

‎src/schemas/general/CheckAlerts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const ProbeFailedExecutionsTooHighSchema = CheckAlertSchema.refine(
5050

5151
export const CheckAlertsSchema: ZodType<CheckAlertFormRecord | undefined> = z.object({
5252
ProbeFailedExecutionsTooHigh: ProbeFailedExecutionsTooHighSchema.optional(),
53-
HTTPTargetCertificateCloseToExpiring: CheckAlertSchema.optional(),
53+
TLSTargetCertificateCloseToExpiring: CheckAlertSchema.optional(),
5454
});
5555

5656
export function checkAlertsRefinement(data: CheckFormValuesBase, ctx: z.RefinementCtx) {

‎src/test/fixtures/checkAlerts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { CheckAlertsResponse } from 'datasource/responses.types';
55

66
export const BASIC_CHECK_ALERTS: CheckAlertsResponse = {
77
alerts: [
8-
CheckAlertType.HTTPTargetCertificateCloseToExpiring,
8+
CheckAlertType.TLSTargetCertificateCloseToExpiring,
99
CheckAlertType.ProbeFailedExecutionsTooHigh,
1010
].map((name) => db.alert.build({ name })),
1111
};

‎src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,7 @@ export type AlertFilter = (record: PrometheusAlertRecord) => boolean;
655655

656656
export enum CheckAlertType {
657657
ProbeFailedExecutionsTooHigh = 'ProbeFailedExecutionsTooHigh',
658-
HTTPTargetCertificateCloseToExpiring = 'HTTPTargetCertificateCloseToExpiring',
658+
TLSTargetCertificateCloseToExpiring = 'TLSTargetCertificateCloseToExpiring',
659659
}
660660

661661
export enum CheckAlertCategory {

0 commit comments

Comments
 (0)