{"action":"created","comment":{"url":"https://api.github.com/repos/chef/chef-rfc/pulls/comments/29864967","id":29864967,"diff_hunk":"@@ -0,0 +1,94 @@\n+---\n+RFC: unassigned\n+Author: Ranjib Dey <ranjib@linux.com>\n+Status: Draft\n+Type: Standards Track\n+---\n+\n+# Title\n+\n+Chef telemetry\n+\n+## Motivation\n+\n+  As a chef user and developer\n+  I want an easy way to get chef run performance data\n+  so that I can identify areas that can be optimized\n+\n+As we automate more things with chef and control more system resources,\n+chef run time increases, and the chef client process consumes more memory and cpu.\n+As a configuration management system, it is important that a chef run\n+does not impact the underlying host performance. Over the last few years\n+Chef community has shared a number of optimization techniques. Aim of this\n+RFC is to facilitate some of those common patterns by providing a robust\n+telemetry system in core chef. If configured, the telemetry system will give users fine\n+grained metrics about chef run that can be used to find out\n+performance hiccups. This will also help users quantify how a chef\n+run impacts the underlying system.\n+\n+## Specification\n+\n+Telemetry module will provide following metrics:\n+\n+- Time spent on key chef run milestones: How long does the chef run take for each stage? Telemetry system\n+  will declare  a subset of the current events as major milestones, these are: run_start,\n+  ohai_completed, node_load_completed, cookbook_resolution_complete, converge_start,\n+  converge_complete, run_completed/failed. Metrics will be captured during these milestones via event handlers.\n+  This can be used to estimate time spent on cookbook sync, compilation\n+  convergence phase etc.\n+\n+- Time spent on individual resource & recipe convergence. This information is already available\n+  using the API, telemetry system will just consolidate them, along side the other metrics.\n+\n+- GC related data. Ruby's internal memory usage obtained from\n+  GC.stat, captured during the chef run milestones.\n+\n+Telemetry system will also let users define their custom metrics that can be computed\n+during these milestones (like total chef client process memory consumption from /proc/PID),\n+This will be offered via Chef class DSL. This will also be the recommended way to implement platform\n+specific metrics. Example:\n+\n+```ruby\n+require 'sys/proctable'\n+\n+Chef.telemetry do |telemetry|\n+  telemetry.add_metric 'vsize' do\n+    Sys::ProcTable.ps(Process.pid).vsize\n+  end\n+end\n+```\n+\n+In addition to capturing these metrics, telemetry system will also allow publishing\n+them via statsd or saving them as node attribute.\n+\n+Telemetry sysetm can be configured via the standard chef config file or using a dedicated\n+CLI flag for chef-client and chef-solo. It will be disabled by default.\n+Following is an example of configuring the telemetry subsystem\n+\n+```ruby\n+\n+enable_telemetry true\n+\n+config_context(:telemetry) do\n+  resource true # captures per resource execution time taken\n+  recipe true # captures per recipe execution time taken\n+  gc true # captures GC stats during main chef events\n+  process true  # captures process memroy stats from /proc during main chef events\n+  client_run true # captures time spent on major chef run milstones\n+  statsd( host: '192.168.2.11', port: 7676) # emit data to statsd\n+  attribute 'chef-metrics' # save all metrics under node['chef-metrics'] attribute\n+end\n+```\n+Eaxmple of enabling telemetry using the CLI flag","path":"new/rfcXXX-telemetry.md","position":82,"original_position":82,"commit_id":"6edb66cd1d779d005af9e2e82032985ee3a92e26","original_commit_id":"6edb66cd1d779d005af9e2e82032985ee3a92e26","user":{"login":"miketheman","id":529516,"avatar_url":"https://avatars.githubusercontent.com/u/529516?v=3","gravatar_id":"","url":"https://api.github.com/users/miketheman","html_url":"https://github.com/miketheman","followers_url":"https://api.github.com/users/miketheman/followers","following_url":"https://api.github.com/users/miketheman/following{/other_user}","gists_url":"https://api.github.com/users/miketheman/gists{/gist_id}","starred_url":"https://api.github.com/users/miketheman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miketheman/subscriptions","organizations_url":"https://api.github.com/users/miketheman/orgs","repos_url":"https://api.github.com/users/miketheman/repos","events_url":"https://api.github.com/users/miketheman/events{/privacy}","received_events_url":"https://api.github.com/users/miketheman/received_events","type":"User","site_admin":false},"body":"typo: Example","created_at":"2015-05-07T15:45:50Z","updated_at":"2015-05-07T15:45:50Z","html_url":"https://github.com/chef/chef-rfc/pull/120#discussion_r29864967","pull_request_url":"https://api.github.com/repos/chef/chef-rfc/pulls/120","_links":{"self":{"href":"https://api.github.com/repos/chef/chef-rfc/pulls/comments/29864967"},"html":{"href":"https://github.com/chef/chef-rfc/pull/120#discussion_r29864967"},"pull_request":{"href":"https://api.github.com/repos/chef/chef-rfc/pulls/120"}}},"pull_request":{"url":"https://api.github.com/repos/chef/chef-rfc/pulls/120","id":34024465,"html_url":"https://github.com/chef/chef-rfc/pull/120","diff_url":"https://github.com/chef/chef-rfc/pull/120.diff","patch_url":"https://github.com/chef/chef-rfc/pull/120.patch","issue_url":"https://api.github.com/repos/chef/chef-rfc/issues/120","number":120,"state":"open","locked":false,"title":"Telemetry subsystem : Capture and expose chef run performance metrics","user":{"login":"ranjib","id":316306,"avatar_url":"https://avatars.githubusercontent.com/u/316306?v=3","gravatar_id":"","url":"https://api.github.com/users/ranjib","html_url":"https://github.com/ranjib","followers_url":"https://api.github.com/users/ranjib/followers","following_url":"https://api.github.com/users/ranjib/following{/other_user}","gists_url":"https://api.github.com/users/ranjib/gists{/gist_id}","starred_url":"https://api.github.com/users/ranjib/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ranjib/subscriptions","organizations_url":"https://api.github.com/users/ranjib/orgs","repos_url":"https://api.github.com/users/ranjib/repos","events_url":"https://api.github.com/users/ranjib/events{/privacy}","received_events_url":"https://api.github.com/users/ranjib/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-04-24T07:27:15Z","updated_at":"2015-05-07T15:45:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"655eab6a39d991005e80bcea0314d2f2f86403a8","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/chef/chef-rfc/pulls/120/commits","review_comments_url":"https://api.github.com/repos/chef/chef-rfc/pulls/120/comments","review_comment_url":"https://api.github.com/repos/chef/chef-rfc/pulls/comments{/number}","comments_url":"https://api.github.com/repos/chef/chef-rfc/issues/120/comments","statuses_url":"https://api.github.com/repos/chef/chef-rfc/statuses/6edb66cd1d779d005af9e2e82032985ee3a92e26","head":{"label":"ranjib:telemetry","ref":"telemetry","sha":"6edb66cd1d779d005af9e2e82032985ee3a92e26","user":{"login":"ranjib","id":316306,"avatar_url":"https://avatars.githubusercontent.com/u/316306?v=3","gravatar_id":"","url":"https://api.github.com/users/ranjib","html_url":"https://github.com/ranjib","followers_url":"https://api.github.com/users/ranjib/followers","following_url":"https://api.github.com/users/ranjib/following{/other_user}","gists_url":"https://api.github.com/users/ranjib/gists{/gist_id}","starred_url":"https://api.github.com/users/ranjib/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ranjib/subscriptions","organizations_url":"https://api.github.com/users/ranjib/orgs","repos_url":"https://api.github.com/users/ranjib/repos","events_url":"https://api.github.com/users/ranjib/events{/privacy}","received_events_url":"https://api.github.com/users/ranjib/received_events","type":"User","site_admin":false},"repo":{"id":17534516,"name":"chef-rfc","full_name":"ranjib/chef-rfc","owner":{"login":"ranjib","id":316306,"avatar_url":"https://avatars.githubusercontent.com/u/316306?v=3","gravatar_id":"","url":"https://api.github.com/users/ranjib","html_url":"https://github.com/ranjib","followers_url":"https://api.github.com/users/ranjib/followers","following_url":"https://api.github.com/users/ranjib/following{/other_user}","gists_url":"https://api.github.com/users/ranjib/gists{/gist_id}","starred_url":"https://api.github.com/users/ranjib/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ranjib/subscriptions","organizations_url":"https://api.github.com/users/ranjib/orgs","repos_url":"https://api.github.com/users/ranjib/repos","events_url":"https://api.github.com/users/ranjib/events{/privacy}","received_events_url":"https://api.github.com/users/ranjib/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ranjib/chef-rfc","description":"Public RFCs for Chef and related projects","fork":true,"url":"https://api.github.com/repos/ranjib/chef-rfc","forks_url":"https://api.github.com/repos/ranjib/chef-rfc/forks","keys_url":"https://api.github.com/repos/ranjib/chef-rfc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ranjib/chef-rfc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ranjib/chef-rfc/teams","hooks_url":"https://api.github.com/repos/ranjib/chef-rfc/hooks","issue_events_url":"https://api.github.com/repos/ranjib/chef-rfc/issues/events{/number}","events_url":"https://api.github.com/repos/ranjib/chef-rfc/events","assignees_url":"https://api.github.com/repos/ranjib/chef-rfc/assignees{/user}","branches_url":"https://api.github.com/repos/ranjib/chef-rfc/branches{/branch}","tags_url":"https://api.github.com/repos/ranjib/chef-rfc/tags","blobs_url":"https://api.github.com/repos/ranjib/chef-rfc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ranjib/chef-rfc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ranjib/chef-rfc/git/refs{/sha}","trees_url":"https://api.github.com/repos/ranjib/chef-rfc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ranjib/chef-rfc/statuses/{sha}","languages_url":"https://api.github.com/repos/ranjib/chef-rfc/languages","stargazers_url":"https://api.github.com/repos/ranjib/chef-rfc/stargazers","contributors_url":"https://api.github.com/repos/ranjib/chef-rfc/contributors","subscribers_url":"https://api.github.com/repos/ranjib/chef-rfc/subscribers","subscription_url":"https://api.github.com/repos/ranjib/chef-rfc/subscription","commits_url":"https://api.github.com/repos/ranjib/chef-rfc/commits{/sha}","git_commits_url":"https://api.github.com/repos/ranjib/chef-rfc/git/commits{/sha}","comments_url":"https://api.github.com/repos/ranjib/chef-rfc/comments{/number}","issue_comment_url":"https://api.github.com/repos/ranjib/chef-rfc/issues/comments{/number}","contents_url":"https://api.github.com/repos/ranjib/chef-rfc/contents/{+path}","compare_url":"https://api.github.com/repos/ranjib/chef-rfc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ranjib/chef-rfc/merges","archive_url":"https://api.github.com/repos/ranjib/chef-rfc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ranjib/chef-rfc/downloads","issues_url":"https://api.github.com/repos/ranjib/chef-rfc/issues{/number}","pulls_url":"https://api.github.com/repos/ranjib/chef-rfc/pulls{/number}","milestones_url":"https://api.github.com/repos/ranjib/chef-rfc/milestones{/number}","notifications_url":"https://api.github.com/repos/ranjib/chef-rfc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ranjib/chef-rfc/labels{/name}","releases_url":"https://api.github.com/repos/ranjib/chef-rfc/releases{/id}","created_at":"2014-03-08T03:43:48Z","updated_at":"2015-01-15T17:19:08Z","pushed_at":"2015-04-24T19:15:49Z","git_url":"git://github.com/ranjib/chef-rfc.git","ssh_url":"git@github.com:ranjib/chef-rfc.git","clone_url":"https://github.com/ranjib/chef-rfc.git","svn_url":"https://github.com/ranjib/chef-rfc","homepage":null,"size":484,"stargazers_count":0,"watchers_count":0,"language":null,"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":"chef:master","ref":"master","sha":"8e437ede2d1ea94990a8d551ce711c07f18c5d29","user":{"login":"chef","id":29740,"avatar_url":"https://avatars.githubusercontent.com/u/29740?v=3","gravatar_id":"","url":"https://api.github.com/users/chef","html_url":"https://github.com/chef","followers_url":"https://api.github.com/users/chef/followers","following_url":"https://api.github.com/users/chef/following{/other_user}","gists_url":"https://api.github.com/users/chef/gists{/gist_id}","starred_url":"https://api.github.com/users/chef/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chef/subscriptions","organizations_url":"https://api.github.com/users/chef/orgs","repos_url":"https://api.github.com/users/chef/repos","events_url":"https://api.github.com/users/chef/events{/privacy}","received_events_url":"https://api.github.com/users/chef/received_events","type":"Organization","site_admin":false},"repo":{"id":15090814,"name":"chef-rfc","full_name":"chef/chef-rfc","owner":{"login":"chef","id":29740,"avatar_url":"https://avatars.githubusercontent.com/u/29740?v=3","gravatar_id":"","url":"https://api.github.com/users/chef","html_url":"https://github.com/chef","followers_url":"https://api.github.com/users/chef/followers","following_url":"https://api.github.com/users/chef/following{/other_user}","gists_url":"https://api.github.com/users/chef/gists{/gist_id}","starred_url":"https://api.github.com/users/chef/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chef/subscriptions","organizations_url":"https://api.github.com/users/chef/orgs","repos_url":"https://api.github.com/users/chef/repos","events_url":"https://api.github.com/users/chef/events{/privacy}","received_events_url":"https://api.github.com/users/chef/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/chef/chef-rfc","description":"Public RFCs for Chef and related projects","fork":false,"url":"https://api.github.com/repos/chef/chef-rfc","forks_url":"https://api.github.com/repos/chef/chef-rfc/forks","keys_url":"https://api.github.com/repos/chef/chef-rfc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/chef/chef-rfc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/chef/chef-rfc/teams","hooks_url":"https://api.github.com/repos/chef/chef-rfc/hooks","issue_events_url":"https://api.github.com/repos/chef/chef-rfc/issues/events{/number}","events_url":"https://api.github.com/repos/chef/chef-rfc/events","assignees_url":"https://api.github.com/repos/chef/chef-rfc/assignees{/user}","branches_url":"https://api.github.com/repos/chef/chef-rfc/branches{/branch}","tags_url":"https://api.github.com/repos/chef/chef-rfc/tags","blobs_url":"https://api.github.com/repos/chef/chef-rfc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/chef/chef-rfc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/chef/chef-rfc/git/refs{/sha}","trees_url":"https://api.github.com/repos/chef/chef-rfc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/chef/chef-rfc/statuses/{sha}","languages_url":"https://api.github.com/repos/chef/chef-rfc/languages","stargazers_url":"https://api.github.com/repos/chef/chef-rfc/stargazers","contributors_url":"https://api.github.com/repos/chef/chef-rfc/contributors","subscribers_url":"https://api.github.com/repos/chef/chef-rfc/subscribers","subscription_url":"https://api.github.com/repos/chef/chef-rfc/subscription","commits_url":"https://api.github.com/repos/chef/chef-rfc/commits{/sha}","git_commits_url":"https://api.github.com/repos/chef/chef-rfc/git/commits{/sha}","comments_url":"https://api.github.com/repos/chef/chef-rfc/comments{/number}","issue_comment_url":"https://api.github.com/repos/chef/chef-rfc/issues/comments{/number}","contents_url":"https://api.github.com/repos/chef/chef-rfc/contents/{+path}","compare_url":"https://api.github.com/repos/chef/chef-rfc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/chef/chef-rfc/merges","archive_url":"https://api.github.com/repos/chef/chef-rfc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/chef/chef-rfc/downloads","issues_url":"https://api.github.com/repos/chef/chef-rfc/issues{/number}","pulls_url":"https://api.github.com/repos/chef/chef-rfc/pulls{/number}","milestones_url":"https://api.github.com/repos/chef/chef-rfc/milestones{/number}","notifications_url":"https://api.github.com/repos/chef/chef-rfc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/chef/chef-rfc/labels{/name}","releases_url":"https://api.github.com/repos/chef/chef-rfc/releases{/id}","created_at":"2013-12-10T22:10:56Z","updated_at":"2015-05-05T20:06:37Z","pushed_at":"2015-05-04T23:57:47Z","git_url":"git://github.com/chef/chef-rfc.git","ssh_url":"git@github.com:chef/chef-rfc.git","clone_url":"https://github.com/chef/chef-rfc.git","svn_url":"https://github.com/chef/chef-rfc","homepage":null,"size":3760,"stargazers_count":81,"watchers_count":81,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":35,"mirror_url":null,"open_issues_count":14,"forks":35,"open_issues":14,"watchers":81,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/chef/chef-rfc/pulls/120"},"html":{"href":"https://github.com/chef/chef-rfc/pull/120"},"issue":{"href":"https://api.github.com/repos/chef/chef-rfc/issues/120"},"comments":{"href":"https://api.github.com/repos/chef/chef-rfc/issues/120/comments"},"review_comments":{"href":"https://api.github.com/repos/chef/chef-rfc/pulls/120/comments"},"review_comment":{"href":"https://api.github.com/repos/chef/chef-rfc/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/chef/chef-rfc/pulls/120/commits"},"statuses":{"href":"https://api.github.com/repos/chef/chef-rfc/statuses/6edb66cd1d779d005af9e2e82032985ee3a92e26"}}}}