Add new relic metrics (#26003)

This commit is contained in:
Zainab Amir
2021-01-07 18:08:09 +05:00
committed by GitHub
parent d9174fc0db
commit aa3119e4d7
2 changed files with 11 additions and 1 deletions

View File

@@ -467,6 +467,8 @@ def login_user(request):
except AuthFailedError as e:
set_custom_attribute('login_user_tpa_success', False)
set_custom_attribute('login_user_tpa_failure_msg', e.value)
if e.error_code:
set_custom_attribute('login_error_code', e.error_code)
# user successfully authenticated with a third party provider, but has no linked Open edX account
response_content = e.get_response()
@@ -512,7 +514,12 @@ def login_user(request):
except AuthFailedError as error:
response_content = error.get_response()
log.exception(response_content)
if response_content.get('error_code') == 'inactive-user':
error_code = response_content.get('error_code')
if error_code:
set_custom_attribute('login_error_code', error_code)
if error_code == 'inactive-user':
response_content['email'] = user.email
response = JsonResponse(response_content, status=400)

View File

@@ -21,6 +21,7 @@ from django.utils.translation import get_language
from django.utils.translation import ugettext as _
from django.views.decorators.csrf import csrf_exempt, ensure_csrf_cookie
from django.views.decorators.debug import sensitive_post_parameters
from edx_django_utils.monitoring import set_custom_attribute
from edx_toggles.toggles import LegacyWaffleFlag, LegacyWaffleFlagNamespace
from pytz import UTC
from ratelimit.decorators import ratelimit
@@ -182,6 +183,8 @@ def create_account_with_params(request, params):
]}
)
if is_third_party_auth_enabled:
set_custom_attribute('register_user_tpa', pipeline.running(request))
extended_profile_fields = configuration_helpers.get_value('extended_profile_fields', [])
# Can't have terms of service for certain SHIB users, like at Stanford
registration_fields = getattr(settings, 'REGISTRATION_EXTRA_FIELDS', {})