{"action":"created","comment":{"url":"https://api.github.com/repos/uber/node-statsd-client/pulls/comments/25917926","id":25917926,"diff_hunk":"@@ -90,6 +107,50 @@ StatsDClient.prototype.timing = function (name, time) {\n };\n \n /*\n+ * immediateGauge(name, delta)\n+ */\n+ StatsDClient.prototype.immediateGauge = function (name, value, cb) {\n+    name = this.options.prefix + name;\n+    var message = new Messages.Gauge(name, value);\n+    this._ephemeralSocket._writeToSocket(message.toString(), cb);\n+ }\n+\n+/*\n+ * immediateCounter(name, delta)\n+ */\n+StatsDClient.prototype.immediateCounter = function (name, delta, cb) {\n+    name = this.options.prefix + name;\n+    var message = new Messages.Counter(name, delta);\n+    this._ephemeralSocket._writeToSocket(message.toString(), cb);\n+}\n+\n+/*\n+ * immediateIncrement(name, [delta=1])\n+ */\n+StatsDClient.prototype.immediateIncrement = function (name, delta, cb) {","path":"lib/statsd-client.js","position":48,"original_position":48,"commit_id":"470561892a5e945386da70fe240c8e04e91d0ae8","original_commit_id":"470561892a5e945386da70fe240c8e04e91d0ae8","user":{"login":"Raynos","id":479538,"avatar_url":"https://avatars.githubusercontent.com/u/479538?v=3","gravatar_id":"","url":"https://api.github.com/users/Raynos","html_url":"https://github.com/Raynos","followers_url":"https://api.github.com/users/Raynos/followers","following_url":"https://api.github.com/users/Raynos/following{/other_user}","gists_url":"https://api.github.com/users/Raynos/gists{/gist_id}","starred_url":"https://api.github.com/users/Raynos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Raynos/subscriptions","organizations_url":"https://api.github.com/users/Raynos/orgs","repos_url":"https://api.github.com/users/Raynos/repos","events_url":"https://api.github.com/users/Raynos/events{/privacy}","received_events_url":"https://api.github.com/users/Raynos/received_events","type":"User","site_admin":false},"body":"increment implemented twice.","created_at":"2015-03-06T00:59:04Z","updated_at":"2015-03-06T00:59:04Z","html_url":"https://github.com/uber/node-statsd-client/pull/23#discussion_r25917926","pull_request_url":"https://api.github.com/repos/uber/node-statsd-client/pulls/23","_links":{"self":{"href":"https://api.github.com/repos/uber/node-statsd-client/pulls/comments/25917926"},"html":{"href":"https://github.com/uber/node-statsd-client/pull/23#discussion_r25917926"},"pull_request":{"href":"https://api.github.com/repos/uber/node-statsd-client/pulls/23"}}},"pull_request":{"url":"https://api.github.com/repos/uber/node-statsd-client/pulls/23","id":30604346,"html_url":"https://github.com/uber/node-statsd-client/pull/23","diff_url":"https://github.com/uber/node-statsd-client/pull/23.diff","patch_url":"https://github.com/uber/node-statsd-client/pull/23.patch","issue_url":"https://api.github.com/repos/uber/node-statsd-client/issues/23","number":23,"state":"open","locked":false,"title":"add callback function for ephemeralSocket and statsd-client","user":{"login":"andycmu","id":6538777,"avatar_url":"https://avatars.githubusercontent.com/u/6538777?v=3","gravatar_id":"","url":"https://api.github.com/users/andycmu","html_url":"https://github.com/andycmu","followers_url":"https://api.github.com/users/andycmu/followers","following_url":"https://api.github.com/users/andycmu/following{/other_user}","gists_url":"https://api.github.com/users/andycmu/gists{/gist_id}","starred_url":"https://api.github.com/users/andycmu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andycmu/subscriptions","organizations_url":"https://api.github.com/users/andycmu/orgs","repos_url":"https://api.github.com/users/andycmu/repos","events_url":"https://api.github.com/users/andycmu/events{/privacy}","received_events_url":"https://api.github.com/users/andycmu/received_events","type":"User","site_admin":false},"body":"In order to ensure statsd before server crashes, we can take advantage of socket.send of udp socket. The callback function is called when the messages was sent. I made such changes:\r\nAdd a callback function field in _writeToSocket in EphemeralSocket.js\r\nAdd two function to increment immediately in statsd-client.js\r\nThanks.","created_at":"2015-03-05T22:53:02Z","updated_at":"2015-03-06T00:59:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6636e7473af06707ebf6043cf86bf428b3ccb859","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/uber/node-statsd-client/pulls/23/commits","review_comments_url":"https://api.github.com/repos/uber/node-statsd-client/pulls/23/comments","review_comment_url":"https://api.github.com/repos/uber/node-statsd-client/pulls/comments{/number}","comments_url":"https://api.github.com/repos/uber/node-statsd-client/issues/23/comments","statuses_url":"https://api.github.com/repos/uber/node-statsd-client/statuses/470561892a5e945386da70fe240c8e04e91d0ae8","head":{"label":"uber:immediate-send-methods","ref":"immediate-send-methods","sha":"470561892a5e945386da70fe240c8e04e91d0ae8","user":{"login":"uber","id":538264,"avatar_url":"https://avatars.githubusercontent.com/u/538264?v=3","gravatar_id":"","url":"https://api.github.com/users/uber","html_url":"https://github.com/uber","followers_url":"https://api.github.com/users/uber/followers","following_url":"https://api.github.com/users/uber/following{/other_user}","gists_url":"https://api.github.com/users/uber/gists{/gist_id}","starred_url":"https://api.github.com/users/uber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uber/subscriptions","organizations_url":"https://api.github.com/users/uber/orgs","repos_url":"https://api.github.com/users/uber/repos","events_url":"https://api.github.com/users/uber/events{/privacy}","received_events_url":"https://api.github.com/users/uber/received_events","type":"Organization","site_admin":false},"repo":{"id":16596160,"name":"node-statsd-client","full_name":"uber/node-statsd-client","owner":{"login":"uber","id":538264,"avatar_url":"https://avatars.githubusercontent.com/u/538264?v=3","gravatar_id":"","url":"https://api.github.com/users/uber","html_url":"https://github.com/uber","followers_url":"https://api.github.com/users/uber/followers","following_url":"https://api.github.com/users/uber/following{/other_user}","gists_url":"https://api.github.com/users/uber/gists{/gist_id}","starred_url":"https://api.github.com/users/uber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uber/subscriptions","organizations_url":"https://api.github.com/users/uber/orgs","repos_url":"https://api.github.com/users/uber/repos","events_url":"https://api.github.com/users/uber/events{/privacy}","received_events_url":"https://api.github.com/users/uber/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/uber/node-statsd-client","description":"Node.js client for statsd","fork":true,"url":"https://api.github.com/repos/uber/node-statsd-client","forks_url":"https://api.github.com/repos/uber/node-statsd-client/forks","keys_url":"https://api.github.com/repos/uber/node-statsd-client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/uber/node-statsd-client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/uber/node-statsd-client/teams","hooks_url":"https://api.github.com/repos/uber/node-statsd-client/hooks","issue_events_url":"https://api.github.com/repos/uber/node-statsd-client/issues/events{/number}","events_url":"https://api.github.com/repos/uber/node-statsd-client/events","assignees_url":"https://api.github.com/repos/uber/node-statsd-client/assignees{/user}","branches_url":"https://api.github.com/repos/uber/node-statsd-client/branches{/branch}","tags_url":"https://api.github.com/repos/uber/node-statsd-client/tags","blobs_url":"https://api.github.com/repos/uber/node-statsd-client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/uber/node-statsd-client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/uber/node-statsd-client/git/refs{/sha}","trees_url":"https://api.github.com/repos/uber/node-statsd-client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/uber/node-statsd-client/statuses/{sha}","languages_url":"https://api.github.com/repos/uber/node-statsd-client/languages","stargazers_url":"https://api.github.com/repos/uber/node-statsd-client/stargazers","contributors_url":"https://api.github.com/repos/uber/node-statsd-client/contributors","subscribers_url":"https://api.github.com/repos/uber/node-statsd-client/subscribers","subscription_url":"https://api.github.com/repos/uber/node-statsd-client/subscription","commits_url":"https://api.github.com/repos/uber/node-statsd-client/commits{/sha}","git_commits_url":"https://api.github.com/repos/uber/node-statsd-client/git/commits{/sha}","comments_url":"https://api.github.com/repos/uber/node-statsd-client/comments{/number}","issue_comment_url":"https://api.github.com/repos/uber/node-statsd-client/issues/comments{/number}","contents_url":"https://api.github.com/repos/uber/node-statsd-client/contents/{+path}","compare_url":"https://api.github.com/repos/uber/node-statsd-client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/uber/node-statsd-client/merges","archive_url":"https://api.github.com/repos/uber/node-statsd-client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/uber/node-statsd-client/downloads","issues_url":"https://api.github.com/repos/uber/node-statsd-client/issues{/number}","pulls_url":"https://api.github.com/repos/uber/node-statsd-client/pulls{/number}","milestones_url":"https://api.github.com/repos/uber/node-statsd-client/milestones{/number}","notifications_url":"https://api.github.com/repos/uber/node-statsd-client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/uber/node-statsd-client/labels{/name}","releases_url":"https://api.github.com/repos/uber/node-statsd-client/releases{/id}","created_at":"2014-02-06T22:22:30Z","updated_at":"2015-02-20T23:50:58Z","pushed_at":"2015-03-06T00:36:41Z","git_url":"git://github.com/uber/node-statsd-client.git","ssh_url":"git@github.com:uber/node-statsd-client.git","clone_url":"https://github.com/uber/node-statsd-client.git","svn_url":"https://github.com/uber/node-statsd-client","homepage":null,"size":627,"stargazers_count":6,"watchers_count":6,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":2,"forks":1,"open_issues":2,"watchers":6,"default_branch":"master"}},"base":{"label":"uber:master","ref":"master","sha":"e477cac92e010a6127481a242459510b555baca1","user":{"login":"uber","id":538264,"avatar_url":"https://avatars.githubusercontent.com/u/538264?v=3","gravatar_id":"","url":"https://api.github.com/users/uber","html_url":"https://github.com/uber","followers_url":"https://api.github.com/users/uber/followers","following_url":"https://api.github.com/users/uber/following{/other_user}","gists_url":"https://api.github.com/users/uber/gists{/gist_id}","starred_url":"https://api.github.com/users/uber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uber/subscriptions","organizations_url":"https://api.github.com/users/uber/orgs","repos_url":"https://api.github.com/users/uber/repos","events_url":"https://api.github.com/users/uber/events{/privacy}","received_events_url":"https://api.github.com/users/uber/received_events","type":"Organization","site_admin":false},"repo":{"id":16596160,"name":"node-statsd-client","full_name":"uber/node-statsd-client","owner":{"login":"uber","id":538264,"avatar_url":"https://avatars.githubusercontent.com/u/538264?v=3","gravatar_id":"","url":"https://api.github.com/users/uber","html_url":"https://github.com/uber","followers_url":"https://api.github.com/users/uber/followers","following_url":"https://api.github.com/users/uber/following{/other_user}","gists_url":"https://api.github.com/users/uber/gists{/gist_id}","starred_url":"https://api.github.com/users/uber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uber/subscriptions","organizations_url":"https://api.github.com/users/uber/orgs","repos_url":"https://api.github.com/users/uber/repos","events_url":"https://api.github.com/users/uber/events{/privacy}","received_events_url":"https://api.github.com/users/uber/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/uber/node-statsd-client","description":"Node.js client for statsd","fork":true,"url":"https://api.github.com/repos/uber/node-statsd-client","forks_url":"https://api.github.com/repos/uber/node-statsd-client/forks","keys_url":"https://api.github.com/repos/uber/node-statsd-client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/uber/node-statsd-client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/uber/node-statsd-client/teams","hooks_url":"https://api.github.com/repos/uber/node-statsd-client/hooks","issue_events_url":"https://api.github.com/repos/uber/node-statsd-client/issues/events{/number}","events_url":"https://api.github.com/repos/uber/node-statsd-client/events","assignees_url":"https://api.github.com/repos/uber/node-statsd-client/assignees{/user}","branches_url":"https://api.github.com/repos/uber/node-statsd-client/branches{/branch}","tags_url":"https://api.github.com/repos/uber/node-statsd-client/tags","blobs_url":"https://api.github.com/repos/uber/node-statsd-client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/uber/node-statsd-client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/uber/node-statsd-client/git/refs{/sha}","trees_url":"https://api.github.com/repos/uber/node-statsd-client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/uber/node-statsd-client/statuses/{sha}","languages_url":"https://api.github.com/repos/uber/node-statsd-client/languages","stargazers_url":"https://api.github.com/repos/uber/node-statsd-client/stargazers","contributors_url":"https://api.github.com/repos/uber/node-statsd-client/contributors","subscribers_url":"https://api.github.com/repos/uber/node-statsd-client/subscribers","subscription_url":"https://api.github.com/repos/uber/node-statsd-client/subscription","commits_url":"https://api.github.com/repos/uber/node-statsd-client/commits{/sha}","git_commits_url":"https://api.github.com/repos/uber/node-statsd-client/git/commits{/sha}","comments_url":"https://api.github.com/repos/uber/node-statsd-client/comments{/number}","issue_comment_url":"https://api.github.com/repos/uber/node-statsd-client/issues/comments{/number}","contents_url":"https://api.github.com/repos/uber/node-statsd-client/contents/{+path}","compare_url":"https://api.github.com/repos/uber/node-statsd-client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/uber/node-statsd-client/merges","archive_url":"https://api.github.com/repos/uber/node-statsd-client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/uber/node-statsd-client/downloads","issues_url":"https://api.github.com/repos/uber/node-statsd-client/issues{/number}","pulls_url":"https://api.github.com/repos/uber/node-statsd-client/pulls{/number}","milestones_url":"https://api.github.com/repos/uber/node-statsd-client/milestones{/number}","notifications_url":"https://api.github.com/repos/uber/node-statsd-client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/uber/node-statsd-client/labels{/name}","releases_url":"https://api.github.com/repos/uber/node-statsd-client/releases{/id}","created_at":"2014-02-06T22:22:30Z","updated_at":"2015-02-20T23:50:58Z","pushed_at":"2015-03-06T00:36:41Z","git_url":"git://github.com/uber/node-statsd-client.git","ssh_url":"git@github.com:uber/node-statsd-client.git","clone_url":"https://github.com/uber/node-statsd-client.git","svn_url":"https://github.com/uber/node-statsd-client","homepage":null,"size":627,"stargazers_count":6,"watchers_count":6,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":2,"forks":1,"open_issues":2,"watchers":6,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/uber/node-statsd-client/pulls/23"},"html":{"href":"https://github.com/uber/node-statsd-client/pull/23"},"issue":{"href":"https://api.github.com/repos/uber/node-statsd-client/issues/23"},"comments":{"href":"https://api.github.com/repos/uber/node-statsd-client/issues/23/comments"},"review_comments":{"href":"https://api.github.com/repos/uber/node-statsd-client/pulls/23/comments"},"review_comment":{"href":"https://api.github.com/repos/uber/node-statsd-client/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/uber/node-statsd-client/pulls/23/commits"},"statuses":{"href":"https://api.github.com/repos/uber/node-statsd-client/statuses/470561892a5e945386da70fe240c8e04e91d0ae8"}}}}