Featured image for Cryostat (was ContainerJFR) topics.

Cryostat has always issued notifications when monitoring Java applications with Java Flight Recorder (JFK). Version 2.1 of Cryostat has a new implementation and interface for notifications that increases the amount of information offered, enhances the user's control over what is displayed, and improves Cryostat performance.

Cryostat interface

Thanks to a new WebSocket interface, Cryostat issues notifications for events that were not reported before. Thus, by default, many more notifications are reported to the user. For instance, the new automated rules feature adds rules to lots of instances at once and emits notifications when each rule is created or deleted, as well as when a rule starts a recording, copies a recording to archive, or prunes an old recording from the archive. The volume of notifications could become especially daunting, as Figure 1 illustrates.

Cryostat can deliver an enormous number of notifications.
Figure 1: Cryostat can deliver an enormous number of notifications.

To deal with this problem, Cryostat 2.1 gives users the ability to enable and disable the notifications they receive through a new Settings page (Figure 2). The user can select notifications by category or, with a single click, enable or disable all notifications.

The Settings view in Cryostat 2.1 includes a Notifications widget with toggles for each notification category.
Figure 2: The Settings view in Cryostat 2.1 includes a Notifications widget with toggles for each notification category.

For example, to disable all notifications that might be emitted by the background activities of the automated rules, toggle off the following categories:

  • Recording Created (emitted when an automated rule creates a new recording on a target)
  • Recording Saved (emitted when an automated rule copies an active recording to the archives)
  • Archived Recording Deleted (emitted when an automated rule trims old copies from the archives)

Implementation and performance

Cryostat uses a WebSocket connection between the Cryostat backend and the web client running in your browser to display notifications when various actions or state changes occur. In Cryostat 2.1, a WebSocket notification is emitted for all conceptual actions and state changes that can occur, whereas previous versions of Cryostat did not include notifications for some types of action or state change. Formatting is also more consistent now, with a detailed title and description for each notification type.

When a notification category is disabled, the messages are still sent over the WebSocket connection, but the toast notification in the web client simply isn't displayed. The user's chosen settings are entirely on the web client side and are persisted in the browser's local storage. The web client still receives and holds the notification information in memory. Therefore, if you re-enable a notification category, any previously emitted notifications in that category will still be available for you to read. This way, Cryostat avoids cluttering the user interface with notifications while still preserving a log of actions and state changes for inspection if needed.

Note: The notification categories do not distinguish between actions performed by an automated rule and those performed by an interactive user by another client via API requests. If you disable these notifications, they will be disabled for all cases, not only when an automated rule performs them.

Web client performance has also been improved by using notifications to update the state of resources such as active recordings, archived recordings, and templates. For example, when an active recording is deleted, the web client now uses the corresponding notification from the backend to update the active recordings list by deleting the recording in question. Other state updates work in a similar manner. Previously, this workflow would have required sending an HTTP GET request to the backend to get the entire, updated list of active recordings and using this list to fully replace the outdated list displayed to the user. Now the web client simply updates a single deleted recording entry.

Conclusion

Cryostat's notification process is much better structured and richer in version 2.1. It requires a bit more preparation in your browser to get the notifications you want and exclude the many others you might find distracting. But consistency and performance improvements create a better user interface.

Last updated: November 6, 2023