Description of problem: It looks that Events cannot be filtered by time-based fields (timestamp_start or something similar). In previous versions (part of kilo) timestamp filtering worked at least somehow [1]. In new versions (in mitaka) error is raised when gt operator is used on timestamp_start field. Version-Release number of selected component (if applicable): 6 (propably) How reproducible: always Steps to Reproduce: 1. query ceilometer API with {'field' => 'start_timestamp','op' => 'gt','value' => '2016-05-13T06:46:23'} Actual results: error Operator gt is not supported. Only equality operator is available for field start_timestamp Expected results: list of events filtered by start_timestamp (or other time-like field) Additional info: It was disabled in https://github.com/openstack/ceilometer/commit/ac3ff88c03ea3685d7f3511bbae16785646e56ba [1] http://paste.openstack.org/show/497913/
I'll look into implementing that.
The feature never existed AFAIU, there was a bug that allowed to run this kind of query but it'd return invalid data. A sanity check has been added in Liberty, which blocked that altogether.
I confirm that this feature have never been implemented, but they are a good chance that it was working by accident if the storage backend was mongodb and the fields are start_timestamp and/or end_timestamp, because the code that build the mongodb query is shared between events and samples API, and samples API supports gt/ge.
Regarding to documentation at [1], EventQuery looked to me, that it can be used for filtering and I didn't see any operator restriction there. So it looked as an intended behaviour. We are open to change our event querying to other way which is supported, but unfortonately it looks there is not such way (and that is the reason for this BZ). [1] http://docs.openstack.org/developer/ceilometer/webapi/v2.html#get--v2-events
@Julien: Thanks a lot for the "fix" https://review.openstack.org/#/c/338390/ Would it be possible get it into Mitaka release?
(In reply to Marek Aufart from comment #8) > @Julien: Thanks a lot for the "fix" https://review.openstack.org/#/c/338390/ > > Would it be possible get it into Mitaka release? That is my plan ^^
Fixed in Ceilometer 6.1.2, need to rebase the package.
To test, what used to work and now shuold work again is to filter by timestamp the events using `le' and `ge' operetors on end_timestamp and start_timestamp respectively. Before this bug was fixed, only `eq' was accepted while the real operator being applied was le or ge. The Ceilometer client should be able to emit this query with "ceilometer event-list --query".
Tested with packages: --------------------- openstack-ceilometer-compute-6.1.2-1.el7ost.noarch python-ceilometerclient-2.3.0-1.el7ost.noarch openstack-ceilometer-collector-6.1.2-1.el7ost.noarch openstack-ceilometer-common-6.1.2-1.el7ost.noarch python-ceilometer-6.1.2-1.el7ost.noarch openstack-ceilometer-api-6.1.2-1.el7ost.noarch openstack-ceilometer-notification-6.1.2-1.el7ost.noarch openstack-ceilometer-polling-6.1.2-1.el7ost.noarch openstack-ceilometer-central-6.1.2-1.el7ost.noarch ceilometer event-list --no-traits +--------------------------------------+-----------------------+----------------------------+ | Message ID | Event Type | Generated | +--------------------------------------+-----------------------+----------------------------+ | f89f70a4-b89b-447c-a7fc-6e91db5f3622 | volume.create.start | 2016-07-21T12:42:23.234000 | | 4572c026-e5c7-4c5e-bce0-0ad04bf8a2eb | volume.create.end | 2016-07-21T12:42:23.756000 | | 5058cdfd-39a1-4e22-afb5-5c798161dff2 | network.create.start | 2016-07-21T12:43:57.591000 | | 552d28b9-6078-4b14-910e-8cb40e149933 | network.create.end | 2016-07-21T12:43:57.844000 | | 56accbdb-8548-4d67-8594-f280890ed529 | subnet.create.start | 2016-07-21T12:46:41.011000 | | 5a58c3be-162d-4959-897e-e7397487762c | subnet.create.end | 2016-07-21T12:46:41.305000 | | 127e53dd-dfad-4785-9ea8-8a14ed3d8273 | snapshot.create.start | 2016-07-21T12:48:54.742000 | | 510bbed6-2984-44ee-a4e5-c55e90c5ca7b | snapshot.create.end | 2016-07-21T12:48:55.224000 | | 2214bac0-63fd-4187-ac94-178216f14abb | snapshot.create.start | 2016-07-21T12:50:37.363000 | | 81586be2-655c-4285-9021-5b666a3b93f0 | snapshot.create.end | 2016-07-21T12:50:37.842000 | | 673286b8-15be-4c38-86cd-f97f3bfde84b | snapshot.delete.start | 2016-07-21T12:50:59.297000 | | 40033b9c-0621-4052-99f5-ba37a430b8d1 | snapshot.delete.end | 2016-07-21T12:51:01.819000 | | 2b01bab0-df79-4a01-8787-e7a8c76950ea | snapshot.delete.start | 2016-07-21T12:51:38.813000 | | 84c52a59-b365-4bfd-810c-774ee30d1acd | snapshot.delete.end | 2016-07-21T12:51:41.204000 | | 13f84266-05ef-4d67-ac66-2df1b7d7fd69 | volume.delete.start | 2016-07-21T12:52:31.156000 | | 0f796ebe-6be0-416c-9953-f17971a05a23 | volume.delete.end | 2016-07-21T12:52:33.418000 | | 6d99d315-e1b8-47d7-a9b0-27eec6acc362 | image.update | 2016-07-21T12:54:45.155000 | | 5b508520-9326-4c4e-b5e4-04e6e5bbb637 | image.upload | 2016-07-21T12:54:58.354000 | | 73f544ce-c0f7-41c3-b2a6-85445fa07d3e | image.update | 2016-07-21T12:54:58.452000 | +--------------------------------------+-----------------------+----------------------------+ Filter with 'ge': ceilometer event-list --no-traits --query "start_timestamp>=2016-07-21T12:54:45" +--------------------------------------+--------------+----------------------------+ | Message ID | Event Type | Generated | +--------------------------------------+--------------+----------------------------+ | 6d99d315-e1b8-47d7-a9b0-27eec6acc362 | image.update | 2016-07-21T12:54:45.155000 | | 5b508520-9326-4c4e-b5e4-04e6e5bbb637 | image.upload | 2016-07-21T12:54:58.354000 | | 73f544ce-c0f7-41c3-b2a6-85445fa07d3e | image.update | 2016-07-21T12:54:58.452000 | +--------------------------------------+--------------+----------------------------+ Filter with 'le': ceilometer event-list --no-traits --query "end_timestamp<=2016-07-21T12:43:50" +--------------------------------------+---------------------+----------------------------+ | Message ID | Event Type | Generated | +--------------------------------------+---------------------+----------------------------+ | f89f70a4-b89b-447c-a7fc-6e91db5f3622 | volume.create.start | 2016-07-21T12:42:23.234000 | | 4572c026-e5c7-4c5e-bce0-0ad04bf8a2eb | volume.create.end | 2016-07-21T12:42:23.756000 | +--------------------------------------+---------------------+----------------------------+ Compound query "ge & le": ceilometer event-list --no-traits --query "start_timestamp>=2016-07-21T12:46:50;end_timestamp<=2016-07-21T12:52:30" +--------------------------------------+-----------------------+----------------------------+ | Message ID | Event Type | Generated | +--------------------------------------+-----------------------+----------------------------+ | 127e53dd-dfad-4785-9ea8-8a14ed3d8273 | snapshot.create.start | 2016-07-21T12:48:54.742000 | | 510bbed6-2984-44ee-a4e5-c55e90c5ca7b | snapshot.create.end | 2016-07-21T12:48:55.224000 | | 2214bac0-63fd-4187-ac94-178216f14abb | snapshot.create.start | 2016-07-21T12:50:37.363000 | | 81586be2-655c-4285-9021-5b666a3b93f0 | snapshot.create.end | 2016-07-21T12:50:37.842000 | | 673286b8-15be-4c38-86cd-f97f3bfde84b | snapshot.delete.start | 2016-07-21T12:50:59.297000 | | 40033b9c-0621-4052-99f5-ba37a430b8d1 | snapshot.delete.end | 2016-07-21T12:51:01.819000 | | 2b01bab0-df79-4a01-8787-e7a8c76950ea | snapshot.delete.start | 2016-07-21T12:51:38.813000 | | 84c52a59-b365-4bfd-810c-774ee30d1acd | snapshot.delete.end | 2016-07-21T12:51:41.204000 | +--------------------------------------+-----------------------+----------------------------+
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://rhn.redhat.com/errata/RHEA-2016-1597.html