Skip to content

[nexus] add alert_list and alert_view external API endpoints - #11072

Open
hawkw wants to merge 17 commits into
mainfrom
eliza/alert-list
Open

[nexus] add alert_list and alert_view external API endpoints#11072
hawkw wants to merge 17 commits into
mainfrom
eliza/alert-list

Conversation

@hawkw

@hawkw hawkw commented Aug 12, 2026

Copy link
Copy Markdown
Member

As discussed in #11005, the only way to view alerts in the public API is to list the alerts that were dispatched to an alert receiver. This API contains details about the delivery status of that dispatched alert, but does not contain the actual data payload of the alert. Furthermore, it means that there is no way to consume alerts without first creating a receiver, and alerts that a receiver is not subscribed to cannot be accessed. As we use alerts for more things, it will become desirable to be able to list alerts without going through alert receivers. For example, we probably want to have a page in the web console that shows a timeline of all alerts (regardless of whether a receiver is subscribed to them) which the API does not currently let us do.

This branch adds alert_list and alert_view API endpoints which list alerts, and fetch an alert by UUID, respectively. The alert list can be filtered based on a time range and/or an alert class or alert class glob. I allowed @ahl to convince me that we probably don't want the alert payload schema for every alert class/version pair to be included in the OpenAPI document for the external API, and we should instead communicate about alert payload schemas separately. Therefore, the alert payload is an untyped JSON blob, but we include the class and schema version so the schema for that payload can (eventually; see #8065) be determined.

I also did a bit of refactoring to the alert_class_list endpoint to share internals with some of the code I added in this branch.

@hawkw hawkw added this to the 23 milestone Aug 12, 2026
@hawkw hawkw added api Related to the API. fault-management Everything related to the fault-management initiative (RFD480 and others) labels Aug 12, 2026
Comment thread nexus/db-queries/src/db/datastore/alert.rs Outdated
Comment thread nexus/tests/integration_tests/alerts.rs
Comment thread nexus/types/versions/src/alert_list/mod.rs Outdated
Comment thread nexus/src/app/alert.rs
Comment thread nexus/db-queries/src/db/datastore/alert.rs Outdated
Comment thread nexus/types/versions/src/alert_list/alert.rs Outdated

@ahl ahl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I know we already discussed, but now that this is done I still think it looks good.

@hawkw
hawkw requested a review from 2joejoe2 August 13, 2026 18:58
@david-crespo
david-crespo removed the request for review from 2joejoe2 August 13, 2026 19:51
]
},
"Alert": {
"description": "An alert.\n\nAlerts represent edge-triggered notifications of an event that occurred in the system at a point in time. See the guide-level documentation on alerts for details.",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What does “edge-triggered” mean here?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ok, I looked it up. I like the precision but it’s a little obscure maybe. Since the sentence already says alerts are of an event at a point in time, I think you could just drop it.

"format": "date-time"
},
"version": {
"description": "The schema version of this alert's data payload.\n\nAlert schemas are versioned on a per-alert-class basis. The schema version for a particular alert class does not correspond to an Oxide API version. Clients should expect to encounter earlier schema versions for a given alert class, if the alert was recorded on an earlier Oxide system software version.",

@david-crespo david-crespo Aug 14, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is good but the last sentence could be clearer. How about:

Clients should expect to encounter earlier schema versions when retrieving alerts recorded by an earlier version of the system software.

I think the “for a given alert class” is covered by the previous sentence.

@david-crespo david-crespo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

API looks good. Couple of small things, take it or leave it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api Related to the API. fault-management Everything related to the fault-management initiative (RFD480 and others)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants