The ceilometer.storage.impl_sqlalchemy Module

SQLAlchemy storage backend.

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

Bases: ceilometer.storage.base.Connection

Put the data into a SQLAlchemy database.

Tables:

- meter
  - meter definition
  - { id: meter id
      name: meter name
      type: meter type
      unit: meter unit
      }
- resource
  - resource definition
  - { internal_id: resource id
      resource_id: resource uuid
      user_id: user uuid
      project_id: project uuid
      source_id: source id
      resource_metadata: metadata dictionary
      metadata_hash: metadata dictionary hash
      }
- sample
  - the raw incoming data
  - { id: sample id
      meter_id: meter id            (->meter.id)
      resource_id: resource id      (->resource.internal_id)
      volume: sample volume
      timestamp: datetime
      recorded_at: datetime
      message_signature: message signature
      message_id: message uuid
      }
clear()[source]
clear_expired_metering_data(ttl)[source]

Clear expired data from the backend storage system.

Clearing occurs according to the time-to-live. :param ttl: Number of seconds to keep records for.

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

Return an iterable of api_models.Statistics instances.

Items are containing meter statistics described by the query parameters. The filter must have a meter value set.

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

Return an iterable of api_models.Meter instances

Parameters:
  • user – Optional ID for user that owns the resource.
  • project – Optional ID for project that owns the resource.
  • resource – Optional ID of the resource.
  • source – Optional source filter.
  • metaquery – Optional dict with metadata to match on.
  • limit – Maximum number of results to return.
  • unique – If set to true, return only unique meter information.
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 api_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.
get_samples(sample_filter, limit=None)[source]

Return an iterable of api_models.Samples.

Parameters:
  • sample_filter – Filter.
  • limit – Maximum number of results to return.
query_samples(filter_expr=None, orderby=None, limit=None)[source]
record_metering_data(*args, **kwargs)[source]

Write the data to the backend storage system.

Parameters:data – a dictionary such as returned by ceilometer.publisher.utils.meter_message_from_counter
upgrade()[source]