Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(monitoring): add dns reporter #1376

Merged
merged 7 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .aws/deploy/support-task-definition.prod.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
"valueFrom": "PROD_ISOMERPAGES_REPO_PAGE_COUNT"
},
{ "name": "JWT_SECRET", "valueFrom": "PROD_JWT_SECRET" },
{ "name": "KEYCDN_API_KEY", "valueFrom": "PROD_KEYCDN_API_KEY" },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remember to add iether on pulumi or directly to ssm

{
"name": "MAX_NUM_OTP_ATTEMPTS",
"valueFrom": "PROD_MAX_NUM_OTP_ATTEMPTS"
Expand Down
1 change: 1 addition & 0 deletions .aws/deploy/support-task-definition.staging.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
"valueFrom": "STAGING_ISOMERPAGES_REPO_PAGE_COUNT"
},
{ "name": "JWT_SECRET", "valueFrom": "STAGING_JWT_SECRET" },
{ "name": "KEYCDN_API_KEY", "valueFrom": "STAGING_KEYCDN_API_KEY" },
{
"name": "MAX_NUM_OTP_ATTEMPTS",
"valueFrom": "STAGING_MAX_NUM_OTP_ATTEMPTS"
Expand Down
2 changes: 2 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,5 @@ export SGID_REDIRECT_URI="http://localhost:8081/v2/auth/sgid/auth-redirect"

# GrowthBook
export GROWTHBOOK_CLIENT_KEY="some random key"

export KEYCDN_API_KEY="secret"
5 changes: 5 additions & 0 deletions common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
Reviewer,
ReviewRequestView,
} from "@database/models"
import MonitoringService from "@root/monitoring"
import AuditLogsService from "@root/services/admin/AuditLogsService"
import RepoManagementService from "@root/services/admin/RepoManagementService"
import GitFileCommitService from "@root/services/db/GitFileCommitService"
Expand Down Expand Up @@ -248,3 +249,7 @@ export const auditLogsService = new AuditLogsService({
sitesService,
usersService,
})

export const monitoringService = new MonitoringService({
launchesService,
})
181 changes: 67 additions & 114 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"@aws-sdk/lib-dynamodb": "^3.577.0",
"@growthbook/growthbook": "^0.36.0",
"@octokit/plugin-retry": "^6.0.0",
"@octokit/rest": "^18.12.0",
"@octokit/rest": "^20.1.1",
"@opengovsg/formsg-sdk": "^0.11.0",
"@opengovsg/sgid-client": "^2.0.0",
"@slack/bolt": "^3.19.0",
Expand Down
9 changes: 9 additions & 0 deletions src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

convict.addFormat({
name: "required-string",
validate: (val: any) => {

Check warning on line 5 in src/config/config.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
if (!val) throw new Error("value cannot be empty, null or undefined")
if (typeof val !== "string") throw new Error("value must be a string")
},
Expand All @@ -10,14 +10,14 @@

convict.addFormat({
name: "required-positive-number",
validate: (val: any) => {

Check warning on line 13 in src/config/config.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
if (val === null || val === undefined || val === "")
throw new Error("value cannot be empty, null or undefined")
if (typeof val !== "number") throw new Error("value must be a number")
},
coerce: (val: string) => {
const coercedVal = Number(val)
if (isNaN(coercedVal)) {

Check warning on line 20 in src/config/config.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected use of 'isNaN'. Use Number.isNaN instead https://github.com/airbnb/javascript#standard-library--isnan
throw new Error(
"value provided is not a positive number. please provide a valid positive number"
)
Expand All @@ -31,7 +31,7 @@

convict.addFormat({
name: "required-boolean",
validate: (val: any) => {

Check warning on line 34 in src/config/config.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
if (val === null || val === undefined)
throw new Error("value cannot be empty, null or undefined")
if (typeof val !== "boolean") throw new Error("value must be a boolean")
Expand Down Expand Up @@ -195,6 +195,7 @@
},
},
},

github: {
orgName: {
doc: "GitHub organization that owns all site repositories",
Expand Down Expand Up @@ -472,6 +473,14 @@
default: "",
},
},
keyCdn: {
apiKey: {
doc: "KeyCDN API key",
env: "KEYCDN_API_KEY",
format: "required-string",
default: "",
},
},
})

// Perform validation
Expand Down
11 changes: 11 additions & 0 deletions src/errors/MonitoringError.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { BaseIsomerError } from "./BaseError"

export default class MonitoringError extends BaseIsomerError {
constructor(message: string) {
super({
status: 500,
code: "MonitoringError",
message,
})
}
}
Loading
Loading