Jump to: navigation, search

Difference between revisions of "Ceilometer/ComplexFilterExpressionsInAPIQueries/ComplexFilterExpressionsInStatistics"

(Future improvements)
(REST resource)
Line 10: Line 10:
 
| '/query/samples/statistics'  
 
| '/query/samples/statistics'  
 
| retrieve statistics of samples for meter(s)
 
| retrieve statistics of samples for meter(s)
 +
| Statistics
 +
|-
 +
| '/query/alarms/statistics'
 +
| retrieve statistics of alarms(s)
 +
| Statistics
 +
|-
 +
| '/query/alarms/history/statistics'
 +
| retrieve statistics of alarm changes(s)
 
| Statistics
 
| Statistics
 
|-
 
|-

Revision as of 16:32, 14 April 2014

Architecture

REST resource

The new solution includes new REST resources for provide complex queries for sample statistics:

REST Resource Functionality Returned Object Type
'/query/samples/statistics' retrieve statistics of samples for meter(s) Statistics
'/query/alarms/statistics' retrieve statistics of alarms(s) Statistics
'/query/alarms/history/statistics' retrieve statistics of alarm changes(s) Statistics

As new resource is defined, the simple statistics query support remained as it is now, which means that the API is backward compatible and also a new query grammar could be defined without limitations.

Filter Expression Language

The same expression language is used as in Ceilometer/ComplexFilterExpressionsInAPIQueries#Filter_Expression_Language

Supported DB drivers

Planned to be supported:

  • SqlAlchemy
  • MongoDB

API examples

Consider a requirement for determining, for some tenant, the number of distinct instances (cardinality) as well as the total number of instance samples (count). You might also want to see this information with 15 minute long intervals. Then, using current API the query would look like the following:

GET /v2/meters/instance/statistics?aggregate.func=cardinality
                                  &aggregate.param=resource_id
                                  &aggregate.func=count
                                  &groupby=project_id&period=900

With the new API it would look like the following

POST /v2/query/samples/statistics

With the body:

{
filter: {"=": {"counter_name": "instance"}},
aggregates: [{"func": "cardinality", "param": ["resource_id"]}, {"func": "count", "param": []}],
groupby: ["project_id"],
period: 900,
}