{"action":"created","comment":{"url":"https://api.github.com/repos/caskdata/cdap/pulls/comments/27914820","id":27914820,"diff_hunk":"@@ -380,9 +390,66 @@ public void testQueryMetrics() throws Exception {\n         \"&groupBy=namespace,flowlet&start=\" + start + \"&end=\" + end, groupByResult);\n   }\n \n+\n   @Test\n-  public void testQueryMetricsWithTags() throws Exception {\n+  public void testTimeRangeQueryBatch() throws Exception {\n+    // note: times are in seconds, hence \"divide by 1000\";\n+    long start = (emitTs - 60 * 1000) / 1000;\n+    long end = (emitTs + 60 * 1000) / 1000;\n \n+    verifyRangeQueryResult(\n+      \"/v3/metrics/query?\" + getTags(\"yourspace\", \"WCount1\", \"WCounter\", \"splitter\") +\n+        \"&metric=system.reads&start=\" + start + \"&end=\"\n+        + end, 2, 3);\n+\n+    JsonObject q1 = getSingleQueryJson(ImmutableMap.of(\"namespace\", \"yourspace\", \"app\", \"WCount1\", \"flow\", \"WCounter\",\n+                                                       \"flowlet\", \"splitter\"),\n+                                       ImmutableList.of(\"system.reads\"), ImmutableList.<String>of(),\n+                                       ImmutableMap.of(\"start\", String.valueOf(start), \"end\", String.valueOf(end)));\n+\n+    JsonObject q2 = getSingleQueryJson(ImmutableMap.of(\"namespace\", \"yourspace\", \"app\", \"WCount1\", \"flow\", \"WCounter\"),\n+                                       ImmutableList.of(\"system.reads\"), ImmutableList.<String>of(\"flowlet\"),\n+                                       ImmutableMap.of(\"start\", String.valueOf(start), \"end\", String.valueOf(end)));\n+    JsonArray queries = new JsonArray();\n+    queries.add(q1);\n+    queries.add(q2);\n+    JsonObject taggedQuery = new JsonObject();\n+    taggedQuery.add(\"timeRangeBatch\", queries);\n+    ImmutableMap<String, ImmutableList<ImmutableList<QueryResult>>> expected =\n+      ImmutableMap.of(\"timeRangeBatch\", ImmutableList.<ImmutableList<QueryResult>>of(\n+        ImmutableList.<QueryResult>of(new QueryResult(ImmutableMap.<String, String>of(), \"system.reads\", 2, 3)),\n+        ImmutableList.<QueryResult>of(new QueryResult(ImmutableMap.<String, String>of(\"flowlet\", \"counter\"),\n+                                                      \"system.reads\", 1, 1),\n+                                      new QueryResult(ImmutableMap.<String, String>of(\"flowlet\", \"splitter\"),\n+                                                      \"system.reads\", 2, 3)\n+                                      )));\n+    batchTest(taggedQuery, expected);\n+  }\n+\n+  @Test\n+  public void testMultipleMetricsSingleContext() throws Exception {\n+    verifyAggregateQueryResult(\n+      \"/v3/metrics/query?tag=namespace:myspace&tag=app:WordCount1&tag=flow:WordCounter&tag=flowlet:splitter\" +\n+        \"&metric=system.reads&aggregate=true\", 2L);\n+\n+    verifyAggregateQueryResult(","path":"cdap-gateway/src/test/java/co/cask/cdap/gateway/handlers/metrics/MetricsHandlerTestRun.java","position":81,"original_position":81,"commit_id":"c2a8b23a521fd1a8c2d6dfe59c90154668f46e69","original_commit_id":"c2a8b23a521fd1a8c2d6dfe59c90154668f46e69","user":{"login":"abaranau","id":434133,"avatar_url":"https://avatars.githubusercontent.com/u/434133?v=3","gravatar_id":"","url":"https://api.github.com/users/abaranau","html_url":"https://github.com/abaranau","followers_url":"https://api.github.com/users/abaranau/followers","following_url":"https://api.github.com/users/abaranau/following{/other_user}","gists_url":"https://api.github.com/users/abaranau/gists{/gist_id}","starred_url":"https://api.github.com/users/abaranau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abaranau/subscriptions","organizations_url":"https://api.github.com/users/abaranau/orgs","repos_url":"https://api.github.com/users/abaranau/repos","events_url":"https://api.github.com/users/abaranau/events{/privacy}","received_events_url":"https://api.github.com/users/abaranau/received_events","type":"User","site_admin":false},"body":"how is this different from the other one?","created_at":"2015-04-07T20:08:32Z","updated_at":"2015-04-07T20:08:32Z","html_url":"https://github.com/caskdata/cdap/pull/1925#discussion_r27914820","pull_request_url":"https://api.github.com/repos/caskdata/cdap/pulls/1925","_links":{"self":{"href":"https://api.github.com/repos/caskdata/cdap/pulls/comments/27914820"},"html":{"href":"https://github.com/caskdata/cdap/pull/1925#discussion_r27914820"},"pull_request":{"href":"https://api.github.com/repos/caskdata/cdap/pulls/1925"}}},"pull_request":{"url":"https://api.github.com/repos/caskdata/cdap/pulls/1925","id":32746652,"html_url":"https://github.com/caskdata/cdap/pull/1925","diff_url":"https://github.com/caskdata/cdap/pull/1925.diff","patch_url":"https://github.com/caskdata/cdap/pull/1925.patch","issue_url":"https://api.github.com/repos/caskdata/cdap/issues/1925","number":1925,"state":"open","locked":false,"title":"Feature/metrics batching implementation","user":{"login":"gsps1","id":1328150,"avatar_url":"https://avatars.githubusercontent.com/u/1328150?v=3","gravatar_id":"","url":"https://api.github.com/users/gsps1","html_url":"https://github.com/gsps1","followers_url":"https://api.github.com/users/gsps1/followers","following_url":"https://api.github.com/users/gsps1/following{/other_user}","gists_url":"https://api.github.com/users/gsps1/gists{/gist_id}","starred_url":"https://api.github.com/users/gsps1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gsps1/subscriptions","organizations_url":"https://api.github.com/users/gsps1/orgs","repos_url":"https://api.github.com/users/gsps1/repos","events_url":"https://api.github.com/users/gsps1/events{/privacy}","received_events_url":"https://api.github.com/users/gsps1/received_events","type":"User","site_admin":false},"body":"https://issues.cask.co/browse/CDAP-1956\r\nhttps://issues.cask.co/browse/CDAP-1957\r\n\r\n","created_at":"2015-04-07T09:24:39Z","updated_at":"2015-04-07T20:08:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"758e32cd5ea690d108cb2029d90ab55bc696fcc8","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/caskdata/cdap/pulls/1925/commits","review_comments_url":"https://api.github.com/repos/caskdata/cdap/pulls/1925/comments","review_comment_url":"https://api.github.com/repos/caskdata/cdap/pulls/comments{/number}","comments_url":"https://api.github.com/repos/caskdata/cdap/issues/1925/comments","statuses_url":"https://api.github.com/repos/caskdata/cdap/statuses/c2a8b23a521fd1a8c2d6dfe59c90154668f46e69","head":{"label":"caskdata:feature/metrics-batching-implementation","ref":"feature/metrics-batching-implementation","sha":"c2a8b23a521fd1a8c2d6dfe59c90154668f46e69","user":{"login":"caskdata","id":8123023,"avatar_url":"https://avatars.githubusercontent.com/u/8123023?v=3","gravatar_id":"","url":"https://api.github.com/users/caskdata","html_url":"https://github.com/caskdata","followers_url":"https://api.github.com/users/caskdata/followers","following_url":"https://api.github.com/users/caskdata/following{/other_user}","gists_url":"https://api.github.com/users/caskdata/gists{/gist_id}","starred_url":"https://api.github.com/users/caskdata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caskdata/subscriptions","organizations_url":"https://api.github.com/users/caskdata/orgs","repos_url":"https://api.github.com/users/caskdata/repos","events_url":"https://api.github.com/users/caskdata/events{/privacy}","received_events_url":"https://api.github.com/users/caskdata/received_events","type":"Organization","site_admin":false},"repo":{"id":22542759,"name":"cdap","full_name":"caskdata/cdap","owner":{"login":"caskdata","id":8123023,"avatar_url":"https://avatars.githubusercontent.com/u/8123023?v=3","gravatar_id":"","url":"https://api.github.com/users/caskdata","html_url":"https://github.com/caskdata","followers_url":"https://api.github.com/users/caskdata/followers","following_url":"https://api.github.com/users/caskdata/following{/other_user}","gists_url":"https://api.github.com/users/caskdata/gists{/gist_id}","starred_url":"https://api.github.com/users/caskdata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caskdata/subscriptions","organizations_url":"https://api.github.com/users/caskdata/orgs","repos_url":"https://api.github.com/users/caskdata/repos","events_url":"https://api.github.com/users/caskdata/events{/privacy}","received_events_url":"https://api.github.com/users/caskdata/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/caskdata/cdap","description":"Cask Data Application Platform (CDAP)","fork":false,"url":"https://api.github.com/repos/caskdata/cdap","forks_url":"https://api.github.com/repos/caskdata/cdap/forks","keys_url":"https://api.github.com/repos/caskdata/cdap/keys{/key_id}","collaborators_url":"https://api.github.com/repos/caskdata/cdap/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/caskdata/cdap/teams","hooks_url":"https://api.github.com/repos/caskdata/cdap/hooks","issue_events_url":"https://api.github.com/repos/caskdata/cdap/issues/events{/number}","events_url":"https://api.github.com/repos/caskdata/cdap/events","assignees_url":"https://api.github.com/repos/caskdata/cdap/assignees{/user}","branches_url":"https://api.github.com/repos/caskdata/cdap/branches{/branch}","tags_url":"https://api.github.com/repos/caskdata/cdap/tags","blobs_url":"https://api.github.com/repos/caskdata/cdap/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/caskdata/cdap/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/caskdata/cdap/git/refs{/sha}","trees_url":"https://api.github.com/repos/caskdata/cdap/git/trees{/sha}","statuses_url":"https://api.github.com/repos/caskdata/cdap/statuses/{sha}","languages_url":"https://api.github.com/repos/caskdata/cdap/languages","stargazers_url":"https://api.github.com/repos/caskdata/cdap/stargazers","contributors_url":"https://api.github.com/repos/caskdata/cdap/contributors","subscribers_url":"https://api.github.com/repos/caskdata/cdap/subscribers","subscription_url":"https://api.github.com/repos/caskdata/cdap/subscription","commits_url":"https://api.github.com/repos/caskdata/cdap/commits{/sha}","git_commits_url":"https://api.github.com/repos/caskdata/cdap/git/commits{/sha}","comments_url":"https://api.github.com/repos/caskdata/cdap/comments{/number}","issue_comment_url":"https://api.github.com/repos/caskdata/cdap/issues/comments{/number}","contents_url":"https://api.github.com/repos/caskdata/cdap/contents/{+path}","compare_url":"https://api.github.com/repos/caskdata/cdap/compare/{base}...{head}","merges_url":"https://api.github.com/repos/caskdata/cdap/merges","archive_url":"https://api.github.com/repos/caskdata/cdap/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/caskdata/cdap/downloads","issues_url":"https://api.github.com/repos/caskdata/cdap/issues{/number}","pulls_url":"https://api.github.com/repos/caskdata/cdap/pulls{/number}","milestones_url":"https://api.github.com/repos/caskdata/cdap/milestones{/number}","notifications_url":"https://api.github.com/repos/caskdata/cdap/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/caskdata/cdap/labels{/name}","releases_url":"https://api.github.com/repos/caskdata/cdap/releases{/id}","created_at":"2014-08-02T09:00:10Z","updated_at":"2015-04-07T19:52:54Z","pushed_at":"2015-04-07T19:54:56Z","git_url":"git://github.com/caskdata/cdap.git","ssh_url":"git@github.com:caskdata/cdap.git","clone_url":"https://github.com/caskdata/cdap.git","svn_url":"https://github.com/caskdata/cdap","homepage":"http://cdap.io","size":834851,"stargazers_count":39,"watchers_count":39,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":10,"mirror_url":null,"open_issues_count":21,"forks":10,"open_issues":21,"watchers":39,"default_branch":"develop"}},"base":{"label":"caskdata:develop","ref":"develop","sha":"c87f4533fd6a34f455cbf6d5cee96a6b05e86112","user":{"login":"caskdata","id":8123023,"avatar_url":"https://avatars.githubusercontent.com/u/8123023?v=3","gravatar_id":"","url":"https://api.github.com/users/caskdata","html_url":"https://github.com/caskdata","followers_url":"https://api.github.com/users/caskdata/followers","following_url":"https://api.github.com/users/caskdata/following{/other_user}","gists_url":"https://api.github.com/users/caskdata/gists{/gist_id}","starred_url":"https://api.github.com/users/caskdata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caskdata/subscriptions","organizations_url":"https://api.github.com/users/caskdata/orgs","repos_url":"https://api.github.com/users/caskdata/repos","events_url":"https://api.github.com/users/caskdata/events{/privacy}","received_events_url":"https://api.github.com/users/caskdata/received_events","type":"Organization","site_admin":false},"repo":{"id":22542759,"name":"cdap","full_name":"caskdata/cdap","owner":{"login":"caskdata","id":8123023,"avatar_url":"https://avatars.githubusercontent.com/u/8123023?v=3","gravatar_id":"","url":"https://api.github.com/users/caskdata","html_url":"https://github.com/caskdata","followers_url":"https://api.github.com/users/caskdata/followers","following_url":"https://api.github.com/users/caskdata/following{/other_user}","gists_url":"https://api.github.com/users/caskdata/gists{/gist_id}","starred_url":"https://api.github.com/users/caskdata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caskdata/subscriptions","organizations_url":"https://api.github.com/users/caskdata/orgs","repos_url":"https://api.github.com/users/caskdata/repos","events_url":"https://api.github.com/users/caskdata/events{/privacy}","received_events_url":"https://api.github.com/users/caskdata/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/caskdata/cdap","description":"Cask Data Application Platform (CDAP)","fork":false,"url":"https://api.github.com/repos/caskdata/cdap","forks_url":"https://api.github.com/repos/caskdata/cdap/forks","keys_url":"https://api.github.com/repos/caskdata/cdap/keys{/key_id}","collaborators_url":"https://api.github.com/repos/caskdata/cdap/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/caskdata/cdap/teams","hooks_url":"https://api.github.com/repos/caskdata/cdap/hooks","issue_events_url":"https://api.github.com/repos/caskdata/cdap/issues/events{/number}","events_url":"https://api.github.com/repos/caskdata/cdap/events","assignees_url":"https://api.github.com/repos/caskdata/cdap/assignees{/user}","branches_url":"https://api.github.com/repos/caskdata/cdap/branches{/branch}","tags_url":"https://api.github.com/repos/caskdata/cdap/tags","blobs_url":"https://api.github.com/repos/caskdata/cdap/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/caskdata/cdap/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/caskdata/cdap/git/refs{/sha}","trees_url":"https://api.github.com/repos/caskdata/cdap/git/trees{/sha}","statuses_url":"https://api.github.com/repos/caskdata/cdap/statuses/{sha}","languages_url":"https://api.github.com/repos/caskdata/cdap/languages","stargazers_url":"https://api.github.com/repos/caskdata/cdap/stargazers","contributors_url":"https://api.github.com/repos/caskdata/cdap/contributors","subscribers_url":"https://api.github.com/repos/caskdata/cdap/subscribers","subscription_url":"https://api.github.com/repos/caskdata/cdap/subscription","commits_url":"https://api.github.com/repos/caskdata/cdap/commits{/sha}","git_commits_url":"https://api.github.com/repos/caskdata/cdap/git/commits{/sha}","comments_url":"https://api.github.com/repos/caskdata/cdap/comments{/number}","issue_comment_url":"https://api.github.com/repos/caskdata/cdap/issues/comments{/number}","contents_url":"https://api.github.com/repos/caskdata/cdap/contents/{+path}","compare_url":"https://api.github.com/repos/caskdata/cdap/compare/{base}...{head}","merges_url":"https://api.github.com/repos/caskdata/cdap/merges","archive_url":"https://api.github.com/repos/caskdata/cdap/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/caskdata/cdap/downloads","issues_url":"https://api.github.com/repos/caskdata/cdap/issues{/number}","pulls_url":"https://api.github.com/repos/caskdata/cdap/pulls{/number}","milestones_url":"https://api.github.com/repos/caskdata/cdap/milestones{/number}","notifications_url":"https://api.github.com/repos/caskdata/cdap/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/caskdata/cdap/labels{/name}","releases_url":"https://api.github.com/repos/caskdata/cdap/releases{/id}","created_at":"2014-08-02T09:00:10Z","updated_at":"2015-04-07T19:52:54Z","pushed_at":"2015-04-07T19:54:56Z","git_url":"git://github.com/caskdata/cdap.git","ssh_url":"git@github.com:caskdata/cdap.git","clone_url":"https://github.com/caskdata/cdap.git","svn_url":"https://github.com/caskdata/cdap","homepage":"http://cdap.io","size":834851,"stargazers_count":39,"watchers_count":39,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":10,"mirror_url":null,"open_issues_count":21,"forks":10,"open_issues":21,"watchers":39,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/caskdata/cdap/pulls/1925"},"html":{"href":"https://github.com/caskdata/cdap/pull/1925"},"issue":{"href":"https://api.github.com/repos/caskdata/cdap/issues/1925"},"comments":{"href":"https://api.github.com/repos/caskdata/cdap/issues/1925/comments"},"review_comments":{"href":"https://api.github.com/repos/caskdata/cdap/pulls/1925/comments"},"review_comment":{"href":"https://api.github.com/repos/caskdata/cdap/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/caskdata/cdap/pulls/1925/commits"},"statuses":{"href":"https://api.github.com/repos/caskdata/cdap/statuses/c2a8b23a521fd1a8c2d6dfe59c90154668f46e69"}}}}