Support to query user messages filtering by timestamp comparison¶
Add support for querying user messages by specifying a timestamp, which will be compared to the created_at field, and Manila will return all the messages that match to the given time condition.
Manila API only support filtering user messages by discrete values (such as message_id or resource_id), even though user messages have timestamp fields as created_at, users can not query by a given period. Users may be interested in user messages in specific periods in order to analyze causes of asynchronous errors. Currently they need to retrieve and filter the resource messages by themselves. This change will improve the usability when searching for user messages and the efficiency of timestamp based queries.
In large scale environment, lots of asynchronous error messages may be created . In order to quickly locate the cause of the error, user or system manager only need to get user messages corresponding to the resource which was created during a specified time period, instead of querying all asynchronous error messages of the resource.
The following changes are proposed:
Introduce two additional parameters in the url that searches for user messages, being both timestamps.
created_before Return results older than the specified time.
created_since Return results since the specified time.
Data model impact¶
REST API impact¶
List user messages API will accept new query string parameters. User can add
created_before to the url to query user messages older than the specified
created_since to query user messages newer than the specified
time, or use both of them to query user messages that were created during the
specified time interval. This changes also need to bump the microversion of
API to keep forward compatibility.
The time format is ISO 8601, it can be as follows:
Other end user impact¶
One command will be updated:
manila message-list [--resource_id <resource_id>] [--resource_type <type>] [--action_id <id>] [--detail_id <id>] [--request_id <request_id>] [--level <level>] [--limit <limit>] [--offset <offset>] [--sort-key <sort_key>] [--sort-dir <sort_dir>] [--columns <columns>] [--before <b_time>] [--since <s_time>]
Python client may add help to inform users this new filter, and will update the corresponding cli command.
Performance can be improved for timestamp based queries while using the database engine. Additionally, using indexes, the query performance will be enhanced.
Other deployer impact¶
- Primary assignee:
Add API filter
Add querying support in sql
Add related unit and functional tests
Add python-manilaclient support
Add docs update
Unit test to test if those filters can be correctly applied.
Tempest test if change filter work correctly from API perspective.
The manila API documentation will need to be updated to reflect the REST API changes.