{"action":"created","comment":{"url":"https://api.github.com/repos/Stackdriver/collectd/pulls/comments/111497152","pull_request_review_id":32747806,"id":111497152,"diff_hunk":"@@ -2147,6 +2176,53 @@ static monitored_resource_t *wg_monitored_resource_create(\n   return NULL;\n }\n \n+static monitored_resource_t *wg_monitored_resource_create_from_metadata(\n+    const char *metadata_agent_url, const char *metadata_agent_port,\n+    const char *project_id, const char *host) {\n+  if (host == NULL) {\n+    WARNING(\"write_gcm: Hostname not set. Cannot use Metadata Agent.\");\n+    return NULL;\n+  }\n+  char *body = NULL;\n+  const char **headers = NULL;\n+  int num_headers = 0;\n+  const char *url = metadata_agent_url != NULL ?\n+      metadata_agent_url : metadata_agent_default_url;\n+  const char *port = metadata_agent_port != NULL ?\n+      metadata_agent_port : metadata_agent_default_port;\n+  char *response_buffer = (char *)\n+      calloc(METADATA_RESPONSE_BUFFER_SIZE, sizeof(char));\n+  if (response_buffer == NULL) {\n+    ERROR(\n+        \"write_gcm: wg_monitored_resource_create_from_metadata: calloc failed.\");\n+    return NULL;\n+  }\n+  size_t url_size = strlen(url) + strlen(port) + strlen(host) + 21;","path":"src/write_gcm.c","position":136,"original_position":136,"commit_id":"236f56340a9c5797dd7b0c42e335678f36ac50be","original_commit_id":"236f56340a9c5797dd7b0c42e335678f36ac50be","user":{"login":"igorpeshansky","id":7594381,"avatar_url":"https://avatars2.githubusercontent.com/u/7594381?v=3","gravatar_id":"","url":"https://api.github.com/users/igorpeshansky","html_url":"https://github.com/igorpeshansky","followers_url":"https://api.github.com/users/igorpeshansky/followers","following_url":"https://api.github.com/users/igorpeshansky/following{/other_user}","gists_url":"https://api.github.com/users/igorpeshansky/gists{/gist_id}","starred_url":"https://api.github.com/users/igorpeshansky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/igorpeshansky/subscriptions","organizations_url":"https://api.github.com/users/igorpeshansky/orgs","repos_url":"https://api.github.com/users/igorpeshansky/repos","events_url":"https://api.github.com/users/igorpeshansky/events{/privacy}","received_events_url":"https://api.github.com/users/igorpeshansky/received_events","type":"User","site_admin":false},"body":"`21` == magic?","created_at":"2017-04-13T22:03:40Z","updated_at":"2017-04-13T22:35:59Z","html_url":"https://github.com/Stackdriver/collectd/pull/95#discussion_r111497152","pull_request_url":"https://api.github.com/repos/Stackdriver/collectd/pulls/95","_links":{"self":{"href":"https://api.github.com/repos/Stackdriver/collectd/pulls/comments/111497152"},"html":{"href":"https://github.com/Stackdriver/collectd/pull/95#discussion_r111497152"},"pull_request":{"href":"https://api.github.com/repos/Stackdriver/collectd/pulls/95"}}},"pull_request":{"url":"https://api.github.com/repos/Stackdriver/collectd/pulls/95","id":107463745,"html_url":"https://github.com/Stackdriver/collectd/pull/95","diff_url":"https://github.com/Stackdriver/collectd/pull/95.diff","patch_url":"https://github.com/Stackdriver/collectd/pull/95.patch","issue_url":"https://api.github.com/repos/Stackdriver/collectd/issues/95","number":95,"state":"open","locked":false,"title":"Metadata Agent support for Monitoring Agent","user":{"login":"dhrupadb","id":4055510,"avatar_url":"https://avatars3.githubusercontent.com/u/4055510?v=3","gravatar_id":"","url":"https://api.github.com/users/dhrupadb","html_url":"https://github.com/dhrupadb","followers_url":"https://api.github.com/users/dhrupadb/followers","following_url":"https://api.github.com/users/dhrupadb/following{/other_user}","gists_url":"https://api.github.com/users/dhrupadb/gists{/gist_id}","starred_url":"https://api.github.com/users/dhrupadb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dhrupadb/subscriptions","organizations_url":"https://api.github.com/users/dhrupadb/orgs","repos_url":"https://api.github.com/users/dhrupadb/repos","events_url":"https://api.github.com/users/dhrupadb/events{/privacy}","received_events_url":"https://api.github.com/users/dhrupadb/received_events","type":"User","site_admin":false},"body":"Initial changes to support using the Stackdriver metadata agent.\r\n\r\n - Add configuration parameters for setting Metadata Agent URL and Metadata Agent port\r\n - Use host to query metadata endpoint (Doesn't actually use the value at this time, just makes it available during MonitoredResource creation)\r\n - JSON parser for MonitoredResource response from Metadata Agent\r\n - Uses existing functionality to create a MonitoredResource in case Metadata agent is unavailable.","created_at":"2017-02-22T17:57:37Z","updated_at":"2017-04-13T22:35:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5e0e40193e1a2bfb9aeaa3f23e303a99f31cab9c","assignee":{"login":"rbuskens","id":6616961,"avatar_url":"https://avatars2.githubusercontent.com/u/6616961?v=3","gravatar_id":"","url":"https://api.github.com/users/rbuskens","html_url":"https://github.com/rbuskens","followers_url":"https://api.github.com/users/rbuskens/followers","following_url":"https://api.github.com/users/rbuskens/following{/other_user}","gists_url":"https://api.github.com/users/rbuskens/gists{/gist_id}","starred_url":"https://api.github.com/users/rbuskens/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rbuskens/subscriptions","organizations_url":"https://api.github.com/users/rbuskens/orgs","repos_url":"https://api.github.com/users/rbuskens/repos","events_url":"https://api.github.com/users/rbuskens/events{/privacy}","received_events_url":"https://api.github.com/users/rbuskens/received_events","type":"User","site_admin":false},"assignees":[{"login":"rbuskens","id":6616961,"avatar_url":"https://avatars2.githubusercontent.com/u/6616961?v=3","gravatar_id":"","url":"https://api.github.com/users/rbuskens","html_url":"https://github.com/rbuskens","followers_url":"https://api.github.com/users/rbuskens/followers","following_url":"https://api.github.com/users/rbuskens/following{/other_user}","gists_url":"https://api.github.com/users/rbuskens/gists{/gist_id}","starred_url":"https://api.github.com/users/rbuskens/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rbuskens/subscriptions","organizations_url":"https://api.github.com/users/rbuskens/orgs","repos_url":"https://api.github.com/users/rbuskens/repos","events_url":"https://api.github.com/users/rbuskens/events{/privacy}","received_events_url":"https://api.github.com/users/rbuskens/received_events","type":"User","site_admin":false},{"login":"igorpeshansky","id":7594381,"avatar_url":"https://avatars2.githubusercontent.com/u/7594381?v=3","gravatar_id":"","url":"https://api.github.com/users/igorpeshansky","html_url":"https://github.com/igorpeshansky","followers_url":"https://api.github.com/users/igorpeshansky/followers","following_url":"https://api.github.com/users/igorpeshansky/following{/other_user}","gists_url":"https://api.github.com/users/igorpeshansky/gists{/gist_id}","starred_url":"https://api.github.com/users/igorpeshansky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/igorpeshansky/subscriptions","organizations_url":"https://api.github.com/users/igorpeshansky/orgs","repos_url":"https://api.github.com/users/igorpeshansky/repos","events_url":"https://api.github.com/users/igorpeshansky/events{/privacy}","received_events_url":"https://api.github.com/users/igorpeshansky/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/Stackdriver/collectd/pulls/95/commits","review_comments_url":"https://api.github.com/repos/Stackdriver/collectd/pulls/95/comments","review_comment_url":"https://api.github.com/repos/Stackdriver/collectd/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Stackdriver/collectd/issues/95/comments","statuses_url":"https://api.github.com/repos/Stackdriver/collectd/statuses/236f56340a9c5797dd7b0c42e335678f36ac50be","head":{"label":"Stackdriver:dhrupadb-metadata-agent-support","ref":"dhrupadb-metadata-agent-support","sha":"236f56340a9c5797dd7b0c42e335678f36ac50be","user":{"login":"Stackdriver","id":2104369,"avatar_url":"https://avatars0.githubusercontent.com/u/2104369?v=3","gravatar_id":"","url":"https://api.github.com/users/Stackdriver","html_url":"https://github.com/Stackdriver","followers_url":"https://api.github.com/users/Stackdriver/followers","following_url":"https://api.github.com/users/Stackdriver/following{/other_user}","gists_url":"https://api.github.com/users/Stackdriver/gists{/gist_id}","starred_url":"https://api.github.com/users/Stackdriver/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Stackdriver/subscriptions","organizations_url":"https://api.github.com/users/Stackdriver/orgs","repos_url":"https://api.github.com/users/Stackdriver/repos","events_url":"https://api.github.com/users/Stackdriver/events{/privacy}","received_events_url":"https://api.github.com/users/Stackdriver/received_events","type":"Organization","site_admin":false},"repo":{"id":11033551,"name":"collectd","full_name":"Stackdriver/collectd","owner":{"login":"Stackdriver","id":2104369,"avatar_url":"https://avatars0.githubusercontent.com/u/2104369?v=3","gravatar_id":"","url":"https://api.github.com/users/Stackdriver","html_url":"https://github.com/Stackdriver","followers_url":"https://api.github.com/users/Stackdriver/followers","following_url":"https://api.github.com/users/Stackdriver/following{/other_user}","gists_url":"https://api.github.com/users/Stackdriver/gists{/gist_id}","starred_url":"https://api.github.com/users/Stackdriver/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Stackdriver/subscriptions","organizations_url":"https://api.github.com/users/Stackdriver/orgs","repos_url":"https://api.github.com/users/Stackdriver/repos","events_url":"https://api.github.com/users/Stackdriver/events{/privacy}","received_events_url":"https://api.github.com/users/Stackdriver/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Stackdriver/collectd","description":"The system statistics collection daemon. Mirror of the canonical repository (updated hourly), but feel free to send Pull Requests!","fork":true,"url":"https://api.github.com/repos/Stackdriver/collectd","forks_url":"https://api.github.com/repos/Stackdriver/collectd/forks","keys_url":"https://api.github.com/repos/Stackdriver/collectd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Stackdriver/collectd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Stackdriver/collectd/teams","hooks_url":"https://api.github.com/repos/Stackdriver/collectd/hooks","issue_events_url":"https://api.github.com/repos/Stackdriver/collectd/issues/events{/number}","events_url":"https://api.github.com/repos/Stackdriver/collectd/events","assignees_url":"https://api.github.com/repos/Stackdriver/collectd/assignees{/user}","branches_url":"https://api.github.com/repos/Stackdriver/collectd/branches{/branch}","tags_url":"https://api.github.com/repos/Stackdriver/collectd/tags","blobs_url":"https://api.github.com/repos/Stackdriver/collectd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Stackdriver/collectd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Stackdriver/collectd/git/refs{/sha}","trees_url":"https://api.github.com/repos/Stackdriver/collectd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Stackdriver/collectd/statuses/{sha}","languages_url":"https://api.github.com/repos/Stackdriver/collectd/languages","stargazers_url":"https://api.github.com/repos/Stackdriver/collectd/stargazers","contributors_url":"https://api.github.com/repos/Stackdriver/collectd/contributors","subscribers_url":"https://api.github.com/repos/Stackdriver/collectd/subscribers","subscription_url":"https://api.github.com/repos/Stackdriver/collectd/subscription","commits_url":"https://api.github.com/repos/Stackdriver/collectd/commits{/sha}","git_commits_url":"https://api.github.com/repos/Stackdriver/collectd/git/commits{/sha}","comments_url":"https://api.github.com/repos/Stackdriver/collectd/comments{/number}","issue_comment_url":"https://api.github.com/repos/Stackdriver/collectd/issues/comments{/number}","contents_url":"https://api.github.com/repos/Stackdriver/collectd/contents/{+path}","compare_url":"https://api.github.com/repos/Stackdriver/collectd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Stackdriver/collectd/merges","archive_url":"https://api.github.com/repos/Stackdriver/collectd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Stackdriver/collectd/downloads","issues_url":"https://api.github.com/repos/Stackdriver/collectd/issues{/number}","pulls_url":"https://api.github.com/repos/Stackdriver/collectd/pulls{/number}","milestones_url":"https://api.github.com/repos/Stackdriver/collectd/milestones{/number}","notifications_url":"https://api.github.com/repos/Stackdriver/collectd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Stackdriver/collectd/labels{/name}","releases_url":"https://api.github.com/repos/Stackdriver/collectd/releases{/id}","deployments_url":"https://api.github.com/repos/Stackdriver/collectd/deployments","created_at":"2013-06-28T17:55:42Z","updated_at":"2017-03-25T01:25:50Z","pushed_at":"2017-04-12T17:13:37Z","git_url":"git://github.com/Stackdriver/collectd.git","ssh_url":"git@github.com:Stackdriver/collectd.git","clone_url":"https://github.com/Stackdriver/collectd.git","svn_url":"https://github.com/Stackdriver/collectd","homepage":"http://collectd.org/","size":27544,"stargazers_count":19,"watchers_count":19,"language":"C","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":3,"forks":4,"open_issues":3,"watchers":19,"default_branch":"stackdriver-agent-5.5.2"}},"base":{"label":"Stackdriver:stackdriver-agent-5.5.2","ref":"stackdriver-agent-5.5.2","sha":"bab95e10693ca375aaf8a85322562f0f0b4c2e44","user":{"login":"Stackdriver","id":2104369,"avatar_url":"https://avatars0.githubusercontent.com/u/2104369?v=3","gravatar_id":"","url":"https://api.github.com/users/Stackdriver","html_url":"https://github.com/Stackdriver","followers_url":"https://api.github.com/users/Stackdriver/followers","following_url":"https://api.github.com/users/Stackdriver/following{/other_user}","gists_url":"https://api.github.com/users/Stackdriver/gists{/gist_id}","starred_url":"https://api.github.com/users/Stackdriver/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Stackdriver/subscriptions","organizations_url":"https://api.github.com/users/Stackdriver/orgs","repos_url":"https://api.github.com/users/Stackdriver/repos","events_url":"https://api.github.com/users/Stackdriver/events{/privacy}","received_events_url":"https://api.github.com/users/Stackdriver/received_events","type":"Organization","site_admin":false},"repo":{"id":11033551,"name":"collectd","full_name":"Stackdriver/collectd","owner":{"login":"Stackdriver","id":2104369,"avatar_url":"https://avatars0.githubusercontent.com/u/2104369?v=3","gravatar_id":"","url":"https://api.github.com/users/Stackdriver","html_url":"https://github.com/Stackdriver","followers_url":"https://api.github.com/users/Stackdriver/followers","following_url":"https://api.github.com/users/Stackdriver/following{/other_user}","gists_url":"https://api.github.com/users/Stackdriver/gists{/gist_id}","starred_url":"https://api.github.com/users/Stackdriver/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Stackdriver/subscriptions","organizations_url":"https://api.github.com/users/Stackdriver/orgs","repos_url":"https://api.github.com/users/Stackdriver/repos","events_url":"https://api.github.com/users/Stackdriver/events{/privacy}","received_events_url":"https://api.github.com/users/Stackdriver/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Stackdriver/collectd","description":"The system statistics collection daemon. Mirror of the canonical repository (updated hourly), but feel free to send Pull Requests!","fork":true,"url":"https://api.github.com/repos/Stackdriver/collectd","forks_url":"https://api.github.com/repos/Stackdriver/collectd/forks","keys_url":"https://api.github.com/repos/Stackdriver/collectd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Stackdriver/collectd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Stackdriver/collectd/teams","hooks_url":"https://api.github.com/repos/Stackdriver/collectd/hooks","issue_events_url":"https://api.github.com/repos/Stackdriver/collectd/issues/events{/number}","events_url":"https://api.github.com/repos/Stackdriver/collectd/events","assignees_url":"https://api.github.com/repos/Stackdriver/collectd/assignees{/user}","branches_url":"https://api.github.com/repos/Stackdriver/collectd/branches{/branch}","tags_url":"https://api.github.com/repos/Stackdriver/collectd/tags","blobs_url":"https://api.github.com/repos/Stackdriver/collectd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Stackdriver/collectd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Stackdriver/collectd/git/refs{/sha}","trees_url":"https://api.github.com/repos/Stackdriver/collectd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Stackdriver/collectd/statuses/{sha}","languages_url":"https://api.github.com/repos/Stackdriver/collectd/languages","stargazers_url":"https://api.github.com/repos/Stackdriver/collectd/stargazers","contributors_url":"https://api.github.com/repos/Stackdriver/collectd/contributors","subscribers_url":"https://api.github.com/repos/Stackdriver/collectd/subscribers","subscription_url":"https://api.github.com/repos/Stackdriver/collectd/subscription","commits_url":"https://api.github.com/repos/Stackdriver/collectd/commits{/sha}","git_commits_url":"https://api.github.com/repos/Stackdriver/collectd/git/commits{/sha}","comments_url":"https://api.github.com/repos/Stackdriver/collectd/comments{/number}","issue_comment_url":"https://api.github.com/repos/Stackdriver/collectd/issues/comments{/number}","contents_url":"https://api.github.com/repos/Stackdriver/collectd/contents/{+path}","compare_url":"https://api.github.com/repos/Stackdriver/collectd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Stackdriver/collectd/merges","archive_url":"https://api.github.com/repos/Stackdriver/collectd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Stackdriver/collectd/downloads","issues_url":"https://api.github.com/repos/Stackdriver/collectd/issues{/number}","pulls_url":"https://api.github.com/repos/Stackdriver/collectd/pulls{/number}","milestones_url":"https://api.github.com/repos/Stackdriver/collectd/milestones{/number}","notifications_url":"https://api.github.com/repos/Stackdriver/collectd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Stackdriver/collectd/labels{/name}","releases_url":"https://api.github.com/repos/Stackdriver/collectd/releases{/id}","deployments_url":"https://api.github.com/repos/Stackdriver/collectd/deployments","created_at":"2013-06-28T17:55:42Z","updated_at":"2017-03-25T01:25:50Z","pushed_at":"2017-04-12T17:13:37Z","git_url":"git://github.com/Stackdriver/collectd.git","ssh_url":"git@github.com:Stackdriver/collectd.git","clone_url":"https://github.com/Stackdriver/collectd.git","svn_url":"https://github.com/Stackdriver/collectd","homepage":"http://collectd.org/","size":27544,"stargazers_count":19,"watchers_count":19,"language":"C","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":3,"forks":4,"open_issues":3,"watchers":19,"default_branch":"stackdriver-agent-5.5.2"}},"_links":{"self":{"href":"https://api.github.com/repos/Stackdriver/collectd/pulls/95"},"html":{"href":"https://github.com/Stackdriver/collectd/pull/95"},"issue":{"href":"https://api.github.com/repos/Stackdriver/collectd/issues/95"},"comments":{"href":"https://api.github.com/repos/Stackdriver/collectd/issues/95/comments"},"review_comments":{"href":"https://api.github.com/repos/Stackdriver/collectd/pulls/95/comments"},"review_comment":{"href":"https://api.github.com/repos/Stackdriver/collectd/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Stackdriver/collectd/pulls/95/commits"},"statuses":{"href":"https://api.github.com/repos/Stackdriver/collectd/statuses/236f56340a9c5797dd7b0c42e335678f36ac50be"}}}}
{"actor":{"display_login":"igorpeshansky"}}