{"action":"created","issue":{"url":"https://api.github.com/repos/edx/edx-platform/issues/13809","repository_url":"https://api.github.com/repos/edx/edx-platform","labels_url":"https://api.github.com/repos/edx/edx-platform/issues/13809/labels{/name}","comments_url":"https://api.github.com/repos/edx/edx-platform/issues/13809/comments","events_url":"https://api.github.com/repos/edx/edx-platform/issues/13809/events","html_url":"https://github.com/edx/edx-platform/pull/13809","id":184489406,"number":13809,"title":"Instrument UserStateClient with New Relic","user":{"login":"pwnage101","id":85151,"avatar_url":"https://avatars.githubusercontent.com/u/85151?v=3","gravatar_id":"","url":"https://api.github.com/users/pwnage101","html_url":"https://github.com/pwnage101","followers_url":"https://api.github.com/users/pwnage101/followers","following_url":"https://api.github.com/users/pwnage101/following{/other_user}","gists_url":"https://api.github.com/users/pwnage101/gists{/gist_id}","starred_url":"https://api.github.com/users/pwnage101/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pwnage101/subscriptions","organizations_url":"https://api.github.com/users/pwnage101/orgs","repos_url":"https://api.github.com/users/pwnage101/repos","events_url":"https://api.github.com/users/pwnage101/events{/privacy}","received_events_url":"https://api.github.com/users/pwnage101/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":9,"created_at":"2016-10-21T13:48:18Z","updated_at":"2016-11-03T14:40:35Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/edx/edx-platform/pulls/13809","html_url":"https://github.com/edx/edx-platform/pull/13809","diff_url":"https://github.com/edx/edx-platform/pull/13809.diff","patch_url":"https://github.com/edx/edx-platform/pull/13809.patch"},"body":"~~currently WIP~~\r\n\r\n2016-10-31 edit: this is in a reviewable state now.\r\n\r\nThis PR adds NR instrumentation to the DjangoXBlockUserStateClient by reporting request- and request/blocktype-level stats about blocks touched in the set_many and get_many calls.  It also reports the total time spent in these calls during a request.  Here is a sample of the new attributes generated during an LMS load test, plus my manual fiddling in the browser:\r\n\r\n```\r\nxb_user_state.get_many.chapter.count\r\nxb_user_state.get_many.chapter.size\r\nxb_user_state.get_many.count\r\nxb_user_state.get_many.course.count\r\nxb_user_state.get_many.course.size\r\nxb_user_state.get_many.duration\r\nxb_user_state.get_many.problem.count\r\nxb_user_state.get_many.problem.size\r\nxb_user_state.get_many.sequential.count\r\nxb_user_state.get_many.sequential.size\r\nxb_user_state.get_many.size\r\nxb_user_state.get_many.video.count\r\nxb_user_state.get_many.video.size\r\nxb_user_state.set_many.chapter.count\r\nxb_user_state.set_many.chapter.size\r\nxb_user_state.set_many.count\r\nxb_user_state.set_many.course.count\r\nxb_user_state.set_many.course.size\r\nxb_user_state.set_many.duration\r\nxb_user_state.set_many.problem.count\r\nxb_user_state.set_many.problem.size\r\nxb_user_state.set_many.sequential.count\r\nxb_user_state.set_many.sequential.size\r\nxb_user_state.set_many.size\r\nxb_user_state.set_many.video.count\r\nxb_user_state.set_many.video.size\r\n```\r\n\r\n## quick testing:\r\n\r\nlooking at set_many calls:\r\n```\r\nSELECT sum(`xb_user_state.set_many.count`), sum(`xb_user_state.set_many.duration`) FROM Transaction   WHERE  appName='sandbox-pwnage101-edxapp-lms' TIMESERIES 5 seconds SINCE '2016-10-31 16:08:00+0000' UNTIL '2016-10-31 16:20:00+0000'\r\n```\r\n[![2016-10-31-132811_638x301_scrot](https://cloud.githubusercontent.com/assets/85151/19868559/f6ee6b62-9f7e-11e6-925f-508a86b15fc4.png)](https://insights.newrelic.com/accounts/1391042/query?hello=overview&query=SELECT%20sum%28`xb_user_state.set_many.count`%29,%20sum%28`xb_user_state.set_many.duration`%29%20FROM%20Transaction%20%20%20WHERE%20%20appName%3D%27sandbox-pwnage101-edxapp-lms%27%20TIMESERIES%205%20seconds%20SINCE%20%272016-10-31%2016:08:00%2B0000%27%20UNTIL%20%272016-10-31%2016:20:00%2B0000%27)\r\n\r\nlooking at get_many calls:\r\n```\r\nSELECT sum(`xb_user_state.get_many.count`), sum(`xb_user_state.get_many.duration`) FROM Transaction   WHERE  appName='sandbox-pwnage101-edxapp-lms' TIMESERIES 5 seconds SINCE '2016-10-31 16:08:00+0000' UNTIL '2016-10-31 16:20:00+0000'\r\n```\r\n[![2016-10-31-132514_642x303_scrot](https://cloud.githubusercontent.com/assets/85151/19868558/f6ea359c-9f7e-11e6-8488-63f0ddd480f8.png)](https://insights.newrelic.com/accounts/1391042/query?hello=overview&query=SELECT%20sum%28`xb_user_state.get_many.count`%29,%20sum%28`xb_user_state.get_many.duration`%29%20FROM%20Transaction%20%20%20WHERE%20%20appName%3D%27sandbox-pwnage101-edxapp-lms%27%20TIMESERIES%205%20seconds%20SINCE%20%272016-10-31%2016:08:00%2B0000%27%20UNTIL%20%272016-10-31%2016:20:00%2B0000%27)\r\n\r\nThe get_many graph suggests that the current LMS load test causes regular get_many calls, but does not feed it any usage keys (hence the zero block count).  The non-zero block count spikes are from me manually loading a courseware page in my browser.\r\n\r\n@ormsbee @tobz "},"comment":{"url":"https://api.github.com/repos/edx/edx-platform/issues/comments/258161313","html_url":"https://github.com/edx/edx-platform/pull/13809#issuecomment-258161313","issue_url":"https://api.github.com/repos/edx/edx-platform/issues/13809","id":258161313,"user":{"login":"ormsbee","id":41625,"avatar_url":"https://avatars.githubusercontent.com/u/41625?v=3","gravatar_id":"","url":"https://api.github.com/users/ormsbee","html_url":"https://github.com/ormsbee","followers_url":"https://api.github.com/users/ormsbee/followers","following_url":"https://api.github.com/users/ormsbee/following{/other_user}","gists_url":"https://api.github.com/users/ormsbee/gists{/gist_id}","starred_url":"https://api.github.com/users/ormsbee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ormsbee/subscriptions","organizations_url":"https://api.github.com/users/ormsbee/orgs","repos_url":"https://api.github.com/users/ormsbee/repos","events_url":"https://api.github.com/users/ormsbee/events{/privacy}","received_events_url":"https://api.github.com/users/ormsbee/received_events","type":"User","site_admin":false},"created_at":"2016-11-03T14:40:35Z","updated_at":"2016-11-03T14:40:35Z","body":"Yup, LGTM!"}}
{"actor":{"display_login":"ormsbee"}}