Create Alert on Any New Messages in a Topic

We would like to alert on any new messages being produced into a specific topic.

The logic for this rule requires setting an Alert for any number of messages being produced to the topic to be greater than ‘0’, but Lenses UI prohibits setting the trigger as less than ‘1’. This is a problem because this only triggers an alert if there are 2 messages produced within the configured timeframe and will be silent if a single message is produced.

How can we make this alert on even a single message produced to a specific topic?

This is on our Product teams radar and as noted, is not possible in the UI.

It is possible to configure this Alert with Lenses API or lenses-cli. Here’s an example of how this can currently be implemented:

  1. Create the alert (within the limitation of the new-message number) in the Lenses UI
  2. Run lenses-cli export alert-settings, by default, it will create a directory named alert-settings and export all alert conditions there.
  3. Edit alert-settings/alert-settings-producer.yaml. Change the number of messages to 0 for the desired alert. You can choose to keep as-is or remove the rest of the alerts. The import function currently only adds new alerts; it does not remove or alter existing ones.
  4. Run lenses-cli import alert-settings
  5. In the web interface, you will notice that a new Data Produced alert was created with the desired settings. You can delete the old instance of the alert.

Cheers!