Skip to content

frontend: implement event logging and run in parallel

Administrator requested to merge jc/event-logging into master

Created by: unknwon

Implement event logging feature requested in https://github.com/sourcegraph/sourcegraph/issues/5486.

Changes in this PR:

  • Created DB event_logs and insertion logic
  • Updated GraphQL logUserEvent to accept new parameters
  • Added a goroutine to delete rows in event_logs after 93 days, and check every hour
  • Added a feature flag EventLogging with default enabled

Test plan:

  • Unit tests
  • Manual testing
    • GraphQL API console
     mutation logEvent($event: String!, $userCookieID: String!, $url: String!, $source: UserEventSource!, $argument: String) {
       logEvent(event: $event, userCookieID: $userCookieID, url: $url, source: $source, argument: $argument) {
         alwaysNil
       }
     }
     		
     {
     	"event": "test_event",
     	"userCookieID": "AAABBBCCCDDD",
     	"url": "http://localhost:3080/api/console",
     	"source": "WEB"
     }
    • Trigger log action via browsing

Merge request reports

Loading