{"action":"closed","issue":{"url":"https://api.github.com/repos/influxdata/influxdb/issues/7030","repository_url":"https://api.github.com/repos/influxdata/influxdb","labels_url":"https://api.github.com/repos/influxdata/influxdb/issues/7030/labels{/name}","comments_url":"https://api.github.com/repos/influxdata/influxdb/issues/7030/comments","events_url":"https://api.github.com/repos/influxdata/influxdb/issues/7030/events","html_url":"https://github.com/influxdata/influxdb/issues/7030","id":166341806,"number":7030,"title":"[Question / Feature] Grouping unknown frequency of occupancy metrics with sum and mean ","user":{"login":"mattheworiordan","id":43789,"avatar_url":"https://avatars.githubusercontent.com/u/43789?v=3","gravatar_id":"","url":"https://api.github.com/users/mattheworiordan","html_url":"https://github.com/mattheworiordan","followers_url":"https://api.github.com/users/mattheworiordan/followers","following_url":"https://api.github.com/users/mattheworiordan/following{/other_user}","gists_url":"https://api.github.com/users/mattheworiordan/gists{/gist_id}","starred_url":"https://api.github.com/users/mattheworiordan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattheworiordan/subscriptions","organizations_url":"https://api.github.com/users/mattheworiordan/orgs","repos_url":"https://api.github.com/users/mattheworiordan/repos","events_url":"https://api.github.com/users/mattheworiordan/events{/privacy}","received_events_url":"https://api.github.com/users/mattheworiordan/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-07-19T14:13:27Z","updated_at":"2016-11-17T06:48:07Z","closed_at":"2016-11-17T06:48:07Z","body":"I am not sure if this is solveable currently in Influx so it's quite possibly a feature request.  Please close this issue and point me in the right direction if this is possible.\n### Feature Request\n\n**Proposal:** \n\nOccupancy metrics, like total connection count for example, are easily queried currently with a simple query such as `select mean(connection_count) from connections group by time(1m)`, and regardless of how many times that metric has been recorded in Influx, this will give you a fairly good idea of what the connection count was for that period.\n\nHowever, if for example you had 10 routers, and each router was publishing it's own connection count, you will want to know what the average connection count was per router per period being queried, and then add those averages up i.e. two operations.\n\n**Current behavior:** \n\nTake the following data:\n\n```\nID | connection_count | time\nA  | 10               | 1 Jan 2016 10:00:00\nB  | 15               | 1 Jan 2016 10:00:01\nC  | 20               | 1 Jan 2016 10:00:02\nA  | 10               | 1 Jan 2016 10:00:10\nB  | 15               | 1 Jan 2016 10:00:11\nC  | 20               | 1 Jan 2016 10:00:12\nA  | 10               | 1 Jan 2016 10:00:20\nB  | 15               | 1 Jan 2016 10:00:21\nC  | 20               | 1 Jan 2016 10:00:22\n```\n\nIf you wanted to know what the total connection count was for that 1m period, you could either do:\n\n```\nselect sum(connection_count) from from connections group by time(1m)\n```\n\nwhich would give you `180`, the wrong figure.  The connection count is 45.\n\nOr you could use mean:\n\n```\nselect mean(connection_count) from from connections group by time(1m)\n```\n\nbut would give you `15` which too is the wrong figure.\n\n**Desired behavior:**\n\nIdeally what you need is a way to group and sum, and allow that to be returned as a total.  So pseudo query such as \n\n```\nselect sum(select mean(connection_count) as connection_count, time from from connections group by ID, time(1m)) group by time(1m)\n```\n\nClearly that is the WRONG syntax, but I think it demonstrates the requirement.\n\n**Use case:** \n\nBecause currently without this there is no sensible way to calculate occupancy metrics i.e. absolute values.  For example, in Grafana we need to query the above but grouped by data centre. This is unfortunately not possible because the grouping by data_centre either sums or means the values from each router.\n"}}
{"actor":{"display_login":"jwilder"}}