{"action":"created","comment":{"url":"https://api.github.com/repos/RAttab/optics/pulls/comments/66833805","id":66833805,"diff_hunk":"@@ -0,0 +1,27 @@\n+/* buffer.h\n+   Rémi Attab (remi.attab@gmail.com), 09 Jun 2016\n+   FreeBSD-style copyright and disclaimer apply\n+*/\n+\n+#pragma once\n+\n+// -----------------------------------------------------------------------------\n+// buffer\n+// -----------------------------------------------------------------------------\n+\n+struct buffer\n+{\n+    size_t len;\n+    size_t cap;\n+    char *data;\n+};\n+\n+void buffer_reset(struct buffer *);\n+void buffer_reserve(struct buffer *, size_t len);\n+\n+void buffer_put(struct buffer *, char c);\n+void buffer_write(struct buffer *, const void *data, size_t len);\n+\n+// Does not write out null char at the end of the formatted string\n+void buffer_printf(struct buffer *, const char *fmt, ...) optics_printf(2, 3);","path":"src/utils/buffer.h","position":26,"original_position":26,"commit_id":"2e8041fd6dd2485221323f3e081e4508512d02a9","original_commit_id":"24f0beda4e8a66479ee249a63344722e5e15a4a5","user":{"login":"haguenau","id":3029165,"avatar_url":"https://avatars.githubusercontent.com/u/3029165?v=3","gravatar_id":"","url":"https://api.github.com/users/haguenau","html_url":"https://github.com/haguenau","followers_url":"https://api.github.com/users/haguenau/followers","following_url":"https://api.github.com/users/haguenau/following{/other_user}","gists_url":"https://api.github.com/users/haguenau/gists{/gist_id}","starred_url":"https://api.github.com/users/haguenau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haguenau/subscriptions","organizations_url":"https://api.github.com/users/haguenau/orgs","repos_url":"https://api.github.com/users/haguenau/repos","events_url":"https://api.github.com/users/haguenau/events{/privacy}","received_events_url":"https://api.github.com/users/haguenau/received_events","type":"User","site_admin":false},"body":"Aaah, awesome. I should have followed further and would have seen `optics_printf`was an attribute declaration.","created_at":"2016-06-13T17:35:21Z","updated_at":"2016-06-13T17:35:21Z","html_url":"https://github.com/RAttab/optics/pull/2#discussion_r66833805","pull_request_url":"https://api.github.com/repos/RAttab/optics/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/RAttab/optics/pulls/comments/66833805"},"html":{"href":"https://github.com/RAttab/optics/pull/2#discussion_r66833805"},"pull_request":{"href":"https://api.github.com/repos/RAttab/optics/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/RAttab/optics/pulls/2","id":73418009,"html_url":"https://github.com/RAttab/optics/pull/2","diff_url":"https://github.com/RAttab/optics/pull/2.diff","patch_url":"https://github.com/RAttab/optics/pull/2.patch","issue_url":"https://api.github.com/repos/RAttab/optics/issues/2","number":2,"state":"open","locked":false,"title":"Add support for Prometheus and REST backends","user":{"login":"RAttab","id":652873,"avatar_url":"https://avatars.githubusercontent.com/u/652873?v=3","gravatar_id":"","url":"https://api.github.com/users/RAttab","html_url":"https://github.com/RAttab","followers_url":"https://api.github.com/users/RAttab/followers","following_url":"https://api.github.com/users/RAttab/following{/other_user}","gists_url":"https://api.github.com/users/RAttab/gists{/gist_id}","starred_url":"https://api.github.com/users/RAttab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RAttab/subscriptions","organizations_url":"https://api.github.com/users/RAttab/orgs","repos_url":"https://api.github.com/users/RAttab/repos","events_url":"https://api.github.com/users/RAttab/events{/privacy}","received_events_url":"https://api.github.com/users/RAttab/received_events","type":"User","site_admin":false},"body":"Add a port of `crest` from pacingd that runs on `libmicrohttpd` instead of `libevent` and just generally makes handling HTTP requests easier. In retrospect, it feels a bit overkill for the whole 2 paths that are currently being used but I expect that I'll add more in the future.\r\n\r\nOn the optics side, I had to do a fair amount of refactoring to support backends that require counters to be outputed as rates (eg. carbon) as well as mononitic counters (eg. prometheus). This was done by outputing the data raw to the counters and adding a utility to normalize the raw values into rates. This allows the rate bakends to use the normalized output and the monotonic backends to add the current rate to the previous value it has. Not the cleanest thing in the world but if we ever switch the prometheus full-time then I'll be able to commit to a single scheme and do some cleanup.\r\n\r\nOtherwise the prometheus endpoint uses the simplest text protocol with typing comments. Currently optics doesn't support labels but we can add that if needed. As for the REST backend it's there mostly for debugging and for when graphite is taking its sweet sweet time adding new keys.","created_at":"2016-06-10T18:44:46Z","updated_at":"2016-06-13T17:35:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3fec13843eb00d666395c6adda36987cd51e3b72","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/RAttab/optics/pulls/2/commits","review_comments_url":"https://api.github.com/repos/RAttab/optics/pulls/2/comments","review_comment_url":"https://api.github.com/repos/RAttab/optics/pulls/comments{/number}","comments_url":"https://api.github.com/repos/RAttab/optics/issues/2/comments","statuses_url":"https://api.github.com/repos/RAttab/optics/statuses/2e8041fd6dd2485221323f3e081e4508512d02a9","head":{"label":"RAttab:crest","ref":"crest","sha":"2e8041fd6dd2485221323f3e081e4508512d02a9","user":{"login":"RAttab","id":652873,"avatar_url":"https://avatars.githubusercontent.com/u/652873?v=3","gravatar_id":"","url":"https://api.github.com/users/RAttab","html_url":"https://github.com/RAttab","followers_url":"https://api.github.com/users/RAttab/followers","following_url":"https://api.github.com/users/RAttab/following{/other_user}","gists_url":"https://api.github.com/users/RAttab/gists{/gist_id}","starred_url":"https://api.github.com/users/RAttab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RAttab/subscriptions","organizations_url":"https://api.github.com/users/RAttab/orgs","repos_url":"https://api.github.com/users/RAttab/repos","events_url":"https://api.github.com/users/RAttab/events{/privacy}","received_events_url":"https://api.github.com/users/RAttab/received_events","type":"User","site_admin":false},"repo":{"id":52550804,"name":"optics","full_name":"RAttab/optics","owner":{"login":"RAttab","id":652873,"avatar_url":"https://avatars.githubusercontent.com/u/652873?v=3","gravatar_id":"","url":"https://api.github.com/users/RAttab","html_url":"https://github.com/RAttab","followers_url":"https://api.github.com/users/RAttab/followers","following_url":"https://api.github.com/users/RAttab/following{/other_user}","gists_url":"https://api.github.com/users/RAttab/gists{/gist_id}","starred_url":"https://api.github.com/users/RAttab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RAttab/subscriptions","organizations_url":"https://api.github.com/users/RAttab/orgs","repos_url":"https://api.github.com/users/RAttab/repos","events_url":"https://api.github.com/users/RAttab/events{/privacy}","received_events_url":"https://api.github.com/users/RAttab/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/RAttab/optics","description":"Metrics gathering thingy","fork":false,"url":"https://api.github.com/repos/RAttab/optics","forks_url":"https://api.github.com/repos/RAttab/optics/forks","keys_url":"https://api.github.com/repos/RAttab/optics/keys{/key_id}","collaborators_url":"https://api.github.com/repos/RAttab/optics/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/RAttab/optics/teams","hooks_url":"https://api.github.com/repos/RAttab/optics/hooks","issue_events_url":"https://api.github.com/repos/RAttab/optics/issues/events{/number}","events_url":"https://api.github.com/repos/RAttab/optics/events","assignees_url":"https://api.github.com/repos/RAttab/optics/assignees{/user}","branches_url":"https://api.github.com/repos/RAttab/optics/branches{/branch}","tags_url":"https://api.github.com/repos/RAttab/optics/tags","blobs_url":"https://api.github.com/repos/RAttab/optics/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/RAttab/optics/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/RAttab/optics/git/refs{/sha}","trees_url":"https://api.github.com/repos/RAttab/optics/git/trees{/sha}","statuses_url":"https://api.github.com/repos/RAttab/optics/statuses/{sha}","languages_url":"https://api.github.com/repos/RAttab/optics/languages","stargazers_url":"https://api.github.com/repos/RAttab/optics/stargazers","contributors_url":"https://api.github.com/repos/RAttab/optics/contributors","subscribers_url":"https://api.github.com/repos/RAttab/optics/subscribers","subscription_url":"https://api.github.com/repos/RAttab/optics/subscription","commits_url":"https://api.github.com/repos/RAttab/optics/commits{/sha}","git_commits_url":"https://api.github.com/repos/RAttab/optics/git/commits{/sha}","comments_url":"https://api.github.com/repos/RAttab/optics/comments{/number}","issue_comment_url":"https://api.github.com/repos/RAttab/optics/issues/comments{/number}","contents_url":"https://api.github.com/repos/RAttab/optics/contents/{+path}","compare_url":"https://api.github.com/repos/RAttab/optics/compare/{base}...{head}","merges_url":"https://api.github.com/repos/RAttab/optics/merges","archive_url":"https://api.github.com/repos/RAttab/optics/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/RAttab/optics/downloads","issues_url":"https://api.github.com/repos/RAttab/optics/issues{/number}","pulls_url":"https://api.github.com/repos/RAttab/optics/pulls{/number}","milestones_url":"https://api.github.com/repos/RAttab/optics/milestones{/number}","notifications_url":"https://api.github.com/repos/RAttab/optics/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/RAttab/optics/labels{/name}","releases_url":"https://api.github.com/repos/RAttab/optics/releases{/id}","deployments_url":"https://api.github.com/repos/RAttab/optics/deployments","created_at":"2016-02-25T19:25:14Z","updated_at":"2016-03-23T11:10:40Z","pushed_at":"2016-06-10T18:44:46Z","git_url":"git://github.com/RAttab/optics.git","ssh_url":"git@github.com:RAttab/optics.git","clone_url":"https://github.com/RAttab/optics.git","svn_url":"https://github.com/RAttab/optics","homepage":null,"size":148,"stargazers_count":3,"watchers_count":3,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":3,"default_branch":"master"}},"base":{"label":"RAttab:master","ref":"master","sha":"e0a03188da70afaf63a89228291edf048e0ff9d7","user":{"login":"RAttab","id":652873,"avatar_url":"https://avatars.githubusercontent.com/u/652873?v=3","gravatar_id":"","url":"https://api.github.com/users/RAttab","html_url":"https://github.com/RAttab","followers_url":"https://api.github.com/users/RAttab/followers","following_url":"https://api.github.com/users/RAttab/following{/other_user}","gists_url":"https://api.github.com/users/RAttab/gists{/gist_id}","starred_url":"https://api.github.com/users/RAttab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RAttab/subscriptions","organizations_url":"https://api.github.com/users/RAttab/orgs","repos_url":"https://api.github.com/users/RAttab/repos","events_url":"https://api.github.com/users/RAttab/events{/privacy}","received_events_url":"https://api.github.com/users/RAttab/received_events","type":"User","site_admin":false},"repo":{"id":52550804,"name":"optics","full_name":"RAttab/optics","owner":{"login":"RAttab","id":652873,"avatar_url":"https://avatars.githubusercontent.com/u/652873?v=3","gravatar_id":"","url":"https://api.github.com/users/RAttab","html_url":"https://github.com/RAttab","followers_url":"https://api.github.com/users/RAttab/followers","following_url":"https://api.github.com/users/RAttab/following{/other_user}","gists_url":"https://api.github.com/users/RAttab/gists{/gist_id}","starred_url":"https://api.github.com/users/RAttab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RAttab/subscriptions","organizations_url":"https://api.github.com/users/RAttab/orgs","repos_url":"https://api.github.com/users/RAttab/repos","events_url":"https://api.github.com/users/RAttab/events{/privacy}","received_events_url":"https://api.github.com/users/RAttab/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/RAttab/optics","description":"Metrics gathering thingy","fork":false,"url":"https://api.github.com/repos/RAttab/optics","forks_url":"https://api.github.com/repos/RAttab/optics/forks","keys_url":"https://api.github.com/repos/RAttab/optics/keys{/key_id}","collaborators_url":"https://api.github.com/repos/RAttab/optics/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/RAttab/optics/teams","hooks_url":"https://api.github.com/repos/RAttab/optics/hooks","issue_events_url":"https://api.github.com/repos/RAttab/optics/issues/events{/number}","events_url":"https://api.github.com/repos/RAttab/optics/events","assignees_url":"https://api.github.com/repos/RAttab/optics/assignees{/user}","branches_url":"https://api.github.com/repos/RAttab/optics/branches{/branch}","tags_url":"https://api.github.com/repos/RAttab/optics/tags","blobs_url":"https://api.github.com/repos/RAttab/optics/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/RAttab/optics/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/RAttab/optics/git/refs{/sha}","trees_url":"https://api.github.com/repos/RAttab/optics/git/trees{/sha}","statuses_url":"https://api.github.com/repos/RAttab/optics/statuses/{sha}","languages_url":"https://api.github.com/repos/RAttab/optics/languages","stargazers_url":"https://api.github.com/repos/RAttab/optics/stargazers","contributors_url":"https://api.github.com/repos/RAttab/optics/contributors","subscribers_url":"https://api.github.com/repos/RAttab/optics/subscribers","subscription_url":"https://api.github.com/repos/RAttab/optics/subscription","commits_url":"https://api.github.com/repos/RAttab/optics/commits{/sha}","git_commits_url":"https://api.github.com/repos/RAttab/optics/git/commits{/sha}","comments_url":"https://api.github.com/repos/RAttab/optics/comments{/number}","issue_comment_url":"https://api.github.com/repos/RAttab/optics/issues/comments{/number}","contents_url":"https://api.github.com/repos/RAttab/optics/contents/{+path}","compare_url":"https://api.github.com/repos/RAttab/optics/compare/{base}...{head}","merges_url":"https://api.github.com/repos/RAttab/optics/merges","archive_url":"https://api.github.com/repos/RAttab/optics/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/RAttab/optics/downloads","issues_url":"https://api.github.com/repos/RAttab/optics/issues{/number}","pulls_url":"https://api.github.com/repos/RAttab/optics/pulls{/number}","milestones_url":"https://api.github.com/repos/RAttab/optics/milestones{/number}","notifications_url":"https://api.github.com/repos/RAttab/optics/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/RAttab/optics/labels{/name}","releases_url":"https://api.github.com/repos/RAttab/optics/releases{/id}","deployments_url":"https://api.github.com/repos/RAttab/optics/deployments","created_at":"2016-02-25T19:25:14Z","updated_at":"2016-03-23T11:10:40Z","pushed_at":"2016-06-10T18:44:46Z","git_url":"git://github.com/RAttab/optics.git","ssh_url":"git@github.com:RAttab/optics.git","clone_url":"https://github.com/RAttab/optics.git","svn_url":"https://github.com/RAttab/optics","homepage":null,"size":148,"stargazers_count":3,"watchers_count":3,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/RAttab/optics/pulls/2"},"html":{"href":"https://github.com/RAttab/optics/pull/2"},"issue":{"href":"https://api.github.com/repos/RAttab/optics/issues/2"},"comments":{"href":"https://api.github.com/repos/RAttab/optics/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/RAttab/optics/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/RAttab/optics/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/RAttab/optics/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/RAttab/optics/statuses/2e8041fd6dd2485221323f3e081e4508512d02a9"}}}}
{"actor":{"display_login":"haguenau"}}