The monasca_events_api.app.model.envelope Module

class monasca_events_api.app.model.envelope.Envelope(event, meta)[source]

Bases: dict

property creation_time
property event
property meta
classmethod new_envelope(event, project_id)[source]

Creates new event envelope

Event envelope is combined of of following properties

  • event - dict

  • creation_time - timestamp

  • meta - meta block

Example output json would be like this:

{
    "event": {
      "message": "Some message",
      "dimensions": {
        "hostname": "devstack"
      }
    },
    "creation_time": 1447834886,
    "meta": {
      "project_id": "e4bd29509eda473092d32aadfee3e7b1",
    }
}
Parameters
  • event (dict) – original event element

  • project_id (str) – project id to be put in meta field

exception monasca_events_api.app.model.envelope.EventEnvelopeException[source]

Bases: Exception

monasca_events_api.app.model.envelope.serialize_envelope(envelope)[source]

Returns json representation of an envelope.

Returns

json object of envelope

Return type

json or a bytestring encoding encoded representation of it.