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

alert api #263

Merged
merged 2 commits into from
Jan 22, 2024
Merged

alert api #263

merged 2 commits into from
Jan 22, 2024

Conversation

MikeShi42
Copy link
Contributor

Introduces external alert api to OSS, adds translation layer between internal naming and product-aligned external naming.

Example:

PUT /api/v1/alerts/<ALERT_ID>
Authorization: Bearer <PERSONAL_API>

{
  "interval": "30m",
  "threshold": 10,
  "threshold_type": "below",
  "channel": {
    "type": "slack_webhook",
    "webhookId": "<WEBHOOK_ID>"
  },
  "source": "search",
  "savedSearchId": "<SAVED_SEARCH_ID>"
}

Copy link

changeset-bot bot commented Jan 21, 2024

⚠️ No Changeset found

Latest commit: e21450a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

dashboardId: alertDoc.dashboardId.toString(),
chartId: alertDoc.chartId as string,
}
: ({} as never)),
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't we throw here ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wanted to throw inline here but unfortunately that didn't seem possible, could always move this out to the top of the fn and assert and I think it'll still carry over, but I didn't think it was worth it.

teamId: ObjectId,
alertInput: z.infer<typeof alertSchema>,
) => {
if (alertInput.source === 'CHART') {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I feel it would be cleaner if AlertSource is an enum

@kodiakhq kodiakhq bot merged commit b3631ee into main Jan 22, 2024
4 checks passed
@MikeShi42 MikeShi42 deleted the mikeshi/ext-alert-api branch February 14, 2024 02:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants