{"action":"created","issue":{"url":"https://api.github.com/repos/buildkite/buildkite-cloudwatch-metrics-publisher/issues/9","repository_url":"https://api.github.com/repos/buildkite/buildkite-cloudwatch-metrics-publisher","labels_url":"https://api.github.com/repos/buildkite/buildkite-cloudwatch-metrics-publisher/issues/9/labels{/name}","comments_url":"https://api.github.com/repos/buildkite/buildkite-cloudwatch-metrics-publisher/issues/9/comments","events_url":"https://api.github.com/repos/buildkite/buildkite-cloudwatch-metrics-publisher/issues/9/events","html_url":"https://github.com/buildkite/buildkite-cloudwatch-metrics-publisher/pull/9","id":141464885,"number":9,"title":"Load 72 hours worth of historical data to ensure counters are zero'd","user":{"login":"lox","id":15758,"avatar_url":"https://avatars.githubusercontent.com/u/15758?v=3","gravatar_id":"","url":"https://api.github.com/users/lox","html_url":"https://github.com/lox","followers_url":"https://api.github.com/users/lox/followers","following_url":"https://api.github.com/users/lox/following{/other_user}","gists_url":"https://api.github.com/users/lox/gists{/gist_id}","starred_url":"https://api.github.com/users/lox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lox/subscriptions","organizations_url":"https://api.github.com/users/lox/orgs","repos_url":"https://api.github.com/users/lox/repos","events_url":"https://api.github.com/users/lox/events{/privacy}","received_events_url":"https://api.github.com/users/lox/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-03-17T02:56:33Z","updated_at":"2016-03-17T03:57:11Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/buildkite/buildkite-cloudwatch-metrics-publisher/pulls/9","html_url":"https://github.com/buildkite/buildkite-cloudwatch-metrics-publisher/pull/9","diff_url":"https://github.com/buildkite/buildkite-cloudwatch-metrics-publisher/pull/9.diff","patch_url":"https://github.com/buildkite/buildkite-cloudwatch-metrics-publisher/pull/9.patch"},"body":"@daveoxley pointed out a number of bugs with the current approach, namely that builds and jobs that ran for longer than the 5 minute window would have their data lost, as the current approach only considers builds/jobs created within that window, not ones that finish or update during that window.\r\n\r\nThis PR fixes that by pulling in 72 hours worth of historical data, but only providing non-zero stats for those that were created, started, scheduled or finished within the last 5 minutes. \r\n\r\nThis also fixes a bug where `extractMetricData` was looking at the global stats for pipelines and queues. "},"comment":{"url":"https://api.github.com/repos/buildkite/buildkite-cloudwatch-metrics-publisher/issues/comments/197682417","html_url":"https://github.com/buildkite/buildkite-cloudwatch-metrics-publisher/pull/9#issuecomment-197682417","issue_url":"https://api.github.com/repos/buildkite/buildkite-cloudwatch-metrics-publisher/issues/9","id":197682417,"user":{"login":"lox","id":15758,"avatar_url":"https://avatars.githubusercontent.com/u/15758?v=3","gravatar_id":"","url":"https://api.github.com/users/lox","html_url":"https://github.com/lox","followers_url":"https://api.github.com/users/lox/followers","following_url":"https://api.github.com/users/lox/following{/other_user}","gists_url":"https://api.github.com/users/lox/gists{/gist_id}","starred_url":"https://api.github.com/users/lox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lox/subscriptions","organizations_url":"https://api.github.com/users/lox/orgs","repos_url":"https://api.github.com/users/lox/repos","events_url":"https://api.github.com/users/lox/events{/privacy}","received_events_url":"https://api.github.com/users/lox/received_events","type":"User","site_admin":false},"created_at":"2016-03-17T03:57:11Z","updated_at":"2016-03-17T03:57:11Z","body":"Yeah, they are alternate approaches to solve the same problem. "}}