The ceilometer.storage.impl_mongodb Module

MongoDB storage backend

class ceilometer.storage.impl_mongodb.Connection(conf, 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, limit=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.
  • limit – Maximum number of results to return.
record_metering_data(data)[source]
record_metering_data_batch(samples)[source]

Record the metering data in batch.

Parameters:samples – a list of samples dict.
static update_ttl(ttl, ttl_index_name, index_field, coll)[source]

Update or create time_to_live indexes.

Parameters:
  • ttl – time to live in seconds.
  • ttl_index_name – name of the index we want to update or create.
  • index_field – field with the index that we need to update.
  • coll – collection which indexes need to be updated.
upgrade()[source]

Project Source

This Page