{"action":"created","comment":{"url":"https://api.github.com/repos/UM-USElab/gradecraft-development/pulls/comments/54261281","id":54261281,"diff_hunk":"@@ -0,0 +1,29 @@\n+class ApplicationEventLogger < EventLogger::Base\n+  @queue = :application_event_logger\n+  @event_name = \"Application\"\n+\n+  attr_reader :event_session\n+\n+  # Used by enqueuing methods in EventLogger::Enqueue\n+  def event_type\n+    \"application\"\n+  end\n+\n+  # this is the default attribute set for EventLogger classes\n+  # should be extended in #attrs inside of child classes for better\n+  # granularity when more specific attributes are needed\n+  def base_attrs\n+    @base_attrs ||= {","path":"app/event_loggers/application_event_logger.rb","position":26,"original_position":16,"commit_id":"5bc5115e1dc60af27527d587cdee6dcc364ac3e7","original_commit_id":"72aac469a1374854f07651ec43dc6d0cf1e077b8","user":{"login":"jwright","id":35017,"avatar_url":"https://avatars.githubusercontent.com/u/35017?v=3","gravatar_id":"","url":"https://api.github.com/users/jwright","html_url":"https://github.com/jwright","followers_url":"https://api.github.com/users/jwright/followers","following_url":"https://api.github.com/users/jwright/following{/other_user}","gists_url":"https://api.github.com/users/jwright/gists{/gist_id}","starred_url":"https://api.github.com/users/jwright/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jwright/subscriptions","organizations_url":"https://api.github.com/users/jwright/orgs","repos_url":"https://api.github.com/users/jwright/repos","events_url":"https://api.github.com/users/jwright/events{/privacy}","received_events_url":"https://api.github.com/users/jwright/received_events","type":"User","site_admin":false},"body":":dancers:  I am cool with that. Thanks for looking into it.","created_at":"2016-02-26T15:59:32Z","updated_at":"2016-02-26T15:59:32Z","html_url":"https://github.com/UM-USElab/gradecraft-development/pull/1684#discussion_r54261281","pull_request_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/pulls/1684","_links":{"self":{"href":"https://api.github.com/repos/UM-USElab/gradecraft-development/pulls/comments/54261281"},"html":{"href":"https://github.com/UM-USElab/gradecraft-development/pull/1684#discussion_r54261281"},"pull_request":{"href":"https://api.github.com/repos/UM-USElab/gradecraft-development/pulls/1684"}}},"pull_request":{"url":"https://api.github.com/repos/UM-USElab/gradecraft-development/pulls/1684","id":60178997,"html_url":"https://github.com/UM-USElab/gradecraft-development/pull/1684","diff_url":"https://github.com/UM-USElab/gradecraft-development/pull/1684.diff","patch_url":"https://github.com/UM-USElab/gradecraft-development/pull/1684.patch","issue_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/issues/1684","number":1684,"state":"open","locked":false,"title":"Issue 1660: LoginEventLogger and EventLogger Extractions","user":{"login":"zazaian","id":95957,"avatar_url":"https://avatars.githubusercontent.com/u/95957?v=3","gravatar_id":"","url":"https://api.github.com/users/zazaian","html_url":"https://github.com/zazaian","followers_url":"https://api.github.com/users/zazaian/followers","following_url":"https://api.github.com/users/zazaian/following{/other_user}","gists_url":"https://api.github.com/users/zazaian/gists{/gist_id}","starred_url":"https://api.github.com/users/zazaian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zazaian/subscriptions","organizations_url":"https://api.github.com/users/zazaian/orgs","repos_url":"https://api.github.com/users/zazaian/repos","events_url":"https://api.github.com/users/zazaian/events{/privacy}","received_events_url":"https://api.github.com/users/zazaian/received_events","type":"User","site_admin":false},"body":"This pull request implements the following changes, and has been tested both through a mongo console and a redis console to confirm queuing and analytics event creation behaviors:\r\n\r\n* Adds `LoginEventLogger` to the `ApplicationController` for logging course login and user login behaviors. This PR also moves the definition of event-relevant attributes into the respective EventLogger classes rather than defining them in the controller. Instead, and `event_session` method is defined and passed into EventLogger classes to provide common context for events.\r\n\r\n* Similarly cleans up the EventLogger implementation in the `AnalyticsEventsController` by extracting event attributes and implementing an `event_session_with_params` method for passing relevant event data into `PredictorEventLogger` and `PageviewEventLogger`. Add fallback for each of these so that the event is directly inserted into Mongo in the event that Resque is unavailable.\r\n\r\n* Adds an `ApplicationEventLogger` for storing common application `base_attrs` that were being used by all EventLogger descendants but were being defined independently in various places across the app. Also implements a `params` method that handles attribute formatting for params passed in from controller actions.\r\n\r\n* Adds a `LoginEventLogger` class for logging course login and user login behaviors.\r\n\r\n* Extracts enqueuing behaviors from `PageviewEventLogger` and moves them into common EventLogger::Enqueue library in order to share them with other EventLogger classes. Adds logic for building `page` attribute inside of `PageviewEventLogger`.\r\n\r\n* Adds methods for building attributes from `event_session_with_params` inside of `PredictorEventLogger`, adds EventLogger::Enqueue behaviors to `PredictorEventLogger` to add Mongo fallback for predictor events.\r\n\r\n* Adds `Resque` job throttling for `login_event_logger` and `predictor_event_logger` queues.\r\n\r\n* Moves `EventLogger` to `EventLogger::Base`. Cleans up #perform method.\r\n\r\n* Adds `EventLogger::Enqueue` module for handling enqueuing behaviors for EventLogger instances. Move fallback from controllers into `#with_fallback` methods in `EventLogger::Enqueue`.\r\n\r\n* Adds an `EventLogger::Params` module for dynamically defining filtering methods for values that need to be taken from controller params and eventually logged to an Analytics::Event class.\r\n\r\n* Extracts @ivar subclass inheritance behaviors from EventLogger::Base and ResqueJob::Base into `InheritableIvars` module, and re-implement in those classes with the module.\r\n\r\n* Extracts `Logglier` logging behaviors from EventLogger::Base and ResqueJob::Base into `LogglyResque` module, and re-implement in those classes with the module. Move the definition of the `Logglier` tag into `/config/initializers/loggly.rb` and re-define inside of `LOGGLY_CONFIG` constant.\r\n\r\n* Moves the `Lull` module out of the `EventHelpers` and into `/lib`. Re-implements methods on `Lull` as class methods rather than instance methods intended for inheritance. Replace instances of `Lull` inclusion with direct usage of `Lull` in `ApplicationController` and `AnalyticsEventsController`.\r\n\r\n* Adds a spec for the `AnalyticsEventsController` (there wasn't one previously).\r\n\r\n* Refactor the spec for event logging behaviors in `ApplicationController` after moving most of the event logging behaviors back into the EventLogger module.\r\n\r\n* Adds a simple spec for the `UserSessionsController` (there wasn't one previously).\r\n\r\n* Adds specs for all `EventLogger` subclasses.\r\n\r\n* Updates or adds specs for all `EventLogger` vendor library classes and modules, and extracts common examples into SharedExample toolkits, moves context into `Toolkit` definitions, and defines test classes in `/spec/support/test_classes` rather than in the spec itself.\r\n\r\n* Removes `rails_spec_helper` and `active_record_spec_helper` where possible in the EventLogger workflow and replace with explicit requirement and inclusion of all necessary test support files.","created_at":"2016-02-22T14:17:29Z","updated_at":"2016-02-26T15:59:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"40e702895d1ee3429d250e8aa3a888bd1f4e7cc1","assignee":{"login":"zazaian","id":95957,"avatar_url":"https://avatars.githubusercontent.com/u/95957?v=3","gravatar_id":"","url":"https://api.github.com/users/zazaian","html_url":"https://github.com/zazaian","followers_url":"https://api.github.com/users/zazaian/followers","following_url":"https://api.github.com/users/zazaian/following{/other_user}","gists_url":"https://api.github.com/users/zazaian/gists{/gist_id}","starred_url":"https://api.github.com/users/zazaian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zazaian/subscriptions","organizations_url":"https://api.github.com/users/zazaian/orgs","repos_url":"https://api.github.com/users/zazaian/repos","events_url":"https://api.github.com/users/zazaian/events{/privacy}","received_events_url":"https://api.github.com/users/zazaian/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/pulls/1684/commits","review_comments_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/pulls/1684/comments","review_comment_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/pulls/comments{/number}","comments_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/issues/1684/comments","statuses_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/statuses/5bc5115e1dc60af27527d587cdee6dcc364ac3e7","head":{"label":"UM-USElab:1660-finally_event_logger_for_login_events","ref":"1660-finally_event_logger_for_login_events","sha":"5bc5115e1dc60af27527d587cdee6dcc364ac3e7","user":{"login":"UM-USElab","id":4459066,"avatar_url":"https://avatars.githubusercontent.com/u/4459066?v=3","gravatar_id":"","url":"https://api.github.com/users/UM-USElab","html_url":"https://github.com/UM-USElab","followers_url":"https://api.github.com/users/UM-USElab/followers","following_url":"https://api.github.com/users/UM-USElab/following{/other_user}","gists_url":"https://api.github.com/users/UM-USElab/gists{/gist_id}","starred_url":"https://api.github.com/users/UM-USElab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UM-USElab/subscriptions","organizations_url":"https://api.github.com/users/UM-USElab/orgs","repos_url":"https://api.github.com/users/UM-USElab/repos","events_url":"https://api.github.com/users/UM-USElab/events{/privacy}","received_events_url":"https://api.github.com/users/UM-USElab/received_events","type":"Organization","site_admin":false},"repo":{"id":8105769,"name":"gradecraft-development","full_name":"UM-USElab/gradecraft-development","owner":{"login":"UM-USElab","id":4459066,"avatar_url":"https://avatars.githubusercontent.com/u/4459066?v=3","gravatar_id":"","url":"https://api.github.com/users/UM-USElab","html_url":"https://github.com/UM-USElab","followers_url":"https://api.github.com/users/UM-USElab/followers","following_url":"https://api.github.com/users/UM-USElab/following{/other_user}","gists_url":"https://api.github.com/users/UM-USElab/gists{/gist_id}","starred_url":"https://api.github.com/users/UM-USElab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UM-USElab/subscriptions","organizations_url":"https://api.github.com/users/UM-USElab/orgs","repos_url":"https://api.github.com/users/UM-USElab/repos","events_url":"https://api.github.com/users/UM-USElab/events{/privacy}","received_events_url":"https://api.github.com/users/UM-USElab/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/UM-USElab/gradecraft-development","description":"GradeCraft is a gameful learning management system, intended to help motivate students to be more engaged in their own learning.","fork":false,"url":"https://api.github.com/repos/UM-USElab/gradecraft-development","forks_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/forks","keys_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/keys{/key_id}","collaborators_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/teams","hooks_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/hooks","issue_events_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/issues/events{/number}","events_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/events","assignees_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/assignees{/user}","branches_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/branches{/branch}","tags_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/tags","blobs_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/git/refs{/sha}","trees_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/git/trees{/sha}","statuses_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/statuses/{sha}","languages_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/languages","stargazers_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/stargazers","contributors_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/contributors","subscribers_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/subscribers","subscription_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/subscription","commits_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/commits{/sha}","git_commits_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/git/commits{/sha}","comments_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/comments{/number}","issue_comment_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/issues/comments{/number}","contents_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/contents/{+path}","compare_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/compare/{base}...{head}","merges_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/merges","archive_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/downloads","issues_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/issues{/number}","pulls_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/pulls{/number}","milestones_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/milestones{/number}","notifications_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/labels{/name}","releases_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/releases{/id}","deployments_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/deployments","created_at":"2013-02-09T03:44:54Z","updated_at":"2016-01-27T18:03:56Z","pushed_at":"2016-02-25T23:23:02Z","git_url":"git://github.com/UM-USElab/gradecraft-development.git","ssh_url":"git@github.com:UM-USElab/gradecraft-development.git","clone_url":"https://github.com/UM-USElab/gradecraft-development.git","svn_url":"https://github.com/UM-USElab/gradecraft-development","homepage":"","size":65648,"stargazers_count":27,"watchers_count":27,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":17,"mirror_url":null,"open_issues_count":122,"forks":17,"open_issues":122,"watchers":27,"default_branch":"master"}},"base":{"label":"UM-USElab:master","ref":"master","sha":"ecc5891ffcefc1d34426cd4c8e103b5b6b77c0f5","user":{"login":"UM-USElab","id":4459066,"avatar_url":"https://avatars.githubusercontent.com/u/4459066?v=3","gravatar_id":"","url":"https://api.github.com/users/UM-USElab","html_url":"https://github.com/UM-USElab","followers_url":"https://api.github.com/users/UM-USElab/followers","following_url":"https://api.github.com/users/UM-USElab/following{/other_user}","gists_url":"https://api.github.com/users/UM-USElab/gists{/gist_id}","starred_url":"https://api.github.com/users/UM-USElab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UM-USElab/subscriptions","organizations_url":"https://api.github.com/users/UM-USElab/orgs","repos_url":"https://api.github.com/users/UM-USElab/repos","events_url":"https://api.github.com/users/UM-USElab/events{/privacy}","received_events_url":"https://api.github.com/users/UM-USElab/received_events","type":"Organization","site_admin":false},"repo":{"id":8105769,"name":"gradecraft-development","full_name":"UM-USElab/gradecraft-development","owner":{"login":"UM-USElab","id":4459066,"avatar_url":"https://avatars.githubusercontent.com/u/4459066?v=3","gravatar_id":"","url":"https://api.github.com/users/UM-USElab","html_url":"https://github.com/UM-USElab","followers_url":"https://api.github.com/users/UM-USElab/followers","following_url":"https://api.github.com/users/UM-USElab/following{/other_user}","gists_url":"https://api.github.com/users/UM-USElab/gists{/gist_id}","starred_url":"https://api.github.com/users/UM-USElab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UM-USElab/subscriptions","organizations_url":"https://api.github.com/users/UM-USElab/orgs","repos_url":"https://api.github.com/users/UM-USElab/repos","events_url":"https://api.github.com/users/UM-USElab/events{/privacy}","received_events_url":"https://api.github.com/users/UM-USElab/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/UM-USElab/gradecraft-development","description":"GradeCraft is a gameful learning management system, intended to help motivate students to be more engaged in their own learning.","fork":false,"url":"https://api.github.com/repos/UM-USElab/gradecraft-development","forks_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/forks","keys_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/keys{/key_id}","collaborators_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/teams","hooks_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/hooks","issue_events_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/issues/events{/number}","events_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/events","assignees_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/assignees{/user}","branches_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/branches{/branch}","tags_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/tags","blobs_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/git/refs{/sha}","trees_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/git/trees{/sha}","statuses_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/statuses/{sha}","languages_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/languages","stargazers_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/stargazers","contributors_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/contributors","subscribers_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/subscribers","subscription_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/subscription","commits_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/commits{/sha}","git_commits_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/git/commits{/sha}","comments_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/comments{/number}","issue_comment_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/issues/comments{/number}","contents_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/contents/{+path}","compare_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/compare/{base}...{head}","merges_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/merges","archive_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/downloads","issues_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/issues{/number}","pulls_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/pulls{/number}","milestones_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/milestones{/number}","notifications_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/labels{/name}","releases_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/releases{/id}","deployments_url":"https://api.github.com/repos/UM-USElab/gradecraft-development/deployments","created_at":"2013-02-09T03:44:54Z","updated_at":"2016-01-27T18:03:56Z","pushed_at":"2016-02-25T23:23:02Z","git_url":"git://github.com/UM-USElab/gradecraft-development.git","ssh_url":"git@github.com:UM-USElab/gradecraft-development.git","clone_url":"https://github.com/UM-USElab/gradecraft-development.git","svn_url":"https://github.com/UM-USElab/gradecraft-development","homepage":"","size":65648,"stargazers_count":27,"watchers_count":27,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":17,"mirror_url":null,"open_issues_count":122,"forks":17,"open_issues":122,"watchers":27,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/UM-USElab/gradecraft-development/pulls/1684"},"html":{"href":"https://github.com/UM-USElab/gradecraft-development/pull/1684"},"issue":{"href":"https://api.github.com/repos/UM-USElab/gradecraft-development/issues/1684"},"comments":{"href":"https://api.github.com/repos/UM-USElab/gradecraft-development/issues/1684/comments"},"review_comments":{"href":"https://api.github.com/repos/UM-USElab/gradecraft-development/pulls/1684/comments"},"review_comment":{"href":"https://api.github.com/repos/UM-USElab/gradecraft-development/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/UM-USElab/gradecraft-development/pulls/1684/commits"},"statuses":{"href":"https://api.github.com/repos/UM-USElab/gradecraft-development/statuses/5bc5115e1dc60af27527d587cdee6dcc364ac3e7"}}}}