[openstack-dev] [Ceilometer] Meter-list with multiple filters in simple query is not working

Srikanth Vavilapalli srikanth.vavilapalli at ericsson.com
Mon Oct 12 18:53:28 UTC 2015


Hi 

Thanks for your reply. 

Yes, I need the logical OR operation here. 

Seems the simple query is not either doing logical "AND" operation also. Because, if so, the output should be empty list in my example. However, the output is list of meters with the project_id value as d41cd...*. If I interchange the project_id field values in my query, the resulting output is list of meters with the project_id value as f28d2...*. i.e. the API is using the last q.field value for filtering for the "project_id" field.

I have seen the complex query format supporting these additional operations like logical "OR", but my understanding from the documentation was that these complex queries are supported only for Samples, Alarms and Alarms History, but not for "Meters". Nevertheless I still tried this complex query with /v2/meters by following /v2/query/samples example and it was returning 404 Not found. Plz correct me if I am doing something wrong here.

curl -X POST -H 'X-Auth-Token:eed134b917914fd987e50d8ec1651213' -H 'Content-Type: application/json' -d '{"filter" : "{\"or\":[{\"=\": {\"project_id\": \"f28d2e522e1f466a95194c10869acd0c\"}},{\"=\": {\"project_id\": \"d41cdd2ade394e599b40b9b50d9cd623\"}}]}}' "http://10.11.10.1:8777/v2/query/meters"

Thanks
Srikanth
  

-----Original Message-----
From: Eoghan Glynn [mailto:eglynn at redhat.com] 
Sent: Monday, October 12, 2015 4:38 AM
To: OpenStack Development Mailing List (not for usage questions)
Subject: Re: [openstack-dev] [Ceilometer] Meter-list with multiple filters in simple query is not working



> Hi
> 
> Can anyone plz help me on how to specify a simple query with multiple 
> values for a query field in a Ceilometer meter-list request? I need to 
> fetch meters that belongs to more than one project id. I have tried 
> the following query format, but only the last query value (in this 
> case, project_id=
> d41cdd2ade394e599b40b9b50d9cd623) is used for filtering. Any help is 
> appreciated here.
> 
> curl -H 'X-Auth-Token:<token>'
> http://localhost:8777/v2/meters?q.field=project_id&q.op=eq&q.value=f28
> d2e522e1f466a95194c10869acd0c&q.field=project_id&q.op=eq&q.value=d41cd
> d2ade394e599b40b9b50d9cd623
> 
> Thanks
> Srikanth

By "not working" you mean "not doing what you (incorrectly) expect it to do"

Your query asks for samples with aproject_id set to *both* f28d.. *and* d41c..
The result is empty, as a sample can't be associated with two project_ids.

The ceilometer simple query API combines all filters using logical AND.

Seems like you want logical OR here, which is possible to express via complex
queries:

  http://docs.openstack.org/developer/ceilometer/webapi/v2.html#complex-query

Cheers,
Eoghan



__________________________________________________________________________
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev



More information about the OpenStack-dev mailing list