SQLAlchemy storage backend.
-
class ceilometer.storage.impl_sqlalchemy.Connection(conf)[source]
Bases: ceilometer.storage.base.Connection
SqlAlchemy connection.
-
clear()[source]
-
get_event_interval(event_filter)[source]
Return the min and max timestamps from samples,
using the event_filter to limit the samples seen.
( datetime.datetime(), datetime.datetime() )
-
get_meter_statistics(event_filter, period=None)[source]
Return a dictionary containing meter statistics.
described by the query parameters.
The filter must have a meter value set.
- { ‘min’:
- ‘max’:
‘avg’:
‘sum’:
‘count’:
‘period’:
‘period_start’:
‘period_end’:
‘duration’:
‘duration_start’:
‘duration_end’:
}
-
get_meters(user=None, project=None, resource=None, source=None, metaquery={})[source]
Return an iterable of dictionaries containing meter information.
- { ‘name’: name of the meter,
- ‘type’: type of the meter (guage, counter),
‘unit’: unit of the meter,
‘resource_id’: UUID of the resource,
‘project_id’: UUID of project owning the resource,
‘user_id’: UUID of user owning the resource,
}
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.
|
-
get_projects(source=None)[source]
Return an iterable of project id strings.
Parameters: | source – Optional source filter. |
-
get_resources(user=None, project=None, source=None, start_timestamp=None, end_timestamp=None, metaquery={}, resource=None)[source]
Return an iterable of dictionaries containing resource information.
- { ‘resource_id’: UUID of the resource,
- ‘project_id’: UUID of project owning the resource,
‘user_id’: UUID of user owning the resource,
‘timestamp’: UTC datetime of last update to the resource,
‘metadata’: most current metadata for the resource,
‘meter’: list of the meters reporting data for the resource,
}
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.
- end_timestamp – Optional modified timestamp end range.
- metaquery – Optional dict with metadata to match on.
- resource – Optional resource filter.
|
-
get_samples(event_filter)[source]
Return an iterable of samples as created by
ceilometer.meter.meter_message_from_counter().
-
get_users(source=None)[source]
Return an iterable of user id strings.
Parameters: | source – Optional source filter. |
-
get_volume_max(event_filter)[source]
-
get_volume_sum(event_filter)[source]
-
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 |
-
upgrade(version=None)[source]
-
class ceilometer.storage.impl_sqlalchemy.SQLAlchemyStorage[source]
Bases: ceilometer.storage.base.StorageEngine
Put the data into a SQLAlchemy database.
Tables:
- user
- { id: user uuid }
- source
- { id: source id }
- project
- { id: project uuid }
- meter
- the raw incoming data
- { id: meter id
counter_name: counter name
user_id: user uuid (->user.id)
project_id: project uuid (->project.id)
resource_id: resource uuid (->resource.id)
resource_metadata: metadata dictionaries
counter_type: counter type
counter_unit: counter unit
counter_volume: counter volume
timestamp: datetime
message_signature: message signature
message_id: message uuid
}
- resource
- the metadata for resources
- { id: resource uuid
resource_metadata: metadata dictionaries
project_id: project uuid (->project.id)
user_id: user uuid (->user.id)
}
- sourceassoc
- the relationships
- { meter_id: meter id (->meter.id)
project_id: project uuid (->project.id)
resource_id: resource uuid (->resource.id)
user_id: user uuid (->user.id)
source_id: source id (->source.id)
}
-
static get_connection(conf)[source]
Return a Connection instance based on the configuration settings.
-
register_opts(conf)[source]
Register any configuration options used by this engine.