The ceilometer.storage.base Module

Base classes for storage engines

class ceilometer.storage.base.Connection(conf, url)[source]

Bases: object

Base class for storage system connections.

static clear()[source]

Clear database.

static clear_expired_metering_data(ttl)[source]

Clear expired data from the backend storage system.

Clearing occurs according to the time-to-live.

Parameters:ttl – Number of seconds to keep records for.
classmethod get_capabilities()[source]

Return an dictionary with the capabilities of each driver.

static get_meter_statistics(sample_filter, period=None, groupby=None, aggregate=None)[source]

Return an iterable of model.Statistics instances.

The filter must have a meter value set.

static get_meters(user=None, project=None, resource=None, source=None, metaquery=None, limit=None, unique=False)[source]

Return an iterable of model.Meter instances.

Iterable items containing meter information. :param user: Optional ID for user that owns the resource. :param project: Optional ID for project that owns the resource. :param resource: Optional resource filter. :param source: Optional source filter. :param metaquery: Optional dict with metadata to match on. :param limit: Maximum number of results to return. :param unique: If set to true, return only unique meter information.

static 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.

Iterable items containing resource information. :param user: Optional ID for user that owns the resource. :param project: Optional ID for project that owns the resource. :param source: Optional source filter. :param start_timestamp: Optional modified timestamp start range. :param start_timestamp_op: Optional timestamp start range operation. :param end_timestamp: Optional modified timestamp end range. :param end_timestamp_op: Optional timestamp end range operation. :param metaquery: Optional dict with metadata to match on. :param resource: Optional resource filter. :param limit: Maximum number of results to return.

static get_samples(sample_filter, limit=None)[source]

Return an iterable of model.Sample instances.

Parameters:
  • sample_filter – Filter.
  • limit – Maximum number of results to return.
classmethod get_storage_capabilities()[source]

Return a dictionary representing the performance capabilities.

This is needed to evaluate the performance of each driver.

static query_samples(filter_expr=None, orderby=None, limit=None)[source]

Return an iterable of model.Sample objects.

Parameters:
  • filter_expr – Filter expression for query.
  • orderby – List of field name and direction pairs for order by.
  • limit – Maximum number of results to return.
static record_metering_data(data)[source]

Write the data to the backend storage system.

Parameters:data – a dictionary such as returned by ceilometer.publisher.utils.meter_message_from_counter

All timestamps must be naive utc datetime object.

record_metering_data_batch(samples)[source]

Record the metering data in batch

static upgrade()[source]

Migrate the database to version or the most recent version.

class ceilometer.storage.base.Model(**kwds)[source]

Bases: object

Base class for storage API models.

as_dict()[source]
classmethod get_field_names()[source]