error querying for measures with flavor_id

Bug #1567686 reported by gordon chung
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Gnocchi
Fix Released
High
Julien Danjou
2.0
Fix Committed
High
Unassigned

Bug Description

searching on flavor_id

[gchung@localhost devstack]$ gnocchi measures aggregation -m cpu_util --resource-type instance --query 'flavor_id=1'
--debug
REQ: curl -g -i -X GET http://10.0.2.15:5000/v2.0 -H "Accept: application/json" -H "User-Agent: keystoneauth1/2.4.0 p
ython-requests/2.9.1 CPython/2.7.10"
Starting new HTTP connection (1): 10.0.2.15
"GET /v2.0 HTTP/1.1" 200 335
RESP: [200] Content-Length: 335 Vary: X-Auth-Token Keep-Alive: timeout=5, max=100 Server: Apache/2.4.17 (Fedora) Open
SSL/1.0.2d-fips mod_wsgi/4.4.8 Python/2.7.10 Connection: Keep-Alive Date: Thu, 07 Apr 2016 22:30:38 GMT Content-Type:
 application/json x-openstack-request-id: req-6be0c3f0-d3ba-4cc0-a14c-2e26473c7e66
RESP BODY: {"version": {"status": "stable", "updated": "2014-04-17T00:00:00Z", "media-types": [{"base": "application/
json", "type": "application/vnd.openstack.identity-v2.0+json"}], "id": "v2.0", "links": [{"href": "http://10.0.2.15:5
000/v2.0/", "rel": "self"}, {"href": "http://docs.openstack.org/", "type": "text/html", "rel": "describedby"}]}}

Making authentication request to http://10.0.2.15:5000/v2.0/tokens
"POST /v2.0/tokens HTTP/1.1" 200 3719
REQ: curl -g -i -X POST http://10.0.2.15:8041/v1/aggregation/resource/instance/metric/cpu_util? -H "User-Agent: keystoneauth1/2.4.0 python-requests/2.9.1 CPython/2.7.10" -H "Content-Type: application/json" -H "Accept: application/json, */*" -H "X-Auth-Token: {SHA1}c48ef1e11383b1ce6935556642d4ad6af0c98ded" -d '{"=": {"flavor_id": 1.0}}'

ERROR:

ConnectFailure: Unable to establish connection to http://10.0.2.15:8041/v1/aggregation/resource/instance/metric/cpu_util?

API.log

2016-04-07 18:30:38.922 TRACE gnocchi Traceback (most recent call last):
2016-04-07 18:30:38.922 TRACE gnocchi File "/usr/lib/python2.7/site-packages/paste/urlmap.py", line 216, in __call_
_
2016-04-07 18:30:38.922 TRACE gnocchi return app(environ, start_response)
2016-04-07 18:30:38.922 TRACE gnocchi File "/usr/lib/python2.7/site-packages/webob/dec.py", line 130, in __call__
2016-04-07 18:30:38.922 TRACE gnocchi resp = self.call_func(req, *args, **self.kwargs)
2016-04-07 18:30:38.922 TRACE gnocchi File "/usr/lib/python2.7/site-packages/webob/dec.py", line 195, in call_func
2016-04-07 18:30:38.922 TRACE gnocchi return self.func(req, *args, **kwargs)
2016-04-07 18:30:38.922 TRACE gnocchi File "/usr/lib/python2.7/site-packages/keystonemiddleware/auth_token/__init__
.py", line 467, in __call__
2016-04-07 18:30:38.922 TRACE gnocchi response = req.get_response(self._app)
2016-04-07 18:30:38.922 TRACE gnocchi File "/usr/lib/python2.7/site-packages/webob/request.py", line 1317, in send
2016-04-07 18:30:38.922 TRACE gnocchi application, catch_exc_info=False)
2016-04-07 18:30:38.922 TRACE gnocchi File "/usr/lib/python2.7/site-packages/webob/request.py", line 1281, in call_
application
2016-04-07 18:30:38.922 TRACE gnocchi app_iter = application(self.environ, start_response)
2016-04-07 18:30:38.922 TRACE gnocchi File "/usr/lib/python2.7/site-packages/webob/exc.py", line 1131, in __call__
2016-04-07 18:30:38.922 TRACE gnocchi return self.application(environ, start_response)
2016-04-07 18:30:38.922 TRACE gnocchi File "/opt/stack/gnocchi/gnocchi/rest/app.py", line 68, in __call__
2016-04-07 18:30:38.922 TRACE gnocchi return self.app(environ, start_response)
2016-04-07 18:30:38.922 TRACE gnocchi File "/usr/lib/python2.7/site-packages/pecan/middleware/recursive.py", line 5
6, in __call__
2016-04-07 18:30:38.922 TRACE gnocchi return self.application(environ, start_response)
2016-04-07 18:30:38.922 TRACE gnocchi File "/usr/lib/python2.7/site-packages/pecan/core.py", line 829, in __call__
2016-04-07 18:30:38.922 TRACE gnocchi return super(Pecan, self).__call__(environ, start_response)
2016-04-07 18:30:38.922 TRACE gnocchi File "/usr/lib/python2.7/site-packages/pecan/core.py", line 678, in __call__
2016-04-07 18:30:38.922 TRACE gnocchi self.invoke_controller(controller, args, kwargs, state)
2016-04-07 18:30:38.922 TRACE gnocchi File "/usr/lib/python2.7/site-packages/pecan/core.py", line 572, in invoke_co
ntroller
2016-04-07 18:30:38.922 TRACE gnocchi result = controller(*args, **kwargs)
2016-04-07 18:30:38.922 TRACE gnocchi File "/opt/stack/gnocchi/gnocchi/rest/__init__.py", line 1308, in post
2016-04-07 18:30:38.922 TRACE gnocchi self.resource_type)._search(sort=groupby)
2016-04-07 18:30:38.922 TRACE gnocchi File "/opt/stack/gnocchi/gnocchi/rest/__init__.py", line 1104, in _search
2016-04-07 18:30:38.922 TRACE gnocchi **pagination_opts)
2016-04-07 18:30:38.922 TRACE gnocchi File "/usr/lib/python2.7/site-packages/oslo_db/api.py", line 148, in wrapper
2016-04-07 18:30:38.922 TRACE gnocchi ectxt.value = e.inner_exc
2016-04-07 18:30:38.922 TRACE gnocchi File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 220, in
__exit__
2016-04-07 18:30:38.922 TRACE gnocchi self.force_reraise()
2016-04-07 18:30:38.922 TRACE gnocchi File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 196, in
force_reraise
2016-04-07 18:30:38.922 TRACE gnocchi six.reraise(self.type_, self.value, self.tb)
2016-04-07 18:30:38.922 TRACE gnocchi File "/usr/lib/python2.7/site-packages/oslo_db/api.py", line 138, in wrapper
2016-04-07 18:30:38.922 TRACE gnocchi return f(*args, **kwargs)
2016-04-07 18:30:38.922 TRACE gnocchi File "/opt/stack/gnocchi/gnocchi/indexer/sqlalchemy.py", line 687, in list_re
sources
2016-04-07 18:30:38.922 TRACE gnocchi all_resources = q.all()
2016-04-07 18:30:38.922 TRACE gnocchi File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/query.py", line 2588,
 in all
2016-04-07 18:30:38.922 TRACE gnocchi return list(self)

2016-04-07 18:30:38.922 TRACE gnocchi File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/query.py", line 2736, in __iter__
2016-04-07 18:30:38.922 TRACE gnocchi return self._execute_and_instances(context)
2016-04-07 18:30:38.922 TRACE gnocchi File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/query.py", line 2751, in _execute_and_instances
2016-04-07 18:30:38.922 TRACE gnocchi result = conn.execute(querycontext.statement, self._params)
2016-04-07 18:30:38.922 TRACE gnocchi File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 914, in execute
2016-04-07 18:30:38.922 TRACE gnocchi return meth(self, multiparams, params)
2016-04-07 18:30:38.922 TRACE gnocchi File "/usr/lib64/python2.7/site-packages/sqlalchemy/sql/elements.py", line 323, in _execute_on_connection
2016-04-07 18:30:38.922 TRACE gnocchi return connection._execute_clauseelement(self, multiparams, params)
2016-04-07 18:30:38.922 TRACE gnocchi File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 1010, in _execute_clauseelement
2016-04-07 18:30:38.922 TRACE gnocchi compiled_sql, distilled_params
2016-04-07 18:30:38.922 TRACE gnocchi File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 1146, in _execute_context
2016-04-07 18:30:38.922 TRACE gnocchi context)
2016-04-07 18:30:38.922 TRACE gnocchi File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 1337, in _handle_dbapi_exception
2016-04-07 18:30:38.922 TRACE gnocchi util.raise_from_cause(newraise, exc_info)
2016-04-07 18:30:38.922 TRACE gnocchi File "/usr/lib64/python2.7/site-packages/sqlalchemy/util/compat.py", line 200, in raise_from_cause
2016-04-07 18:30:38.922 TRACE gnocchi reraise(type(exception), exception, tb=exc_tb, cause=cause)
2016-04-07 18:30:38.922 TRACE gnocchi File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 1139, in _execute_context
2016-04-07 18:30:38.922 TRACE gnocchi context)
2016-04-07 18:30:38.922 TRACE gnocchi File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/default.py", line 450, in do_execute
2016-04-07 18:30:38.922 TRACE gnocchi cursor.execute(statement, parameters)
2016-04-07 18:30:38.922 TRACE gnocchi DBError: (psycopg2.ProgrammingError) operator does not exist: character varying = numeric
2016-04-07 18:30:38.922 TRACE gnocchi LINE 4: WHERE instance.flavor_id = 1.0 ORDER BY instance.id ASC
2016-04-07 18:30:38.922 TRACE gnocchi ^
2016-04-07 18:30:38.922 TRACE gnocchi HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
2016-04-07 18:30:38.922 TRACE gnocchi [SQL: 'SELECT anon_1.resource_created_by_user_id AS anon_1_resource_created_by_user_id, anon_1.resource_created_by_project_id AS anon_1_resource_created_by_project_id, anon_1.resource_started_at AS anon_1_resource_started_at, anon_1.resource_revision_start AS anon_1_resource_revision_start, anon_1.resource_ended_at AS anon_1_resource_ended_at, anon_1.resource_user_id AS anon_1_resource_user_id, anon_1.resource_project_id AS anon_1_resource_project_id, anon_1.resource_original_resource_id AS anon_1_resource_original_resource_id, anon_1.instance_id AS anon_1_instance_id, anon_1.resource_id AS anon_1_resource_id, anon_1.resource_type AS anon_1_resource_type, anon_1.instance_display_name AS anon_1_instance_display_name, anon_1.instance_host AS anon_1_instance_host, anon_1.instance_image_ref AS anon_1_instance_image_ref, anon_1.instance_flavor_id AS anon_1_instance_flavor_id, anon_1.instance_server_group AS anon_1_instance_server_group, archive_policy_1.name AS archive_policy_1_name, archive_policy_1.back_window AS archive_policy_1_back_window, archive_policy_1.definition AS archive_policy_1_definition, archive_policy_1.aggregation_methods AS archive_policy_1_aggregation_methods, metric_1.id AS metric_1_id, metric_1.archive_policy_name AS metric_1_archive_policy_name, metric_1.created_by_user_id AS metric_1_created_by_user_id, metric_1.created_by_project_id AS metric_1_created_by_project_id, metric_1.resource_id AS metric_1_resource_id, metric_1.name AS metric_1_name, metric_1.status AS metric_1_status \nFROM (SELECT resource.created_by_user_id AS resource_created_by_user_id, resource.created_by_project_id AS resource_created_by_project_id, resource.started_at AS resource_started_at, resource.revision_start AS resource_revision_start, resource.ended_at AS resource_ended_at, resource.user_id AS resource_user_id, resource.project_id AS resource_project_id, resource.original_resource_id AS resource_original_resource_id, instance.id AS instance_id, resource.id AS resource_id, resource.type AS resource_type, instance.display_name AS instance_display_name, instance.host AS instance_host, instance.image_ref AS instance_image_ref, instance.flavor_id AS instance_flavor_id, instance.server_group AS instance_server_group \nFROM resource JOIN instance ON resource.id = instance.id \nWHERE instance.flavor_id = %(flavor_id_1)s ORDER BY instance.id ASC \n LIMIT %(param_1)s) AS anon_1 LEFT OUTER JOIN metric AS metric_1 ON anon_1.resource_id = metric_1.resource_id AND metric_1.status = %(status_1)s LEFT OUTER JOIN archive_policy AS archive_policy_1 ON archive_policy_1.name = metric_1.archive_policy_name ORDER BY anon_1.instance_id ASC'] [parameters: {'flavor_id_1': 1.0, 'param_1': 1000, 'status_1': 'active'}]
2016-04-07 18:30:38.922 TRACE gnocchi
[pid: 9653|app: 0|req: 5263/10543] 10.0.2.15 () {38 vars in 634 bytes} [Thu Apr 7 18:30:38 2016] POST /v1/aggregation/resource/instance/metric/cpu_util => generated 0 bytes in 123 msecs (HTTP/1.1 500) 0 headers in 0 bytes (0 switches on core 19)

Julien Danjou (jdanjou)
Changed in gnocchi:
importance: Undecided → High
assignee: nobody → Julien Danjou (jdanjou)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to gnocchi (master)

Fix proposed to branch: master
Review: https://review.openstack.org/303400

Changed in gnocchi:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to gnocchi (master)

Reviewed: https://review.openstack.org/303400
Committed: https://git.openstack.org/cgit/openstack/gnocchi/commit/?id=0ab4672413b7ea452b374153823b84b53e12be51
Submitter: Jenkins
Branch: master

commit 0ab4672413b7ea452b374153823b84b53e12be51
Author: Julien Danjou <email address hidden>
Date: Fri Apr 8 15:00:20 2016 +0200

    indexer: teach SQL query compiler numeric and string types

    Change-Id: I25dd86c1b46d07c6438bc45dadbbd7fc4734c94c
    Closes-Bug: #1567686

Changed in gnocchi:
status: In Progress → Fix Committed
Julien Danjou (jdanjou)
Changed in gnocchi:
milestone: none → 2.1.0
status: Fix Committed → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to gnocchi (stable/2.0)

Fix proposed to branch: stable/2.0
Review: https://review.openstack.org/305343

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to gnocchi (stable/2.0)

Reviewed: https://review.openstack.org/305343
Committed: https://git.openstack.org/cgit/openstack/gnocchi/commit/?id=1908134075e42493e43aed93b63056f5421e9e4c
Submitter: Jenkins
Branch: stable/2.0

commit 1908134075e42493e43aed93b63056f5421e9e4c
Author: Julien Danjou <email address hidden>
Date: Fri Apr 8 15:00:20 2016 +0200

    indexer: teach SQL query compiler numeric and string types

    Change-Id: I25dd86c1b46d07c6438bc45dadbbd7fc4734c94c
    Closes-Bug: #1567686
    (cherry picked from commit 0ab4672413b7ea452b374153823b84b53e12be51)

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.