The ceilometer.storage.impl_mongodb
ModuleΒΆ
MongoDB storage backend
-
class
ceilometer.storage.impl_mongodb.
Connection
(url)[source] Bases:
ceilometer.storage.pymongo_base.Connection
Put the data into a MongoDB database
Collections:
- meter - the raw incoming data - resource - the metadata for resources - { _id: uuid of resource, metadata: metadata dictionaries user_id: uuid project_id: uuid meter: [ array of {counter_name: string, counter_type: string, counter_unit: string} ] }
-
clear
()[source]
-
clear_expired_metering_data
(ttl)[source] Clear expired data from the backend storage system.
Clearing occurs with native MongoDB time-to-live feature.
-
get_meter_statistics
(sample_filter, period=None, groupby=None, aggregate=None)[source] Return an iterable of models.Statistics instance.
Items are containing meter statistics described by the query parameters. The filter must have a meter value set.
-
get_resources
(user=None, project=None, source=None, start_timestamp=None, start_timestamp_op=None, end_timestamp=None, end_timestamp_op=None, metaquery=None, resource=None, pagination=None)[source] Return an iterable of models.Resource instances
Parameters: - user – Optional ID for user that owns the resource.
- project – Optional ID for project that owns the resource.
- source – Optional source filter.
- start_timestamp – Optional modified timestamp start range.
- start_timestamp_op – Optional start time operator, like gt, ge.
- end_timestamp – Optional modified timestamp end range.
- end_timestamp_op – Optional end time operator, like lt, le.
- metaquery – Optional dict with metadata to match on.
- resource – Optional resource filter.
- pagination – Optional pagination query.
-
classmethod
paginate_query
(q, db_collection, limit=None, marker=None, sort_keys=None, sort_dir='desc')[source] Returns a query result with sorting / pagination.
Pagination works by requiring sort_key and sort_dir. We use the last item in previous page as the ‘marker’ for pagination. So we return values that follow the passed marker in the order.
Parameters: - q – the query dict passed in.
- db_collection – Database collection that be query.
- limit – maximum number of items to return.
- marker – the last item of the previous page; we return the next results after this item.
- sort_keys – array of attributes by which results be sorted.
- sort_dir – direction in which results be sorted (asc, desc).
Returns: The query with sorting/pagination added.
-
record_metering_data
(data)[source] Write the data to the backend storage system.
Parameters: data – a dictionary such as returned by ceilometer.meter.meter_message_from_counter
-
static
update_ttl
(ttl, ttl_index_name, index_field, coll)[source] Update or ensure time_to_live indexes.
Parameters: - ttl – time to live in seconds.
- ttl_index_name – name of the index we want to update or ensure.
- index_field – field with the index that we need to update.
- coll – collection which indexes need to be updated.
-
upgrade
()[source]
-