{"action":"opened","issue":{"url":"https://api.github.com/repos/influxdata/kapacitor/issues/2063","repository_url":"https://api.github.com/repos/influxdata/kapacitor","labels_url":"https://api.github.com/repos/influxdata/kapacitor/issues/2063/labels{/name}","comments_url":"https://api.github.com/repos/influxdata/kapacitor/issues/2063/comments","events_url":"https://api.github.com/repos/influxdata/kapacitor/issues/2063/events","html_url":"https://github.com/influxdata/kapacitor/issues/2063","id":363321280,"node_id":"MDU6SXNzdWUzNjMzMjEyODA=","number":2063,"title":"batch query not returning values with period(30m) but does with period(1h)","user":{"login":"nbari","id":364199,"node_id":"MDQ6VXNlcjM2NDE5OQ==","avatar_url":"https://avatars1.githubusercontent.com/u/364199?v=4","gravatar_id":"","url":"https://api.github.com/users/nbari","html_url":"https://github.com/nbari","followers_url":"https://api.github.com/users/nbari/followers","following_url":"https://api.github.com/users/nbari/following{/other_user}","gists_url":"https://api.github.com/users/nbari/gists{/gist_id}","starred_url":"https://api.github.com/users/nbari/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nbari/subscriptions","organizations_url":"https://api.github.com/users/nbari/orgs","repos_url":"https://api.github.com/users/nbari/repos","events_url":"https://api.github.com/users/nbari/events{/privacy}","received_events_url":"https://api.github.com/users/nbari/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-09-24T21:08:11Z","updated_at":"2018-09-24T21:08:11Z","closed_at":null,"author_association":"NONE","body":"I have this query on a `.tick` script:\r\n\r\n```\r\nbatch\r\n    |query('''\r\n      SELECT max(failed)\r\n      FROM \"influxdb\".\"default\".\"test_tasks\"\r\n      WHERE \"type\"='backup' AND \"paused\"='0' AND \"environment\"='test'\r\n    ''')\r\n        .groupBy('deployment_name', 'plugin', 'target')\r\n        .period(30m)\r\n        .every(30m)\r\n    |last('max')\r\n        .as('max')\r\n    |alert()\r\n        .warn(lambda: \"max\" != 0)\r\n        .log('/var/log/test.log')\r\n```\r\n\r\nWhile using `kapacitor watch my_task` I get outputs like this:\r\n\r\n    ks=2018-09-24T19:59:18.480Z lvl=debug msg=\"starting next batch query\" service=kapacitor task_master=main task=my_task node=alert4 query=\"SELECT max(failed) FROM influxdb.\\\"default\\\".test_tasks WHERE type = 'backup' AND paused = '0' AND environment = 'test' AND time >= '2018-09-24T19:29:18.47999607Z' AND time < '2018-09-24T19:59:18.47999607Z' GROUP BY deployment_name, plugin, target\"\r\n\r\nBut no alert has been triggered, if I run the query via http to influxdb I do indeed get results, this is my query:\r\n\r\n    curl -G 'http://0:9086/query?db=influxdb' --data-urlencode \"q=select max(failed) as failed from \\\"test_tasks\\\" WHERE \\\"type\\\"='backup' AND \\\"paused\\\"='0' AND \\\"environment\\\" = 'test' AND time >= '2018-09-24T19:29:18.47999607Z' AND time < '2018-09-24T19:59:18.47999607Z' group by deployment_name, plugin,target\" -u \"foo:bar\" -s  | jq  '.results[].series[]' -c\r\n\r\nreturns:\r\n\r\n     \r\n     {\"values\":[[\"2018-09-24T19:30:31Z\",1]],\"columns\":[\"time\",\"failed\"],\"tags{\"target\":\"test\",\"plugin\":\"mysql\",\"deployment_name\":\"test\"},\"name\":\"test_tasks\"}\r\n\r\nThe period that kapacitor is using is `time >= '2018-09-24T19:29:18.47999607Z' AND time < '2018-09-24T19:59:18.47999607Z'` but for some reason is not returning or getting the value at `2018-09-24T19:30:31Z`\r\n\r\nIf I set `period(1h)` it works, but problem is that I start to get duplicated alerts.\r\n\r\nAny ideas of what could it be wrong?\r\n"}}
{"actor":{"display_login":"nbari"}}