{"action":"created","issue":{"url":"https://api.github.com/repos/prometheus/prometheus/issues/3086","repository_url":"https://api.github.com/repos/prometheus/prometheus","labels_url":"https://api.github.com/repos/prometheus/prometheus/issues/3086/labels{/name}","comments_url":"https://api.github.com/repos/prometheus/prometheus/issues/3086/comments","events_url":"https://api.github.com/repos/prometheus/prometheus/issues/3086/events","html_url":"https://github.com/prometheus/prometheus/issues/3086","id":251075919,"number":3086,"title":"delta, rate, irate over-report by up to 100%","user":{"login":"vgough","id":604168,"avatar_url":"https://avatars2.githubusercontent.com/u/604168?v=4","gravatar_id":"","url":"https://api.github.com/users/vgough","html_url":"https://github.com/vgough","followers_url":"https://api.github.com/users/vgough/followers","following_url":"https://api.github.com/users/vgough/following{/other_user}","gists_url":"https://api.github.com/users/vgough/gists{/gist_id}","starred_url":"https://api.github.com/users/vgough/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vgough/subscriptions","organizations_url":"https://api.github.com/users/vgough/orgs","repos_url":"https://api.github.com/users/vgough/repos","events_url":"https://api.github.com/users/vgough/events{/privacy}","received_events_url":"https://api.github.com/users/vgough/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-08-17T21:20:54Z","updated_at":"2017-08-17T22:19:26Z","closed_at":"2017-08-17T22:19:26Z","body":"**What did you do?**\r\ndelta(x[2m]) when collecting at 1m intervals shows 2x the expected values.   The over-reporting appears to be based on a ratio of aggregation window and collection windows.  If you aggregate over 5m window, then over-reporting drops to 25%.  At 10m aggregation window, it drops to 11%.\r\n\r\nCan also be seen using this test:\r\n\r\n```diff\r\n--- a/promql/testdata/functions.test\r\n+++ b/promql/testdata/functions.test\r\n@@ -117,6 +117,15 @@ eval instant at 20m delta(http_requests[20m])\r\n \r\n clear\r\n \r\n+# Tests for delta().\r\n+load 1m\r\n+       http_requests{path=\"/foo\"}      0 0 0 0 1 1 1 1\r\n+\r\n+eval instant at 290s delta(http_requests[2m])\r\n+       {path=\"/foo\"} 1\r\n+\r\n+clear\r\n+\r\n # Tests for idelta().\r\n load 5m\r\n        http_requests{path=\"/foo\"}      0 50 100 150\r\n```\r\n\r\n```\r\n--- FAIL: TestEvaluations (2.13s)\r\n        promql_test.go:33: error running test testdata/functions.test: error in eval delta(http_requests[2m]): expected 1 for {path=\"/foo\"} but got 2\r\nFAIL\r\n```\r\n\r\nSeems like a problem with how sample bounds impact the delta computation: https://github.com/prometheus/prometheus/blob/master/promql/functions.go#L117\r\n\r\n\r\n**Environment**\r\nLinux, multiple versions, distributions, kernels.\r\n\r\n* Prometheus version: \r\nproduction versions of prometheus, and github master."},"comment":{"url":"https://api.github.com/repos/prometheus/prometheus/issues/comments/323209867","html_url":"https://github.com/prometheus/prometheus/issues/3086#issuecomment-323209867","issue_url":"https://api.github.com/repos/prometheus/prometheus/issues/3086","id":323209867,"user":{"login":"brian-brazil","id":7115638,"avatar_url":"https://avatars0.githubusercontent.com/u/7115638?v=4","gravatar_id":"","url":"https://api.github.com/users/brian-brazil","html_url":"https://github.com/brian-brazil","followers_url":"https://api.github.com/users/brian-brazil/followers","following_url":"https://api.github.com/users/brian-brazil/following{/other_user}","gists_url":"https://api.github.com/users/brian-brazil/gists{/gist_id}","starred_url":"https://api.github.com/users/brian-brazil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brian-brazil/subscriptions","organizations_url":"https://api.github.com/users/brian-brazil/orgs","repos_url":"https://api.github.com/users/brian-brazil/repos","events_url":"https://api.github.com/users/brian-brazil/events{/privacy}","received_events_url":"https://api.github.com/users/brian-brazil/received_events","type":"User","site_admin":false},"created_at":"2017-08-17T22:19:26Z","updated_at":"2017-08-17T22:19:26Z","body":"This behaviour is correct, see https://www.youtube.com/watch?v=67Ulrq6DxwA\r\n\r\nYou should also not use delta, you want rate, irate or increase here."}}
{"actor":{"display_login":"brian-brazil"}}