Skip to content

Commit

Permalink
Send request_id and user_id to Sentry.
Browse files Browse the repository at this point in the history
  • Loading branch information
zacharydenton authored and aptos-bot committed May 12, 2022
1 parent e0ec46a commit 27a6b44
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class ApplicationController < ActionController::Base

before_action :set_csrf_cookie
before_action :set_logging_metadata
before_action :set_sentry_metadata

protect_from_forgery with: :exception

Expand Down Expand Up @@ -53,4 +54,9 @@ def set_logging_metadata
Thread.current.thread_variable_set(REQUEST_ID_KEY, request.request_id)
Thread.current.thread_variable_set(USER_ID_KEY, current_user&.id)
end

def set_sentry_metadata
Sentry.set_user(id: current_user.id) if current_user
Sentry.set_tags(request_id: request.request_id)
end
end

0 comments on commit 27a6b44

Please sign in to comment.