normandy
normandy copied to clipboard
Add filter object for current date filtering (scheduled recipes)
It would be useful to have a filter object that can filter by date. This is already possible in JEXL, and we've used it in practice. It can help future experiments be more declarative about their schedules, especially in relation to tools like Experimenter.
In JEXL this looks something like this:
normandy.request_time > '2018-09-25T07:15:00'|date
I propose two new filter objects: notBefore
and notAfter
, both of which take a single argument: an ISO8601 formatted datetime. These filter objects would specify the time range the recipe is valid. Examples:
{
"type": "notBefore",
"datetime": "2019-02-01T00:00:00Z"
}
{
"type": "notAfter",
"datetime": "2019-03-01T00:00:00Z"
}
These names are borrowed from TLS certificate validity metadata. Alternatively, we could go with other names. Perhaps simply before
and after
(which have the opposite meanings than the above) or "startDatetime" and "endDatetime".
Another option would be to combine these into a single filter object, such as:
{
"type": "datetime",
"notBefore": "2019-02-01T00:00:00Z",
"notAfter": "2019-03-01T00:00:00Z"
}
We would probably want to make each field optional, but require that at least one is set. This might make tools like Delivery Console easier to write.
@peterbe what do you think about the above?