{"action":"created","issue":{"url":"https://api.github.com/repos/Vertamedia/clickhouse-grafana/issues/12","repository_url":"https://api.github.com/repos/Vertamedia/clickhouse-grafana","labels_url":"https://api.github.com/repos/Vertamedia/clickhouse-grafana/issues/12/labels{/name}","comments_url":"https://api.github.com/repos/Vertamedia/clickhouse-grafana/issues/12/comments","events_url":"https://api.github.com/repos/Vertamedia/clickhouse-grafana/issues/12/events","html_url":"https://github.com/Vertamedia/clickhouse-grafana/issues/12","id":245026046,"number":12,"title":"[Feature request] Округление даты в макросе $from для улучшения cache hit ratio","user":{"login":"kshvakov","id":978534,"avatar_url":"https://avatars0.githubusercontent.com/u/978534?v=4","gravatar_id":"","url":"https://api.github.com/users/kshvakov","html_url":"https://github.com/kshvakov","followers_url":"https://api.github.com/users/kshvakov/followers","following_url":"https://api.github.com/users/kshvakov/following{/other_user}","gists_url":"https://api.github.com/users/kshvakov/gists{/gist_id}","starred_url":"https://api.github.com/users/kshvakov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kshvakov/subscriptions","organizations_url":"https://api.github.com/users/kshvakov/orgs","repos_url":"https://api.github.com/users/kshvakov/repos","events_url":"https://api.github.com/users/kshvakov/events{/privacy}","received_events_url":"https://api.github.com/users/kshvakov/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-07-24T09:46:10Z","updated_at":"2017-07-25T16:58:39Z","closed_at":"2017-07-25T16:58:39Z","body":"плагин отправляет запросы вида\r\n```sql \r\nSELECT t,\r\n       groupArray((App,C/10))\r\nFROM\r\n  (SELECT (intDiv(toUInt32(EventTime), 3600) * 3600) * 1000 AS t,\r\n          CASE\r\n              WHEN ApplicationID = 12 THEN 'XXX'\r\n              WHEN ApplicationID = 30 THEN 'XXX mobile'\r\n              ELSE 'Other'\r\n          END AS App,\r\n          SUM(Impressions) AS C\r\n   FROM metrics.metrics\r\n   WHERE EventDate >= toDate(1500715771)\r\n     AND EventTime >= toDateTime(1500715771)\r\n   GROUP BY t,\r\n            App\r\n   ORDER BY t,\r\n            App)\r\nGROUP BY t\r\nORDER BY t FORMAT JSON\r\n```\r\n\r\n$from вставляется в toDate и toDateTime (toDate(1500715771), toDateTime(1500715771))\r\n\r\n$from меняется каждые N секунд указаные в параметре рефреша \r\n\r\nпроблема в том, что если открыто 10 окон то будет 10 разных $from т.к. открыты они были в разное время (допустим с шагом в 1 секунду)\r\n\r\nхотелось бы таймстамп начала \"сессии\" затранкейтить чтоб уменьшить количество уникальных запросов и закешировать их на nginx"},"comment":{"url":"https://api.github.com/repos/Vertamedia/clickhouse-grafana/issues/comments/317801912","html_url":"https://github.com/Vertamedia/clickhouse-grafana/issues/12#issuecomment-317801912","issue_url":"https://api.github.com/repos/Vertamedia/clickhouse-grafana/issues/12","id":317801912,"user":{"login":"kshvakov","id":978534,"avatar_url":"https://avatars0.githubusercontent.com/u/978534?v=4","gravatar_id":"","url":"https://api.github.com/users/kshvakov","html_url":"https://github.com/kshvakov","followers_url":"https://api.github.com/users/kshvakov/followers","following_url":"https://api.github.com/users/kshvakov/following{/other_user}","gists_url":"https://api.github.com/users/kshvakov/gists{/gist_id}","starred_url":"https://api.github.com/users/kshvakov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kshvakov/subscriptions","organizations_url":"https://api.github.com/users/kshvakov/orgs","repos_url":"https://api.github.com/users/kshvakov/repos","events_url":"https://api.github.com/users/kshvakov/events{/privacy}","received_events_url":"https://api.github.com/users/kshvakov/received_events","type":"User","site_admin":false},"created_at":"2017-07-25T16:58:39Z","updated_at":"2017-07-25T16:58:39Z","body":"Спасибо "}}
{"actor":{"display_login":"kshvakov"}}