Currently, the only way to view alerts in the public API is to list the alerts that were dispatched to an alert receiver. This 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.
Therefore, we should add an API for listing alerts. It should probably be ordered by the alert's timestamp and paginated by timestamp and UUID (to ensure that we can uniquely identify the alert when paginating), similar to the audit log. It should also be possible to filter the alert list based on a set of alert classes or alert class globs, and a start/end time range. Luckily, there's already a database query for listing alerts that does all of this, it's just currently only used for omdb commands. It shouldn't be too difficult to wire this into the external API.
Currently, the only way to view alerts in the public API is to list the alerts that were dispatched to an alert receiver. This 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.
Therefore, we should add an API for listing alerts. It should probably be ordered by the alert's timestamp and paginated by timestamp and UUID (to ensure that we can uniquely identify the alert when paginating), similar to the audit log. It should also be possible to filter the alert list based on a set of alert classes or alert class globs, and a start/end time range. Luckily, there's already a database query for listing alerts that does all of this, it's just currently only used for
omdbcommands. It shouldn't be too difficult to wire this into the external API.