add unit attribute to statistics

statistics currently aren't associated with a unit it just
provides sum, average, etc... values without a unit context

Fixes: Bug#1204458
Change-Id: Ib92a6a2ab5899a0b269424e94468a73b6559deda
Doc: measurements: add doc on Cinder/Swift config

Some meters need Cinder/Swift to be configured in a particular fashion to work.
Add links to the configuration bits regarding Cinder and Swift.

Change-Id: I68a605e5152fc3d15bb06f63066edd5390a2dfa7
Add pagination support for MongoDB

Paginate db query result of MongoDB.
The query methods support pagination include
get_resources, get_meters, get_alarms.
It is a part of blueprint paginate-db-search.

Implements blueprint paginate-db-search

Change-Id: Id9162782a6c96b4bb0ed04d828791b8b1b1379d4
Remove source as a publisher argument

We used to have source as a publisher argument, but this anyway ends being
included in its Sample itself. So rather than complicating the internal
publishing API, simplify it and just include source as a Sample field.

Change-Id: Idb9d0c2b5969318dd16394a81d7d61c67f613892
rpc: remove source argument from message conversion

Change-Id: Ic727b7f61e7b2e38a36f5c2757271668ec143d77
Return message_id in POSTed samples

Change-Id: I93e33158ad9933bcdfc263f9f59146524d8b6824
Fixes: bug #1202696
Add support for API message localization

Using the lazy gettext functionality from oslo gettextutils,
it is possible to use the Accept-Language header to translate
an exception message to the user requested locale and return
that translation from the API.

Implements bp user-locale-api

Change-Id: I48de5e681827305eef60c7a77e8d3091f9d64be0
Co-authored-by: Mathew Odden <mrodden@us.ibm.com>
Co-authored-by: Ben Nemec <openstack@nemebean.com>
Merge "Remove source as a publisher argument"
Merge "rpc: remove source argument from message conversion"
Handle more Nova and Neutron events

This introduces a simpler matching system for event types that supports
wildcard. We use this to grab all Nova instances notifications and a bit
more Neutron events.

We also change the get_event_types to a property to simplify the code a
bit.

Change-Id: Ica133ff2e9348a5d2640f068251d034bbd8a4f43
Merge "Add pagination support for MongoDB"
Fix resources/meters pagination test

Wrong functions have been tested in some tests.

Change-Id: I80dee61b127752ee13b6cddd8b25efb75593c280
Merge "Return message_id in POSTed samples"
Merge "Fix resources/meters pagination test"
Use MongoDB aggregate to get resources list

This avoids querying two different collections to get the data, doing
aggregation on one is enough.

Change-Id: Ia21693051daefd1ebd4d0c7d07b76d4712b0542c
Add first and last sample timestamp

When listing resources, it's useful to know where it started and where it
stopped. We don't have this precise information, but we can at least say
when we get the first and last timestamp.

Blueprint: api-v2-improvement

Change-Id: Icf678820bf7c3e6e12288b15623b653d9a942f21
Signed-off-by: Julien Danjou <julien@danjou.info>
Remove MongoDB TTL support for MongoDB < 2.2

We already depends on MongoDB >= 2.2

Change-Id: I3d91fb08eb51ba6cfd5256abbeca43ed98321412
Change meter.resource_metadata column type

The existing schema limits for meter.resource_metadata column to
5000 characters, which may not be enough for a large metadata
payload encoded as JSON.
Using a Text column will let us store an arbitrary amount of data
in that column without worrying about overflowing.

Closes-Bug: #1204638

Change-Id: I5eb1cdbb3d4770a8348682634a78ccb0f843c141
Consume notification from the default queue

Closes-Bug: #1209198

Change-Id: Id31953207d03a172353dc311a1a7df7b88780318
Signed-off-by: Julien Danjou <julien@danjou.info>
Include previous state in alarm notification

We now provide both the current and previous alarm states
in the notification.

This allows differential logic to be applied by the webhook
implementation, for example depending on whether the previous
state was known or insufficient data.

It also allows the initial and subsequent notifications to be
distinguished for repeat_actions alarms, without resorting to
fragile string comparisons between 'Transition to ...' and
'Remaining as ...'.

Change-Id: I61294e98ddf504b3ab22e9b16ab718d64c27486f