{"action":"created","issue":{"url":"https://api.github.com/repos/Vertamedia/clickhouse-grafana/issues/78","repository_url":"https://api.github.com/repos/Vertamedia/clickhouse-grafana","labels_url":"https://api.github.com/repos/Vertamedia/clickhouse-grafana/issues/78/labels{/name}","comments_url":"https://api.github.com/repos/Vertamedia/clickhouse-grafana/issues/78/comments","events_url":"https://api.github.com/repos/Vertamedia/clickhouse-grafana/issues/78/events","html_url":"https://github.com/Vertamedia/clickhouse-grafana/issues/78","id":362956193,"node_id":"MDU6SXNzdWUzNjI5NTYxOTM=","number":78,"title":"Add $perSecond macro for computing rate for counter-type metrics","user":{"login":"JiriHorky","id":427968,"node_id":"MDQ6VXNlcjQyNzk2OA==","avatar_url":"https://avatars1.githubusercontent.com/u/427968?v=4","gravatar_id":"","url":"https://api.github.com/users/JiriHorky","html_url":"https://github.com/JiriHorky","followers_url":"https://api.github.com/users/JiriHorky/followers","following_url":"https://api.github.com/users/JiriHorky/following{/other_user}","gists_url":"https://api.github.com/users/JiriHorky/gists{/gist_id}","starred_url":"https://api.github.com/users/JiriHorky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JiriHorky/subscriptions","organizations_url":"https://api.github.com/users/JiriHorky/orgs","repos_url":"https://api.github.com/users/JiriHorky/repos","events_url":"https://api.github.com/users/JiriHorky/events{/privacy}","received_events_url":"https://api.github.com/users/JiriHorky/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-09-23T16:27:32Z","updated_at":"2018-09-29T17:55:05Z","closed_at":null,"author_association":"NONE","body":"First of all, thanks for the great grafana plugin.\r\n\r\nWhat we are missing in our environment is a $perSecond macro that would be very similar to existing $rate macro, but would compute runningDifference of value as well\r\n\r\n$rate is now defined as\r\n`SELECT t, v/runningDifference(t/1000) vRate FROM `\r\n\r\n$perSecond should be defined as:\r\n`SELECT t, runningDifference(v)/runningDifference(t/1000) vRate FROM `\r\n\r\nOne of the usecase is to see per second network traffic throughput in bytes/s taken from ifconfig (actually collected as a counter type metric by collectd).\r\n\r\nBasically, $rate is now usefull for Gauge type metrics, whereas $perSecond would be useful for Counter metrics."},"comment":{"url":"https://api.github.com/repos/Vertamedia/clickhouse-grafana/issues/comments/425663774","html_url":"https://github.com/Vertamedia/clickhouse-grafana/issues/78#issuecomment-425663774","issue_url":"https://api.github.com/repos/Vertamedia/clickhouse-grafana/issues/78","id":425663774,"node_id":"MDEyOklzc3VlQ29tbWVudDQyNTY2Mzc3NA==","user":{"login":"JiriHorky","id":427968,"node_id":"MDQ6VXNlcjQyNzk2OA==","avatar_url":"https://avatars1.githubusercontent.com/u/427968?v=4","gravatar_id":"","url":"https://api.github.com/users/JiriHorky","html_url":"https://github.com/JiriHorky","followers_url":"https://api.github.com/users/JiriHorky/followers","following_url":"https://api.github.com/users/JiriHorky/following{/other_user}","gists_url":"https://api.github.com/users/JiriHorky/gists{/gist_id}","starred_url":"https://api.github.com/users/JiriHorky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JiriHorky/subscriptions","organizations_url":"https://api.github.com/users/JiriHorky/orgs","repos_url":"https://api.github.com/users/JiriHorky/repos","events_url":"https://api.github.com/users/JiriHorky/events{/privacy}","received_events_url":"https://api.github.com/users/JiriHorky/received_events","type":"User","site_admin":false},"created_at":"2018-09-29T17:55:05Z","updated_at":"2018-09-29T17:55:05Z","author_association":"NONE","body":"Hi @hagen1778 , \r\n\r\nthanks for reaching back. For the input that you described, the $rate macro works well. But for \"counter\" metrics, i.e. metrics that only grow, your input would look like this:\r\n\r\n```\r\n┌─────────────t─┬─────c─┐\r\n│ 1535712660000 │ 34785 │\r\n│ 1535712720000 │ 69794 │\r\n│ 1535712780000 │ 104930 │\r\n│ 1535712840000 │ 139653 │\r\n│ 1535712900000 │ 175111 │\r\n```\r\n\r\nAnd for this input, you need to \"derive\" even the value, not just the time. Please note that this is very standard way of collecting metrics - it is called Counter in collectd, and your \"bytes transferred\" from \"ifconfig\" output are collected like that. \r\nIn standard graphite, function \"perSecond()\" computes the rate I am looking for, therefore my suggestion for the template name.\r\n"}}
{"actor":{"display_login":"JiriHorky"}}