{"action":"created","comment":{"url":"https://api.github.com/repos/influxdb/influxdb/pulls/comments/22415084","id":22415084,"diff_hunk":"@@ -0,0 +1,330 @@\n+package graphite\n+\n+import (\n+\t\"bufio\"\n+\t\"errors\"\n+\t\"fmt\"\n+\t\"io\"\n+\t\"net\"\n+\t\"strconv\"\n+\t\"strings\"\n+\t\"sync\"\n+\t\"time\"\n+\n+\t\"github.com/influxdb/influxdb\"\n+\n+\tlog \"code.google.com/p/log4go\"\n+)\n+\n+var (\n+\t// ErrBindAddressRequired is returned when starting the Server\n+\t// without a TCP or UDP listening address.\n+\tErrBindAddressRequired = errors.New(\"bind address required\")\n+\n+\t// ErrServerClosed return when closing an already closed graphite server.\n+\tErrServerClosed = errors.New(\"server already closed\")\n+\n+\t// ErrDatabaseNotSpecified retuned when no database was specified in the config file\n+\tErrDatabaseNotSpecified = errors.New(\"database was not specified in config\")\n+\n+\t// ErrServerNotSpecified returned when Server is not specified.\n+\tErrServerNotSpecified = errors.New(\"server not present\")\n+)\n+\n+// Graphite Server provides a tcp and/or udp listener that you can\n+// use to ingest metrics into influxdb via the graphite protocol.  it\n+// behaves as a carbon daemon, except:\n+//\n+// no rounding of timestamps to the nearest interval.  Upon ingestion\n+// of multiple datapoints for a given key within the same interval\n+// (possibly but not necessarily the same timestamp), graphite would\n+// use one (the latest received) value with a rounded timestamp\n+// representing that interval.  We store values for every timestamp we\n+// receive (only the latest value for a given metric-timestamp pair)\n+// so it's up to the user to feed the data in proper intervals (and\n+// use round intervals if you plan to rely on that)\n+type Server struct {\n+\tmu   sync.Mutex\n+\twg   sync.WaitGroup\n+\tdone chan struct{} // close notification\n+\n+\tServer interface {\n+\t\tWriteSeries(database, retentionPolicy, name string, tags map[string]string, timestamp time.Time, values map[string]interface{}) error\n+\t\tDefaultRetentionPolicy(database string) (*influxdb.RetentionPolicy, error)\n+\t}\n+\n+\t// The TCP address to listen on.\n+\tTCPAddr *net.TCPAddr\n+\n+\t// The UDP address to listen on.\n+\tUDPAddr *net.UDPAddr\n+\n+\t// The name of the database to insert data into.\n+\tDatabase string\n+}\n+\n+// ListenAndServe opens TCP (and optionally a UDP) socket to listen for messages.","path":"graphite/graphite.go","position":66,"original_position":66,"commit_id":"a7a22cc52d0282a4f541b93c867be66a1dbb7bc1","original_commit_id":"2303a0f01494143f5f92eb763c6cfc3836a6c113","user":{"login":"corylanou","id":585100,"avatar_url":"https://avatars.githubusercontent.com/u/585100?v=3","gravatar_id":"","url":"https://api.github.com/users/corylanou","html_url":"https://github.com/corylanou","followers_url":"https://api.github.com/users/corylanou/followers","following_url":"https://api.github.com/users/corylanou/following{/other_user}","gists_url":"https://api.github.com/users/corylanou/gists{/gist_id}","starred_url":"https://api.github.com/users/corylanou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/corylanou/subscriptions","organizations_url":"https://api.github.com/users/corylanou/orgs","repos_url":"https://api.github.com/users/corylanou/repos","events_url":"https://api.github.com/users/corylanou/events{/privacy}","received_events_url":"https://api.github.com/users/corylanou/received_events","type":"User","site_admin":false},"body":"They can specify one or the other (tcp or udp).  So they can just open a udp if in the config they only specify the udp protocol.","created_at":"2015-01-02T16:56:39Z","updated_at":"2015-01-02T16:56:39Z","html_url":"https://github.com/influxdb/influxdb/pull/1276#discussion_r22415084","pull_request_url":"https://api.github.com/repos/influxdb/influxdb/pulls/1276","_links":{"self":{"href":"https://api.github.com/repos/influxdb/influxdb/pulls/comments/22415084"},"html":{"href":"https://github.com/influxdb/influxdb/pull/1276#discussion_r22415084"},"pull_request":{"href":"https://api.github.com/repos/influxdb/influxdb/pulls/1276"}}},"pull_request":{"url":"https://api.github.com/repos/influxdb/influxdb/pulls/1276","id":26708467,"html_url":"https://github.com/influxdb/influxdb/pull/1276","diff_url":"https://github.com/influxdb/influxdb/pull/1276.diff","patch_url":"https://github.com/influxdb/influxdb/pull/1276.patch","issue_url":"https://api.github.com/repos/influxdb/influxdb/issues/1276","number":1276,"state":"open","locked":false,"title":"Graphite WIP","user":{"login":"corylanou","id":585100,"avatar_url":"https://avatars.githubusercontent.com/u/585100?v=3","gravatar_id":"","url":"https://api.github.com/users/corylanou","html_url":"https://github.com/corylanou","followers_url":"https://api.github.com/users/corylanou/followers","following_url":"https://api.github.com/users/corylanou/following{/other_user}","gists_url":"https://api.github.com/users/corylanou/gists{/gist_id}","starred_url":"https://api.github.com/users/corylanou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/corylanou/subscriptions","organizations_url":"https://api.github.com/users/corylanou/orgs","repos_url":"https://api.github.com/users/corylanou/repos","events_url":"https://api.github.com/users/corylanou/events{/privacy}","received_events_url":"https://api.github.com/users/corylanou/received_events","type":"User","site_admin":false},"body":"Graphite end point has been beaten back into shape.  Added test coverage.\r\n\r\nChanged config to allow for infinite Graphite listeners... might be something we need to limit at some point.\r\n\r\nwould love feedback!","created_at":"2014-12-30T23:07:48Z","updated_at":"2015-01-02T16:56:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b2abc00ddd5cd86712112bcd7f3e3e4d5751bc65","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/influxdb/influxdb/pulls/1276/commits","review_comments_url":"https://api.github.com/repos/influxdb/influxdb/pulls/1276/comments","review_comment_url":"https://api.github.com/repos/influxdb/influxdb/pulls/comments/{number}","comments_url":"https://api.github.com/repos/influxdb/influxdb/issues/1276/comments","statuses_url":"https://api.github.com/repos/influxdb/influxdb/statuses/a7a22cc52d0282a4f541b93c867be66a1dbb7bc1","head":{"label":"corylanou:graphite","ref":"graphite","sha":"a7a22cc52d0282a4f541b93c867be66a1dbb7bc1","user":{"login":"corylanou","id":585100,"avatar_url":"https://avatars.githubusercontent.com/u/585100?v=3","gravatar_id":"","url":"https://api.github.com/users/corylanou","html_url":"https://github.com/corylanou","followers_url":"https://api.github.com/users/corylanou/followers","following_url":"https://api.github.com/users/corylanou/following{/other_user}","gists_url":"https://api.github.com/users/corylanou/gists{/gist_id}","starred_url":"https://api.github.com/users/corylanou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/corylanou/subscriptions","organizations_url":"https://api.github.com/users/corylanou/orgs","repos_url":"https://api.github.com/users/corylanou/repos","events_url":"https://api.github.com/users/corylanou/events{/privacy}","received_events_url":"https://api.github.com/users/corylanou/received_events","type":"User","site_admin":false},"repo":{"id":28596854,"name":"influxdb","full_name":"corylanou/influxdb","owner":{"login":"corylanou","id":585100,"avatar_url":"https://avatars.githubusercontent.com/u/585100?v=3","gravatar_id":"","url":"https://api.github.com/users/corylanou","html_url":"https://github.com/corylanou","followers_url":"https://api.github.com/users/corylanou/followers","following_url":"https://api.github.com/users/corylanou/following{/other_user}","gists_url":"https://api.github.com/users/corylanou/gists{/gist_id}","starred_url":"https://api.github.com/users/corylanou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/corylanou/subscriptions","organizations_url":"https://api.github.com/users/corylanou/orgs","repos_url":"https://api.github.com/users/corylanou/repos","events_url":"https://api.github.com/users/corylanou/events{/privacy}","received_events_url":"https://api.github.com/users/corylanou/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/corylanou/influxdb","description":"Scalable datastore for metrics, events, and real-time analytics","fork":true,"url":"https://api.github.com/repos/corylanou/influxdb","forks_url":"https://api.github.com/repos/corylanou/influxdb/forks","keys_url":"https://api.github.com/repos/corylanou/influxdb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/corylanou/influxdb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/corylanou/influxdb/teams","hooks_url":"https://api.github.com/repos/corylanou/influxdb/hooks","issue_events_url":"https://api.github.com/repos/corylanou/influxdb/issues/events{/number}","events_url":"https://api.github.com/repos/corylanou/influxdb/events","assignees_url":"https://api.github.com/repos/corylanou/influxdb/assignees{/user}","branches_url":"https://api.github.com/repos/corylanou/influxdb/branches{/branch}","tags_url":"https://api.github.com/repos/corylanou/influxdb/tags","blobs_url":"https://api.github.com/repos/corylanou/influxdb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/corylanou/influxdb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/corylanou/influxdb/git/refs{/sha}","trees_url":"https://api.github.com/repos/corylanou/influxdb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/corylanou/influxdb/statuses/{sha}","languages_url":"https://api.github.com/repos/corylanou/influxdb/languages","stargazers_url":"https://api.github.com/repos/corylanou/influxdb/stargazers","contributors_url":"https://api.github.com/repos/corylanou/influxdb/contributors","subscribers_url":"https://api.github.com/repos/corylanou/influxdb/subscribers","subscription_url":"https://api.github.com/repos/corylanou/influxdb/subscription","commits_url":"https://api.github.com/repos/corylanou/influxdb/commits{/sha}","git_commits_url":"https://api.github.com/repos/corylanou/influxdb/git/commits{/sha}","comments_url":"https://api.github.com/repos/corylanou/influxdb/comments{/number}","issue_comment_url":"https://api.github.com/repos/corylanou/influxdb/issues/comments/{number}","contents_url":"https://api.github.com/repos/corylanou/influxdb/contents/{+path}","compare_url":"https://api.github.com/repos/corylanou/influxdb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/corylanou/influxdb/merges","archive_url":"https://api.github.com/repos/corylanou/influxdb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/corylanou/influxdb/downloads","issues_url":"https://api.github.com/repos/corylanou/influxdb/issues{/number}","pulls_url":"https://api.github.com/repos/corylanou/influxdb/pulls{/number}","milestones_url":"https://api.github.com/repos/corylanou/influxdb/milestones{/number}","notifications_url":"https://api.github.com/repos/corylanou/influxdb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/corylanou/influxdb/labels{/name}","releases_url":"https://api.github.com/repos/corylanou/influxdb/releases{/id}","created_at":"2014-12-29T15:39:44Z","updated_at":"2014-12-30T22:52:53Z","pushed_at":"2015-01-02T16:09:13Z","git_url":"git://github.com/corylanou/influxdb.git","ssh_url":"git@github.com:corylanou/influxdb.git","clone_url":"https://github.com/corylanou/influxdb.git","svn_url":"https://github.com/corylanou/influxdb","homepage":"http://influxdb.com","size":8340,"stargazers_count":0,"watchers_count":0,"language":"Go","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":"influxdb:master","ref":"master","sha":"f37f0b80fa0e186f24a54359156f835031ef85e5","user":{"login":"influxdb","id":5713248,"avatar_url":"https://avatars.githubusercontent.com/u/5713248?v=3","gravatar_id":"","url":"https://api.github.com/users/influxdb","html_url":"https://github.com/influxdb","followers_url":"https://api.github.com/users/influxdb/followers","following_url":"https://api.github.com/users/influxdb/following{/other_user}","gists_url":"https://api.github.com/users/influxdb/gists{/gist_id}","starred_url":"https://api.github.com/users/influxdb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/influxdb/subscriptions","organizations_url":"https://api.github.com/users/influxdb/orgs","repos_url":"https://api.github.com/users/influxdb/repos","events_url":"https://api.github.com/users/influxdb/events{/privacy}","received_events_url":"https://api.github.com/users/influxdb/received_events","type":"Organization","site_admin":false},"repo":{"id":13124802,"name":"influxdb","full_name":"influxdb/influxdb","owner":{"login":"influxdb","id":5713248,"avatar_url":"https://avatars.githubusercontent.com/u/5713248?v=3","gravatar_id":"","url":"https://api.github.com/users/influxdb","html_url":"https://github.com/influxdb","followers_url":"https://api.github.com/users/influxdb/followers","following_url":"https://api.github.com/users/influxdb/following{/other_user}","gists_url":"https://api.github.com/users/influxdb/gists{/gist_id}","starred_url":"https://api.github.com/users/influxdb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/influxdb/subscriptions","organizations_url":"https://api.github.com/users/influxdb/orgs","repos_url":"https://api.github.com/users/influxdb/repos","events_url":"https://api.github.com/users/influxdb/events{/privacy}","received_events_url":"https://api.github.com/users/influxdb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/influxdb/influxdb","description":"Scalable datastore for metrics, events, and real-time analytics","fork":false,"url":"https://api.github.com/repos/influxdb/influxdb","forks_url":"https://api.github.com/repos/influxdb/influxdb/forks","keys_url":"https://api.github.com/repos/influxdb/influxdb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/influxdb/influxdb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/influxdb/influxdb/teams","hooks_url":"https://api.github.com/repos/influxdb/influxdb/hooks","issue_events_url":"https://api.github.com/repos/influxdb/influxdb/issues/events{/number}","events_url":"https://api.github.com/repos/influxdb/influxdb/events","assignees_url":"https://api.github.com/repos/influxdb/influxdb/assignees{/user}","branches_url":"https://api.github.com/repos/influxdb/influxdb/branches{/branch}","tags_url":"https://api.github.com/repos/influxdb/influxdb/tags","blobs_url":"https://api.github.com/repos/influxdb/influxdb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/influxdb/influxdb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/influxdb/influxdb/git/refs{/sha}","trees_url":"https://api.github.com/repos/influxdb/influxdb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/influxdb/influxdb/statuses/{sha}","languages_url":"https://api.github.com/repos/influxdb/influxdb/languages","stargazers_url":"https://api.github.com/repos/influxdb/influxdb/stargazers","contributors_url":"https://api.github.com/repos/influxdb/influxdb/contributors","subscribers_url":"https://api.github.com/repos/influxdb/influxdb/subscribers","subscription_url":"https://api.github.com/repos/influxdb/influxdb/subscription","commits_url":"https://api.github.com/repos/influxdb/influxdb/commits{/sha}","git_commits_url":"https://api.github.com/repos/influxdb/influxdb/git/commits{/sha}","comments_url":"https://api.github.com/repos/influxdb/influxdb/comments{/number}","issue_comment_url":"https://api.github.com/repos/influxdb/influxdb/issues/comments/{number}","contents_url":"https://api.github.com/repos/influxdb/influxdb/contents/{+path}","compare_url":"https://api.github.com/repos/influxdb/influxdb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/influxdb/influxdb/merges","archive_url":"https://api.github.com/repos/influxdb/influxdb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/influxdb/influxdb/downloads","issues_url":"https://api.github.com/repos/influxdb/influxdb/issues{/number}","pulls_url":"https://api.github.com/repos/influxdb/influxdb/pulls{/number}","milestones_url":"https://api.github.com/repos/influxdb/influxdb/milestones{/number}","notifications_url":"https://api.github.com/repos/influxdb/influxdb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/influxdb/influxdb/labels{/name}","releases_url":"https://api.github.com/repos/influxdb/influxdb/releases{/id}","created_at":"2013-09-26T14:31:10Z","updated_at":"2015-01-02T15:20:41Z","pushed_at":"2014-12-31T23:57:30Z","git_url":"git://github.com/influxdb/influxdb.git","ssh_url":"git@github.com:influxdb/influxdb.git","clone_url":"https://github.com/influxdb/influxdb.git","svn_url":"https://github.com/influxdb/influxdb","homepage":"http://influxdb.com","size":18269,"stargazers_count":4055,"watchers_count":4055,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":312,"mirror_url":null,"open_issues_count":228,"forks":312,"open_issues":228,"watchers":4055,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/influxdb/influxdb/pulls/1276"},"html":{"href":"https://github.com/influxdb/influxdb/pull/1276"},"issue":{"href":"https://api.github.com/repos/influxdb/influxdb/issues/1276"},"comments":{"href":"https://api.github.com/repos/influxdb/influxdb/issues/1276/comments"},"review_comments":{"href":"https://api.github.com/repos/influxdb/influxdb/pulls/1276/comments"},"review_comment":{"href":"https://api.github.com/repos/influxdb/influxdb/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/influxdb/influxdb/pulls/1276/commits"},"statuses":{"href":"https://api.github.com/repos/influxdb/influxdb/statuses/a7a22cc52d0282a4f541b93c867be66a1dbb7bc1"}}}}