{"action":"created","comment":{"url":"https://api.github.com/repos/rackerlabs/blueflood/pulls/comments/58924109","id":58924109,"diff_hunk":"@@ -0,0 +1,162 @@\n+package com.rackspacecloud.blueflood.io.datastax;\n+\n+import com.codahale.metrics.Timer;\n+import com.datastax.driver.core.*;\n+import com.datastax.driver.core.querybuilder.Insert;\n+import com.datastax.driver.core.querybuilder.Select;\n+import com.google.common.collect.HashBasedTable;\n+import com.google.common.collect.Table;\n+import com.rackspacecloud.blueflood.io.CassandraModel;\n+import com.rackspacecloud.blueflood.io.Instrumentation;\n+import com.rackspacecloud.blueflood.io.MetadataIO;\n+import com.rackspacecloud.blueflood.io.serializers.metrics.StringMetadataSerDes;\n+import com.rackspacecloud.blueflood.types.Locator;\n+import org.slf4j.Logger;\n+import org.slf4j.LoggerFactory;\n+\n+import java.io.IOException;\n+import java.util.*;\n+\n+import static com.datastax.driver.core.querybuilder.QueryBuilder.*;\n+\n+/**\n+ * Read/write to metrics_metadata using Datastax driver.\n+ */\n+public class DatastaxMetadataIO implements MetadataIO {\n+\n+    public static final String KEY = \"key\";\n+    public static final String COLUMN1 = \"column1\";\n+    public static final String VALUE = \"value\";\n+\n+    private static final Logger LOG = LoggerFactory.getLogger( DatastaxMetadataIO.class );\n+\n+    private final StringMetadataSerDes serDes = new StringMetadataSerDes();\n+\n+    @Override\n+    public Map<String, String> getAllValues( Locator locator ) throws IOException {\n+\n+        Timer.Context ctx = Instrumentation.getReadTimerContext( CassandraModel.CF_METRICS_METADATA_NAME );\n+\n+        Session session = DatastaxIO.getSession();\n+\n+        try {\n+\n+            Select.Where select = select()\n+                    .all()\n+                    .from( CassandraModel.CF_METRICS_METADATA_NAME )\n+                    .where( eq( KEY, locator.toString() ));\n+\n+            List<Row> results = session.execute( select ).all();\n+\n+            Map<String, String> values = new HashMap<String, String>();\n+\n+            for ( Row row : results ) {\n+                if ( LOG.isDebugEnabled() ) {","path":"blueflood-core/src/main/java/com/rackspacecloud/blueflood/io/datastax/DatastaxMetadataIO.java","position":54,"original_position":54,"commit_id":"c96c026e0d106a07a4d50d6c75ea80ca1097cbff","original_commit_id":"c96c026e0d106a07a4d50d6c75ea80ca1097cbff","user":{"login":"ChandraAddala","id":1525859,"avatar_url":"https://avatars.githubusercontent.com/u/1525859?v=3","gravatar_id":"","url":"https://api.github.com/users/ChandraAddala","html_url":"https://github.com/ChandraAddala","followers_url":"https://api.github.com/users/ChandraAddala/followers","following_url":"https://api.github.com/users/ChandraAddala/following{/other_user}","gists_url":"https://api.github.com/users/ChandraAddala/gists{/gist_id}","starred_url":"https://api.github.com/users/ChandraAddala/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ChandraAddala/subscriptions","organizations_url":"https://api.github.com/users/ChandraAddala/orgs","repos_url":"https://api.github.com/users/ChandraAddala/repos","events_url":"https://api.github.com/users/ChandraAddala/events{/privacy}","received_events_url":"https://api.github.com/users/ChandraAddala/received_events","type":"User","site_admin":false},"body":"I dont see much value in those log statements but I would be okay with 'trace' level logging.","created_at":"2016-04-07T18:45:55Z","updated_at":"2016-04-07T18:45:55Z","html_url":"https://github.com/rackerlabs/blueflood/pull/660#discussion_r58924109","pull_request_url":"https://api.github.com/repos/rackerlabs/blueflood/pulls/660","_links":{"self":{"href":"https://api.github.com/repos/rackerlabs/blueflood/pulls/comments/58924109"},"html":{"href":"https://github.com/rackerlabs/blueflood/pull/660#discussion_r58924109"},"pull_request":{"href":"https://api.github.com/repos/rackerlabs/blueflood/pulls/660"}}},"pull_request":{"url":"https://api.github.com/repos/rackerlabs/blueflood/pulls/660","id":65529526,"html_url":"https://github.com/rackerlabs/blueflood/pull/660","diff_url":"https://github.com/rackerlabs/blueflood/pull/660.diff","patch_url":"https://github.com/rackerlabs/blueflood/pull/660.patch","issue_url":"https://api.github.com/repos/rackerlabs/blueflood/issues/660","number":660,"state":"open","locked":false,"title":"Adding Datastax support for Metadata and TestIO","user":{"login":"usnavi","id":1426961,"avatar_url":"https://avatars.githubusercontent.com/u/1426961?v=3","gravatar_id":"","url":"https://api.github.com/users/usnavi","html_url":"https://github.com/usnavi","followers_url":"https://api.github.com/users/usnavi/followers","following_url":"https://api.github.com/users/usnavi/following{/other_user}","gists_url":"https://api.github.com/users/usnavi/gists{/gist_id}","starred_url":"https://api.github.com/users/usnavi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/usnavi/subscriptions","organizations_url":"https://api.github.com/users/usnavi/orgs","repos_url":"https://api.github.com/users/usnavi/repos","events_url":"https://api.github.com/users/usnavi/events{/privacy}","received_events_url":"https://api.github.com/users/usnavi/received_events","type":"User","site_admin":false},"body":"- Adding Datastax support for MetadataIO\r\n- Creating TestIO for Astyanax & Datastax as required by tests","created_at":"2016-04-06T20:20:33Z","updated_at":"2016-04-07T18:45:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"23653d899b5e1e501722cdcecd79515a0b971731","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/rackerlabs/blueflood/pulls/660/commits","review_comments_url":"https://api.github.com/repos/rackerlabs/blueflood/pulls/660/comments","review_comment_url":"https://api.github.com/repos/rackerlabs/blueflood/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rackerlabs/blueflood/issues/660/comments","statuses_url":"https://api.github.com/repos/rackerlabs/blueflood/statuses/c96c026e0d106a07a4d50d6c75ea80ca1097cbff","head":{"label":"usnavi:metadata_datastax2","ref":"metadata_datastax2","sha":"c96c026e0d106a07a4d50d6c75ea80ca1097cbff","user":{"login":"usnavi","id":1426961,"avatar_url":"https://avatars.githubusercontent.com/u/1426961?v=3","gravatar_id":"","url":"https://api.github.com/users/usnavi","html_url":"https://github.com/usnavi","followers_url":"https://api.github.com/users/usnavi/followers","following_url":"https://api.github.com/users/usnavi/following{/other_user}","gists_url":"https://api.github.com/users/usnavi/gists{/gist_id}","starred_url":"https://api.github.com/users/usnavi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/usnavi/subscriptions","organizations_url":"https://api.github.com/users/usnavi/orgs","repos_url":"https://api.github.com/users/usnavi/repos","events_url":"https://api.github.com/users/usnavi/events{/privacy}","received_events_url":"https://api.github.com/users/usnavi/received_events","type":"User","site_admin":false},"repo":{"id":45408967,"name":"blueflood","full_name":"usnavi/blueflood","owner":{"login":"usnavi","id":1426961,"avatar_url":"https://avatars.githubusercontent.com/u/1426961?v=3","gravatar_id":"","url":"https://api.github.com/users/usnavi","html_url":"https://github.com/usnavi","followers_url":"https://api.github.com/users/usnavi/followers","following_url":"https://api.github.com/users/usnavi/following{/other_user}","gists_url":"https://api.github.com/users/usnavi/gists{/gist_id}","starred_url":"https://api.github.com/users/usnavi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/usnavi/subscriptions","organizations_url":"https://api.github.com/users/usnavi/orgs","repos_url":"https://api.github.com/users/usnavi/repos","events_url":"https://api.github.com/users/usnavi/events{/privacy}","received_events_url":"https://api.github.com/users/usnavi/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/usnavi/blueflood","description":"A distributed system designed to ingest and process time series data","fork":true,"url":"https://api.github.com/repos/usnavi/blueflood","forks_url":"https://api.github.com/repos/usnavi/blueflood/forks","keys_url":"https://api.github.com/repos/usnavi/blueflood/keys{/key_id}","collaborators_url":"https://api.github.com/repos/usnavi/blueflood/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/usnavi/blueflood/teams","hooks_url":"https://api.github.com/repos/usnavi/blueflood/hooks","issue_events_url":"https://api.github.com/repos/usnavi/blueflood/issues/events{/number}","events_url":"https://api.github.com/repos/usnavi/blueflood/events","assignees_url":"https://api.github.com/repos/usnavi/blueflood/assignees{/user}","branches_url":"https://api.github.com/repos/usnavi/blueflood/branches{/branch}","tags_url":"https://api.github.com/repos/usnavi/blueflood/tags","blobs_url":"https://api.github.com/repos/usnavi/blueflood/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/usnavi/blueflood/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/usnavi/blueflood/git/refs{/sha}","trees_url":"https://api.github.com/repos/usnavi/blueflood/git/trees{/sha}","statuses_url":"https://api.github.com/repos/usnavi/blueflood/statuses/{sha}","languages_url":"https://api.github.com/repos/usnavi/blueflood/languages","stargazers_url":"https://api.github.com/repos/usnavi/blueflood/stargazers","contributors_url":"https://api.github.com/repos/usnavi/blueflood/contributors","subscribers_url":"https://api.github.com/repos/usnavi/blueflood/subscribers","subscription_url":"https://api.github.com/repos/usnavi/blueflood/subscription","commits_url":"https://api.github.com/repos/usnavi/blueflood/commits{/sha}","git_commits_url":"https://api.github.com/repos/usnavi/blueflood/git/commits{/sha}","comments_url":"https://api.github.com/repos/usnavi/blueflood/comments{/number}","issue_comment_url":"https://api.github.com/repos/usnavi/blueflood/issues/comments{/number}","contents_url":"https://api.github.com/repos/usnavi/blueflood/contents/{+path}","compare_url":"https://api.github.com/repos/usnavi/blueflood/compare/{base}...{head}","merges_url":"https://api.github.com/repos/usnavi/blueflood/merges","archive_url":"https://api.github.com/repos/usnavi/blueflood/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/usnavi/blueflood/downloads","issues_url":"https://api.github.com/repos/usnavi/blueflood/issues{/number}","pulls_url":"https://api.github.com/repos/usnavi/blueflood/pulls{/number}","milestones_url":"https://api.github.com/repos/usnavi/blueflood/milestones{/number}","notifications_url":"https://api.github.com/repos/usnavi/blueflood/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/usnavi/blueflood/labels{/name}","releases_url":"https://api.github.com/repos/usnavi/blueflood/releases{/id}","deployments_url":"https://api.github.com/repos/usnavi/blueflood/deployments","created_at":"2015-11-02T17:04:56Z","updated_at":"2016-01-21T21:52:36Z","pushed_at":"2016-04-07T15:04:14Z","git_url":"git://github.com/usnavi/blueflood.git","ssh_url":"git@github.com:usnavi/blueflood.git","clone_url":"https://github.com/usnavi/blueflood.git","svn_url":"https://github.com/usnavi/blueflood","homepage":"http://www.blueflood.io","size":9482,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"rackerlabs:master","ref":"master","sha":"b061dc28509bfe563edb38ee4795760d3b174b01","user":{"login":"rackerlabs","id":84293,"avatar_url":"https://avatars.githubusercontent.com/u/84293?v=3","gravatar_id":"","url":"https://api.github.com/users/rackerlabs","html_url":"https://github.com/rackerlabs","followers_url":"https://api.github.com/users/rackerlabs/followers","following_url":"https://api.github.com/users/rackerlabs/following{/other_user}","gists_url":"https://api.github.com/users/rackerlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/rackerlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rackerlabs/subscriptions","organizations_url":"https://api.github.com/users/rackerlabs/orgs","repos_url":"https://api.github.com/users/rackerlabs/repos","events_url":"https://api.github.com/users/rackerlabs/events{/privacy}","received_events_url":"https://api.github.com/users/rackerlabs/received_events","type":"Organization","site_admin":false},"repo":{"id":10081109,"name":"blueflood","full_name":"rackerlabs/blueflood","owner":{"login":"rackerlabs","id":84293,"avatar_url":"https://avatars.githubusercontent.com/u/84293?v=3","gravatar_id":"","url":"https://api.github.com/users/rackerlabs","html_url":"https://github.com/rackerlabs","followers_url":"https://api.github.com/users/rackerlabs/followers","following_url":"https://api.github.com/users/rackerlabs/following{/other_user}","gists_url":"https://api.github.com/users/rackerlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/rackerlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rackerlabs/subscriptions","organizations_url":"https://api.github.com/users/rackerlabs/orgs","repos_url":"https://api.github.com/users/rackerlabs/repos","events_url":"https://api.github.com/users/rackerlabs/events{/privacy}","received_events_url":"https://api.github.com/users/rackerlabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rackerlabs/blueflood","description":"A distributed system designed to ingest and process time series data","fork":false,"url":"https://api.github.com/repos/rackerlabs/blueflood","forks_url":"https://api.github.com/repos/rackerlabs/blueflood/forks","keys_url":"https://api.github.com/repos/rackerlabs/blueflood/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rackerlabs/blueflood/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rackerlabs/blueflood/teams","hooks_url":"https://api.github.com/repos/rackerlabs/blueflood/hooks","issue_events_url":"https://api.github.com/repos/rackerlabs/blueflood/issues/events{/number}","events_url":"https://api.github.com/repos/rackerlabs/blueflood/events","assignees_url":"https://api.github.com/repos/rackerlabs/blueflood/assignees{/user}","branches_url":"https://api.github.com/repos/rackerlabs/blueflood/branches{/branch}","tags_url":"https://api.github.com/repos/rackerlabs/blueflood/tags","blobs_url":"https://api.github.com/repos/rackerlabs/blueflood/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rackerlabs/blueflood/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rackerlabs/blueflood/git/refs{/sha}","trees_url":"https://api.github.com/repos/rackerlabs/blueflood/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rackerlabs/blueflood/statuses/{sha}","languages_url":"https://api.github.com/repos/rackerlabs/blueflood/languages","stargazers_url":"https://api.github.com/repos/rackerlabs/blueflood/stargazers","contributors_url":"https://api.github.com/repos/rackerlabs/blueflood/contributors","subscribers_url":"https://api.github.com/repos/rackerlabs/blueflood/subscribers","subscription_url":"https://api.github.com/repos/rackerlabs/blueflood/subscription","commits_url":"https://api.github.com/repos/rackerlabs/blueflood/commits{/sha}","git_commits_url":"https://api.github.com/repos/rackerlabs/blueflood/git/commits{/sha}","comments_url":"https://api.github.com/repos/rackerlabs/blueflood/comments{/number}","issue_comment_url":"https://api.github.com/repos/rackerlabs/blueflood/issues/comments{/number}","contents_url":"https://api.github.com/repos/rackerlabs/blueflood/contents/{+path}","compare_url":"https://api.github.com/repos/rackerlabs/blueflood/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rackerlabs/blueflood/merges","archive_url":"https://api.github.com/repos/rackerlabs/blueflood/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rackerlabs/blueflood/downloads","issues_url":"https://api.github.com/repos/rackerlabs/blueflood/issues{/number}","pulls_url":"https://api.github.com/repos/rackerlabs/blueflood/pulls{/number}","milestones_url":"https://api.github.com/repos/rackerlabs/blueflood/milestones{/number}","notifications_url":"https://api.github.com/repos/rackerlabs/blueflood/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rackerlabs/blueflood/labels{/name}","releases_url":"https://api.github.com/repos/rackerlabs/blueflood/releases{/id}","deployments_url":"https://api.github.com/repos/rackerlabs/blueflood/deployments","created_at":"2013-05-15T14:50:39Z","updated_at":"2016-04-06T04:31:10Z","pushed_at":"2016-04-07T18:35:30Z","git_url":"git://github.com/rackerlabs/blueflood.git","ssh_url":"git@github.com:rackerlabs/blueflood.git","clone_url":"https://github.com/rackerlabs/blueflood.git","svn_url":"https://github.com/rackerlabs/blueflood","homepage":"http://www.blueflood.io","size":12761,"stargazers_count":421,"watchers_count":421,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":58,"mirror_url":null,"open_issues_count":25,"forks":58,"open_issues":25,"watchers":421,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rackerlabs/blueflood/pulls/660"},"html":{"href":"https://github.com/rackerlabs/blueflood/pull/660"},"issue":{"href":"https://api.github.com/repos/rackerlabs/blueflood/issues/660"},"comments":{"href":"https://api.github.com/repos/rackerlabs/blueflood/issues/660/comments"},"review_comments":{"href":"https://api.github.com/repos/rackerlabs/blueflood/pulls/660/comments"},"review_comment":{"href":"https://api.github.com/repos/rackerlabs/blueflood/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rackerlabs/blueflood/pulls/660/commits"},"statuses":{"href":"https://api.github.com/repos/rackerlabs/blueflood/statuses/c96c026e0d106a07a4d50d6c75ea80ca1097cbff"}}}}