{"action":"created","comment":{"url":"https://api.github.com/repos/jembi/openhim-core-js/pulls/comments/22926097","id":22926097,"diff_hunk":"@@ -0,0 +1,173 @@\n+http = require 'http'\n+config = require '../config/config'\n+application = config.get 'application'\n+os = require \"os\"\n+domain = os.hostname() + '.' + application.name\n+statsd_server = config.get 'statsd'\n+Q = require \"q\"\n+request = require 'koa-request'\n+_ = require \"lodash\"\n+moment = require \"moment\"\n+metrics = require \"../metrics\"\n+\n+# Overall Metrics\n+\n+exports.retrieveTransactionCountPerHour = `function *() {\n+\n+  var path = \"/render?target=transformNull(summarize(stats.counters.\" + domain + \".Channels.count,'1hour'))&from=-1days&format=json\";\n+  var data = [];\n+  var raw = yield exports.fetchData(path);\n+\n+  _.forEach(raw.data, function (item) {\n+    data.push({\n+      load: item[0],\n+      timestamp: moment.unix(item[1])\n+    });\n+  });\n+  this.body = data\n+}`\n+\n+# Retrives Global Status Metrics from the StatsD API\n+\n+exports.fetcGlobalStatusMetrics = `function *(allowedIds) {\n+  var filtersObject = this.request.query;\n+  var userRequesting = this.authenticated,\n+      path = '',\n+      results = {},\n+      final = {};\n+  var allowedIds = allowedIds.length > 0 ? allowedIds : yield metrics.getAllowedChannelIDs(userRequesting)","path":"src/model/statsd.coffee","position":38,"original_position":38,"commit_id":"5d33b46adb2ef6d5f814b8ac825afa52915016ea","original_commit_id":"5d33b46adb2ef6d5f814b8ac825afa52915016ea","user":{"login":"rcrichton","id":266576,"avatar_url":"https://avatars.githubusercontent.com/u/266576?v=3","gravatar_id":"","url":"https://api.github.com/users/rcrichton","html_url":"https://github.com/rcrichton","followers_url":"https://api.github.com/users/rcrichton/followers","following_url":"https://api.github.com/users/rcrichton/following{/other_user}","gists_url":"https://api.github.com/users/rcrichton/gists{/gist_id}","starred_url":"https://api.github.com/users/rcrichton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rcrichton/subscriptions","organizations_url":"https://api.github.com/users/rcrichton/orgs","repos_url":"https://api.github.com/users/rcrichton/repos","events_url":"https://api.github.com/users/rcrichton/events{/privacy}","received_events_url":"https://api.github.com/users/rcrichton/received_events","type":"User","site_admin":false},"body":"Do you need the `var` here as this variable is passed in?","created_at":"2015-01-14T09:47:02Z","updated_at":"2015-01-14T09:47:02Z","html_url":"https://github.com/jembi/openhim-core-js/pull/323#discussion_r22926097","pull_request_url":"https://api.github.com/repos/jembi/openhim-core-js/pulls/323","_links":{"self":{"href":"https://api.github.com/repos/jembi/openhim-core-js/pulls/comments/22926097"},"html":{"href":"https://github.com/jembi/openhim-core-js/pull/323#discussion_r22926097"},"pull_request":{"href":"https://api.github.com/repos/jembi/openhim-core-js/pulls/323"}}},"pull_request":{"url":"https://api.github.com/repos/jembi/openhim-core-js/pulls/323","id":27196217,"html_url":"https://github.com/jembi/openhim-core-js/pull/323","diff_url":"https://github.com/jembi/openhim-core-js/pull/323.diff","patch_url":"https://github.com/jembi/openhim-core-js/pull/323.patch","issue_url":"https://api.github.com/repos/jembi/openhim-core-js/issues/323","number":323,"state":"open","locked":false,"title":"Statsd model","user":{"login":"debonair","id":618654,"avatar_url":"https://avatars.githubusercontent.com/u/618654?v=3","gravatar_id":"","url":"https://api.github.com/users/debonair","html_url":"https://github.com/debonair","followers_url":"https://api.github.com/users/debonair/followers","following_url":"https://api.github.com/users/debonair/following{/other_user}","gists_url":"https://api.github.com/users/debonair/gists{/gist_id}","starred_url":"https://api.github.com/users/debonair/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/debonair/subscriptions","organizations_url":"https://api.github.com/users/debonair/orgs","repos_url":"https://api.github.com/users/debonair/repos","events_url":"https://api.github.com/users/debonair/events{/privacy}","received_events_url":"https://api.github.com/users/debonair/received_events","type":"User","site_admin":false},"body":"@rcrichton please review","created_at":"2015-01-12T14:12:01Z","updated_at":"2015-01-14T09:47:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"67a7dcd3e7e75389f6f2fc9fb58addc9de66f6d8","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/jembi/openhim-core-js/pulls/323/commits","review_comments_url":"https://api.github.com/repos/jembi/openhim-core-js/pulls/323/comments","review_comment_url":"https://api.github.com/repos/jembi/openhim-core-js/pulls/comments/{number}","comments_url":"https://api.github.com/repos/jembi/openhim-core-js/issues/323/comments","statuses_url":"https://api.github.com/repos/jembi/openhim-core-js/statuses/5d33b46adb2ef6d5f814b8ac825afa52915016ea","head":{"label":"jembi:statsd-model","ref":"statsd-model","sha":"5d33b46adb2ef6d5f814b8ac825afa52915016ea","user":{"login":"jembi","id":1931511,"avatar_url":"https://avatars.githubusercontent.com/u/1931511?v=3","gravatar_id":"","url":"https://api.github.com/users/jembi","html_url":"https://github.com/jembi","followers_url":"https://api.github.com/users/jembi/followers","following_url":"https://api.github.com/users/jembi/following{/other_user}","gists_url":"https://api.github.com/users/jembi/gists{/gist_id}","starred_url":"https://api.github.com/users/jembi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jembi/subscriptions","organizations_url":"https://api.github.com/users/jembi/orgs","repos_url":"https://api.github.com/users/jembi/repos","events_url":"https://api.github.com/users/jembi/events{/privacy}","received_events_url":"https://api.github.com/users/jembi/received_events","type":"Organization","site_admin":false},"repo":{"id":16686826,"name":"openhim-core-js","full_name":"jembi/openhim-core-js","owner":{"login":"jembi","id":1931511,"avatar_url":"https://avatars.githubusercontent.com/u/1931511?v=3","gravatar_id":"","url":"https://api.github.com/users/jembi","html_url":"https://github.com/jembi","followers_url":"https://api.github.com/users/jembi/followers","following_url":"https://api.github.com/users/jembi/following{/other_user}","gists_url":"https://api.github.com/users/jembi/gists{/gist_id}","starred_url":"https://api.github.com/users/jembi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jembi/subscriptions","organizations_url":"https://api.github.com/users/jembi/orgs","repos_url":"https://api.github.com/users/jembi/repos","events_url":"https://api.github.com/users/jembi/events{/privacy}","received_events_url":"https://api.github.com/users/jembi/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/jembi/openhim-core-js","description":"The open health information mediator core component","fork":false,"url":"https://api.github.com/repos/jembi/openhim-core-js","forks_url":"https://api.github.com/repos/jembi/openhim-core-js/forks","keys_url":"https://api.github.com/repos/jembi/openhim-core-js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jembi/openhim-core-js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jembi/openhim-core-js/teams","hooks_url":"https://api.github.com/repos/jembi/openhim-core-js/hooks","issue_events_url":"https://api.github.com/repos/jembi/openhim-core-js/issues/events{/number}","events_url":"https://api.github.com/repos/jembi/openhim-core-js/events","assignees_url":"https://api.github.com/repos/jembi/openhim-core-js/assignees{/user}","branches_url":"https://api.github.com/repos/jembi/openhim-core-js/branches{/branch}","tags_url":"https://api.github.com/repos/jembi/openhim-core-js/tags","blobs_url":"https://api.github.com/repos/jembi/openhim-core-js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jembi/openhim-core-js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jembi/openhim-core-js/git/refs{/sha}","trees_url":"https://api.github.com/repos/jembi/openhim-core-js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jembi/openhim-core-js/statuses/{sha}","languages_url":"https://api.github.com/repos/jembi/openhim-core-js/languages","stargazers_url":"https://api.github.com/repos/jembi/openhim-core-js/stargazers","contributors_url":"https://api.github.com/repos/jembi/openhim-core-js/contributors","subscribers_url":"https://api.github.com/repos/jembi/openhim-core-js/subscribers","subscription_url":"https://api.github.com/repos/jembi/openhim-core-js/subscription","commits_url":"https://api.github.com/repos/jembi/openhim-core-js/commits{/sha}","git_commits_url":"https://api.github.com/repos/jembi/openhim-core-js/git/commits{/sha}","comments_url":"https://api.github.com/repos/jembi/openhim-core-js/comments{/number}","issue_comment_url":"https://api.github.com/repos/jembi/openhim-core-js/issues/comments/{number}","contents_url":"https://api.github.com/repos/jembi/openhim-core-js/contents/{+path}","compare_url":"https://api.github.com/repos/jembi/openhim-core-js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jembi/openhim-core-js/merges","archive_url":"https://api.github.com/repos/jembi/openhim-core-js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jembi/openhim-core-js/downloads","issues_url":"https://api.github.com/repos/jembi/openhim-core-js/issues{/number}","pulls_url":"https://api.github.com/repos/jembi/openhim-core-js/pulls{/number}","milestones_url":"https://api.github.com/repos/jembi/openhim-core-js/milestones{/number}","notifications_url":"https://api.github.com/repos/jembi/openhim-core-js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jembi/openhim-core-js/labels{/name}","releases_url":"https://api.github.com/repos/jembi/openhim-core-js/releases{/id}","created_at":"2014-02-10T06:41:52Z","updated_at":"2015-01-12T14:09:53Z","pushed_at":"2015-01-13T13:59:36Z","git_url":"git://github.com/jembi/openhim-core-js.git","ssh_url":"git@github.com:jembi/openhim-core-js.git","clone_url":"https://github.com/jembi/openhim-core-js.git","svn_url":"https://github.com/jembi/openhim-core-js","homepage":"","size":3176,"stargazers_count":1,"watchers_count":1,"language":"CoffeeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":28,"forks":3,"open_issues":28,"watchers":1,"default_branch":"master"}},"base":{"label":"jembi:master","ref":"master","sha":"787b2c9a571830eab9ed953f4cf075b877342494","user":{"login":"jembi","id":1931511,"avatar_url":"https://avatars.githubusercontent.com/u/1931511?v=3","gravatar_id":"","url":"https://api.github.com/users/jembi","html_url":"https://github.com/jembi","followers_url":"https://api.github.com/users/jembi/followers","following_url":"https://api.github.com/users/jembi/following{/other_user}","gists_url":"https://api.github.com/users/jembi/gists{/gist_id}","starred_url":"https://api.github.com/users/jembi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jembi/subscriptions","organizations_url":"https://api.github.com/users/jembi/orgs","repos_url":"https://api.github.com/users/jembi/repos","events_url":"https://api.github.com/users/jembi/events{/privacy}","received_events_url":"https://api.github.com/users/jembi/received_events","type":"Organization","site_admin":false},"repo":{"id":16686826,"name":"openhim-core-js","full_name":"jembi/openhim-core-js","owner":{"login":"jembi","id":1931511,"avatar_url":"https://avatars.githubusercontent.com/u/1931511?v=3","gravatar_id":"","url":"https://api.github.com/users/jembi","html_url":"https://github.com/jembi","followers_url":"https://api.github.com/users/jembi/followers","following_url":"https://api.github.com/users/jembi/following{/other_user}","gists_url":"https://api.github.com/users/jembi/gists{/gist_id}","starred_url":"https://api.github.com/users/jembi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jembi/subscriptions","organizations_url":"https://api.github.com/users/jembi/orgs","repos_url":"https://api.github.com/users/jembi/repos","events_url":"https://api.github.com/users/jembi/events{/privacy}","received_events_url":"https://api.github.com/users/jembi/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/jembi/openhim-core-js","description":"The open health information mediator core component","fork":false,"url":"https://api.github.com/repos/jembi/openhim-core-js","forks_url":"https://api.github.com/repos/jembi/openhim-core-js/forks","keys_url":"https://api.github.com/repos/jembi/openhim-core-js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jembi/openhim-core-js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jembi/openhim-core-js/teams","hooks_url":"https://api.github.com/repos/jembi/openhim-core-js/hooks","issue_events_url":"https://api.github.com/repos/jembi/openhim-core-js/issues/events{/number}","events_url":"https://api.github.com/repos/jembi/openhim-core-js/events","assignees_url":"https://api.github.com/repos/jembi/openhim-core-js/assignees{/user}","branches_url":"https://api.github.com/repos/jembi/openhim-core-js/branches{/branch}","tags_url":"https://api.github.com/repos/jembi/openhim-core-js/tags","blobs_url":"https://api.github.com/repos/jembi/openhim-core-js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jembi/openhim-core-js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jembi/openhim-core-js/git/refs{/sha}","trees_url":"https://api.github.com/repos/jembi/openhim-core-js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jembi/openhim-core-js/statuses/{sha}","languages_url":"https://api.github.com/repos/jembi/openhim-core-js/languages","stargazers_url":"https://api.github.com/repos/jembi/openhim-core-js/stargazers","contributors_url":"https://api.github.com/repos/jembi/openhim-core-js/contributors","subscribers_url":"https://api.github.com/repos/jembi/openhim-core-js/subscribers","subscription_url":"https://api.github.com/repos/jembi/openhim-core-js/subscription","commits_url":"https://api.github.com/repos/jembi/openhim-core-js/commits{/sha}","git_commits_url":"https://api.github.com/repos/jembi/openhim-core-js/git/commits{/sha}","comments_url":"https://api.github.com/repos/jembi/openhim-core-js/comments{/number}","issue_comment_url":"https://api.github.com/repos/jembi/openhim-core-js/issues/comments/{number}","contents_url":"https://api.github.com/repos/jembi/openhim-core-js/contents/{+path}","compare_url":"https://api.github.com/repos/jembi/openhim-core-js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jembi/openhim-core-js/merges","archive_url":"https://api.github.com/repos/jembi/openhim-core-js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jembi/openhim-core-js/downloads","issues_url":"https://api.github.com/repos/jembi/openhim-core-js/issues{/number}","pulls_url":"https://api.github.com/repos/jembi/openhim-core-js/pulls{/number}","milestones_url":"https://api.github.com/repos/jembi/openhim-core-js/milestones{/number}","notifications_url":"https://api.github.com/repos/jembi/openhim-core-js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jembi/openhim-core-js/labels{/name}","releases_url":"https://api.github.com/repos/jembi/openhim-core-js/releases{/id}","created_at":"2014-02-10T06:41:52Z","updated_at":"2015-01-12T14:09:53Z","pushed_at":"2015-01-13T13:59:36Z","git_url":"git://github.com/jembi/openhim-core-js.git","ssh_url":"git@github.com:jembi/openhim-core-js.git","clone_url":"https://github.com/jembi/openhim-core-js.git","svn_url":"https://github.com/jembi/openhim-core-js","homepage":"","size":3176,"stargazers_count":1,"watchers_count":1,"language":"CoffeeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":28,"forks":3,"open_issues":28,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jembi/openhim-core-js/pulls/323"},"html":{"href":"https://github.com/jembi/openhim-core-js/pull/323"},"issue":{"href":"https://api.github.com/repos/jembi/openhim-core-js/issues/323"},"comments":{"href":"https://api.github.com/repos/jembi/openhim-core-js/issues/323/comments"},"review_comments":{"href":"https://api.github.com/repos/jembi/openhim-core-js/pulls/323/comments"},"review_comment":{"href":"https://api.github.com/repos/jembi/openhim-core-js/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/jembi/openhim-core-js/pulls/323/commits"},"statuses":{"href":"https://api.github.com/repos/jembi/openhim-core-js/statuses/5d33b46adb2ef6d5f814b8ac825afa52915016ea"}}}}