"Fossies" - the Fresh Open Source Software Archive

Member "masakari-9.0.0/doc/source/user/notifications.rst" (13 May 2020, 5384 Bytes) of package /linux/misc/openstack/masakari-9.0.0.tar.gz:

As a special service "Fossies" has tried to format the requested source page into HTML format (assuming markdown format). Alternatively you can here view or download the uninterpreted source code file. A member file download can also be achieved by clicking within a package contents listing on the according byte size field.

Notifications in Masakari

Similar to other OpenStack services Masakari emits notifications to the message bus with the Notifier class provided by oslo.messaging-doc. From the notification consumer point of view a notification consists of two parts: an envelope with a fixed structure defined by oslo.messaging and a payload defined by the service emitting the notification. The envelope format is the following:

    "priority": <string, selected from a predefined list by the sender>,
    "event_type": <string, defined by the sender>,
    "timestamp": <string, the isotime of when the notification emitted>,
    "publisher_id": <string, defined by the sender>,
    "message_id": <uuid, generated by oslo>,
    "payload": <json serialized dict, defined by the sender>
oslo.messaging provides below choices of notification drivers:
Driver Description
messaging Send notifications using the 1.0 message format
messagingv2 Send notifications using the 2.0 message format (with a message envelope)
routing Configurable routing notifier (by priority or event_type)
log Publish notifications via Python logging infrastructure
test Store notifications in memory for test verification
noop Disable sending notifications entirely

So notifications can be completely disabled by setting the following in Masakari configuration file:

driver = noop

Masakari supports only Versioned notifications.

Versioned notifications

Masakari code uses the masakari.rpc.get_notifier call to get a configured oslo.messaging Notifier object and it uses the oslo provided functions on the Notifier object to emit notifications. The configuration of the returned Notifier object depends on the parameters of the get_notifier call and the value of the oslo.messaging configuration options driver and topics. The versioned notification the the payload is not a free form dictionary but a serialized oslo.versionedobjects-doc.

For example the wire format of the segment.update notification looks like the following:

    "event_type": "api.update.segments.start",
    "timestamp": "2018-11-27 14:32:20.396940",
    "payload": {
        "masakari_object.name": "SegmentApiPayload",
        "masakari_object.data": {
            "description": null,
            "fault": null,
            "recovery_method": "auto",
            "name": "test",
            "service_type": "compute",
            "id": 877,
            "uuid": "89597691-bebd-4860-a93e-1b6e9de34b9e"
        }, "
        "masakari_object.version": "1.0",
        "masakari_object.namespace": "masakari"
    "priority": "INFO",
    "publisher_id": "masakari-api:test-virtualbox",
    "message_id": "e6322900-025d-4dd6-a3a1-3e0e1e9badeb"

The serialized oslo versionedobject as a payload provides a version number to the consumer so the consumer can detect if the structure of the payload is changed. Masakari provides the following contract regarding the versioned notification payload:

Existing versioned notifications