The ceilometer.event.storage.impl_sqlalchemy ModuleΒΆ

SQLAlchemy storage backend.

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

Bases: ceilometer.event.storage.base.Connection

Put the event data into a SQLAlchemy database.

Tables:

- EventType
  - event definition
  - { id: event type id
      desc: description of event
      }
- Event
  - event data
  - { id: event id
      message_id: message id
      generated = timestamp of event
      event_type_id = event type -> eventtype.id
      }
- TraitInt
  - int trait value
  - { event_id: event -> event.id
      key: trait type
      value: integer value
      }
- TraitDatetime
  - int trait value
  - { event_id: event -> event.id
      key: trait type
      value: datetime value
      }
- TraitText
  - int trait value
  - { event_id: event -> event.id
      key: trait type
      value: text value
      }
- TraitFloat
  - int trait value
  - { event_id: event -> event.id
      key: trait type
      value: float value
      }
clear()[source]
clear_expired_event_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.
get_event_types()[source]

Return all event types as an iterable of strings.

get_events(event_filter)[source]

Return an iterable of model.Event objects.

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

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

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.

upgrade()[source]