The ceilometer.storage.pymongo_base ModuleΒΆ

Common functions for MongoDB and DB2 backends

class ceilometer.storage.pymongo_base.Connection(url)[source]

Bases: ceilometer.storage.base.Connection

Base Connection class for MongoDB and DB2 drivers.

Connection.get_event_types()[source]

Return all event types as an iter of strings.

Connection.get_events(event_filter)[source]

Return an iter of models.Event objects.

Parameters:event_filter – storage.EventFilter object, consists of filters for events that are stored in database.
Connection.get_meters(user=None, project=None, resource=None, source=None, metaquery=None, pagination=None)[source]

Return an iterable of models.Meter instances

Parameters:
  • user – Optional ID for user that owns the resource.
  • project – Optional ID for project that owns the resource.
  • resource – Optional resource filter.
  • source – Optional source filter.
  • metaquery – Optional dict with metadata to match on.
  • pagination – Optional pagination query.
Connection.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.
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.

Parameters:event_type – the type of the Event.
Connection.get_traits(event_type, trait_name=None)[source]

Return all trait instances associated with an event_type.

If trait_type is specified, only return instances of that trait type.

Parameters:
  • event_type – the type of the Event to filter by
  • trait_name – 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 database.

Return a list of events of type models.Event.DUPLICATE in case of trying to write an already existing event to the database, or models.Event.UNKONW_PROBLEM in case of any failures with recording the event in the database.

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

Previous topic

The ceilometer.storage.impl_hbase Module

Next topic

The ceilometer.storage.impl_sqlalchemy Module

This Page