newrelic: fix tracking of api auth failure errors.

Fixes user params not being recorded on SessionLoader::AuthenticationFailed errors.
This commit is contained in:
evazion
2019-08-27 21:19:56 -05:00
parent 57e20b4e28
commit 0cf9f845d0
3 changed files with 12 additions and 6 deletions

View File

@@ -29,7 +29,8 @@ class SessionLoader
set_safe_mode
set_started_at_session
CurrentUser.user.unban! if CurrentUser.user.ban_expired?
DanbooruLogger.initialize(request, session, CurrentUser.user)
ensure
DanbooruLogger.add_session_attributes(request, session, CurrentUser.user)
end
def has_api_authentication?
@@ -58,6 +59,7 @@ private
def authenticate_basic_auth
credentials = ::Base64.decode64(request.authorization.split(' ', 2).last || '')
login, api_key = credentials.split(/:/, 2)
DanbooruLogger.add_attributes("request.params", login: login)
authenticate_api_key(login, api_key)
end