Difference between revisions of "Ceilometer/ComplexFilterExpressionsInAPIQueries/ComplexFilterExpressionsInStatistics"
(→API examples) |
|||
Line 20: | Line 20: | ||
The same expression language is used as in [[Ceilometer/ComplexFilterExpressionsInAPIQueries#Filter_Expression_Language]] | The same expression language is used as in [[Ceilometer/ComplexFilterExpressionsInAPIQueries#Filter_Expression_Language]] | ||
− | |||
− | |||
− | |||
= Supported DB drivers = | = Supported DB drivers = | ||
= Future improvements = | = Future improvements = |
Revision as of 16:18, 14 April 2014
Contents
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 |
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.
POST request
Filter Expression Language
The same expression language is used as in Ceilometer/ComplexFilterExpressionsInAPIQueries#Filter_Expression_Language
Supported DB drivers
Future improvements
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, }