Conversation
GregorShear
requested changes
Jan 26, 2026
crates/control-plane-api/src/server/public/graphql/alert_subscriptions.rs
Show resolved
Hide resolved
jgraettinger
approved these changes
Jan 26, 2026
crates/control-plane-api/src/server/public/graphql/alert_subscriptions.rs
Outdated
Show resolved
Hide resolved
fe54428 to
e9f0156
Compare
Adds support for querying and modifying alert subscriptions via graphql. The create and update operations treat the catalog prefix and email as a unique compound key. We prevent users from creating multiple different subscriptions with the same prefix and email. Technically, this isn't necessary, since we already need to deduplicate email addresses when resolving alert recipients (since you could have multiple different subscription prefixes that apply to a given alert). But it seemed like we ought to still prevent that since there's no known use case that would require allowing it. The alert types and detail message can be updated after creation, but the prefix and email cannot be.
Introduces several new subcommands for managing alert subscriptions. - `flowctl alert-subscriptions list`: lists all alert subscriptions underneath the given prefix - `flowctl alert-subscriptions subscribe`: Adds a new alert subscription, or adds new alert types to an existing subscription - `flowctl alert-subscriptions unsubscribe`: Deletes an alert subscription, or removes specified alert types from it.
e9f0156 to
bac234a
Compare
GregorShear
approved these changes
Jan 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
Resolves #2589
Adds GraphQL queries and mutations for alert subscriptions, along with flowctl subcommands for managing alert subscriptions.
The graphql api is basic CRUD, and it treats the
(prefix, email)as a unique key, so you can't have multiple subscriptions with the same prefix and email. This isn't strictly a technical requirement, since we already need to deduplicate the emails when sending notifications (because multiple subscriptions with different prefixes could still match the same alert).One of the considerations in this design was trying to accommodate for webhook deliveries, which we plan to support soon. My thinking here is that we would make both
emailandwebhookoptional parameters ofcreateAlertSubscription, and just require that one of them is provided. I added adestinationfield toAlertSubscription, which can represent both email and webhook destinations (and any future delivery mechanisms) as a URI. This is kind of speculative, and something we may wish to change once we actually start supporting multiple different delivery mechanisms. Please feel free to suggest better ideas.Workflow steps:
The flowctl UX is slightly simpler, and mutations are done using either
subscribeorunsubscribecommands. Subscribe will either add a new subscription, or add new alert types to an existing subscription. It never removes alert types. Unsubscribe similarly will either remove specific alert types from an existing subscription, or else remove the entire subscription.All of the subcommands accept an optional
--prefixargument. If not provided, we try to determine the prefix automatically, similar to how we do it forcatalog list(the logic from there is now shared). The notable difference is thatalert-subscriptionssubcommands will require an explicit--prefixargument if the user has access to more than a single top-level prefix, whereascatalog listwill use up to 5 prefixes by default.Similarly, the
--emailargument is optional forsubscribeandunsubscribe. If not provided, we parse the user's auth token claims and attempt to use theemailfrom there as a default.A goal was to keep the UX as simple as possible for basic use cases. So most new users could simply run
flowctl alert-subscriptions (un)subscribewithout additional arguments in order to start or stop receiving notifications. Here's the help messages for each of the subcommands (slightly abbreviated):subscribe:unsubscribe:list:Documentation links affected:
This didn't seem worth adding to the flowctl concepts page, but LMK if you disagree.