The ceilometer.storage.impl_sqlalchemy ModuleΒΆ

SQLAlchemy storage backend.

class ceilometer.storage.impl_sqlalchemy.Connection(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
      }
Connection.clear()[source]
Connection.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.

Connection.get_event_types()[source]

Return all event types as an iterable of strings.

Connection.get_events(event_filter)[source]

Return an iterable of model.Event objects.

Parameters:event_filter – EventFilter instance
Connection.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.

Connection.get_meters(user=None, project=None, resource=None, source=None, metaquery=None, pagination=None)[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.
  • pagination – Optional pagination query.
Connection.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 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.
  • pagination – Optional pagination query.
Connection.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.
Connection.get_trait_types(event_type)[source]

Return a dictionary containing the name and data type of the trait.

Only trait types for the provided event_type are returned. :param event_type: the type of the Event

Connection.get_traits(event_type, trait_type=None)[source]

Return all trait instances associated with an event_type.

If trait_type is specified, only return instances of that trait type. :param event_type: the type of the Event to filter by :param trait_type: the name of the Trait to filter by

Connection.query_samples(filter_expr=None, orderby=None, limit=None)[source]
Connection.record_events(event_models)[source]

Write the events to SQL database via sqlalchemy.

Parameters:event_models – a list of model.Event objects.

Returns a list of events that could not be saved in a (reason, event) tuple. Reasons are enumerated in storage.model.Event

Flush when they’re all added, unless new EventTypes or TraitTypes are added along the way.

Connection.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
Connection.upgrade()[source]

Previous topic

The ceilometer.storage.pymongo_base Module

Next topic

The ceilometer.storage.impl_mongodb Module

This Page