Event 'update-status'

Event > List of events > Lifecycle events > update-status

Source: ops.UpdateStatusEvent

See also: Juju | Status

The update-status event is fired periodically by Juju at regular intervals (default: 5m). The update-status hook runs model-wide.

Historically, this hook was intended to allow authors to run code that gets the “health” of the application. However, health checks can also be specified via pebble.

Since the update-status interval is model-wide (not per application) and is set by the user (for example, it can be set to once per hour), charms should not rely on it for critical operations.

In integration tests, unless specifically testing the update-status hook, you may want to “disable” it so it doesn’t interfere with the test. This can be achieved by setting the interval to e.g. 1h at the beginning of the test.

Contents:

Emission sequence

By default, the update-status event is triggered by the Juju controller at 5-minute intervals. This event can be used to monitor the health of deployed charms and determine the status of long running tasks (such as package installation), updating the status message reported to Juju accordingly. The interval can be configured model-wide, for example: juju model-config update-status-hook-interval=1m.

As it is triggered periodically, the update-status can happen in between any other charm events.

Configuring the update-status interval

Existing model

juju model-config update-status-hook-interval=1m

jhack ffwd can be used to temporarily crank the interval up while developing/testing/debugging.

New model

To set the hook interval at model creation time:

juju add-model --config update-status-hook-interval="60m" MyModel

To set the default hook interval for all future models at controller creation time:

juju bootstrap microk8s MyCtrl --model-default update-status-hook-interval="60m"

Observing this event in Ops

In Ops, you can register event hooks to observe the update-status event,

self.framework.observe(
    self.on.update_status, self._on_update_status
)