diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 33eef508b6..e3ddf6a78b 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -16,11 +16,16 @@ Change Log Unreleased ---------- -[4.9.3] +[4.9.4] -------- feat: Add model for integrated channel API request log table (ENT-8018) +[4.9.3] +-------- + +fix: Remove SAP debug logs + [4.9.2] -------- diff --git a/enterprise/__init__.py b/enterprise/__init__.py index eae2d43e45..665440b6f8 100644 --- a/enterprise/__init__.py +++ b/enterprise/__init__.py @@ -2,4 +2,4 @@ Your project description goes here. """ -__version__ = "4.9.3" +__version__ = "4.9.4" diff --git a/integrated_channels/cornerstone/migrations/0031_cornerstoneapirequestlogs.py b/integrated_channels/cornerstone/migrations/0031_cornerstoneapirequestlogs.py index fb01bcca82..35a3c66b68 100644 --- a/integrated_channels/cornerstone/migrations/0031_cornerstoneapirequestlogs.py +++ b/integrated_channels/cornerstone/migrations/0031_cornerstoneapirequestlogs.py @@ -1,4 +1,4 @@ -# Generated by Django 3.2.23 on 2024-01-12 07:24 +# Generated by Django 3.2.23 on 2024-01-15 07:54 from django.db import migrations, models import django.db.models.deletion @@ -17,7 +17,7 @@ class Migration(migrations.Migration): fields=[ ('integratedchannelapirequestlogs_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='integrated_channel.integratedchannelapirequestlogs')), ('user_agent', models.CharField(max_length=255)), - ('user_ip', models.GenericIPAddressField()), + ('user_ip', models.GenericIPAddressField(blank=True, null=True)), ], bases=('integrated_channel.integratedchannelapirequestlogs',), ), diff --git a/integrated_channels/cornerstone/models.py b/integrated_channels/cornerstone/models.py index e69f3c68b8..46592bc4ea 100644 --- a/integrated_channels/cornerstone/models.py +++ b/integrated_channels/cornerstone/models.py @@ -326,7 +326,7 @@ class CornerstoneAPIRequestLogs(IntegratedChannelAPIRequestLogs): A model to track basic information about every API call we make from the integrated channels. """ user_agent = models.CharField(max_length=255) - user_ip = models.GenericIPAddressField(blank=False, null=False) + user_ip = models.GenericIPAddressField(blank=True, null=True) class Meta: app_label = 'cornerstone' @@ -340,7 +340,6 @@ def __str__(self): f' for enterprise customer {self.enterprise_customer}, ' f', enterprise_customer_configuration_id: {self.enterprise_customer_configuration_id}>' f', endpoint: {self.endpoint}' - f', payload: {self.payload}' f', time_taken: {self.time_taken}' f', user_agent: {self.user_agent}' f', user_ip: {self.user_ip}' diff --git a/integrated_channels/integrated_channel/exporters/learner_data.py b/integrated_channels/integrated_channel/exporters/learner_data.py index 18c22c3f3d..04385833ea 100644 --- a/integrated_channels/integrated_channel/exporters/learner_data.py +++ b/integrated_channels/integrated_channel/exporters/learner_data.py @@ -397,11 +397,6 @@ def export(self, **kwargs): ) enrollment_ids_to_export = [enrollment.id for enrollment in enrollments_permitted] - LOGGER.info( - f"[Debug-SAP]: course_run_id:{course_run_id}, channel_name: {channel_name}" - f"lms_user_for_filter:{lms_user_for_filter}, grade:{grade} " - f"enrollment_ids_to_export: {enrollment_ids_to_export}" - ) for enterprise_enrollment in enrollments_permitted: lms_user_id = enterprise_enrollment.enterprise_customer_user.user_id user_email = enterprise_enrollment.enterprise_customer_user.user_email @@ -460,18 +455,7 @@ def export(self, **kwargs): course_completed=_is_course_completed, grade_percent=grade_percent, ) - LOGGER.info( - generate_formatted_log( - channel_name, - enterprise_customer_uuid, - lms_user_id, - course_id, - f", [Debug-SAP]: _is_course_completed: {_is_course_completed}, progress_status:{progress_status}" - f",completed_date_from_api: {completed_date_from_api}, grade_from_api:{grade_from_api}" - f"is_passing_from_api: {is_passing_from_api}, grade_percent:{grade_percent}" - f"passed_timestamp:{passed_timestamp}, records: {records}", - ) - ) + if records: # There are some cases where we won't receive a record from the above # method; right now, that should only happen if we have an Enterprise-linked @@ -489,12 +473,6 @@ def export(self, **kwargs): yield record - LOGGER.info(generate_formatted_log( - channel_name, None, lms_user_for_filter, course_run_id, - f'[Debug-SAP]: export finished. Did not export records for EnterpriseCourseEnrollment objects: ' - f' {enrollment_ids_to_export}.' - )) - def _filter_out_pre_transmitted_enrollments( self, enrollments_to_process, @@ -546,42 +524,15 @@ def get_enrollments_to_process(self, lms_user_for_filter, course_run_id, channel enterprise_customer_user__active=True, ) if lms_user_for_filter and course_run_id: - LOGGER.info( - generate_formatted_log( - channel_name, - self.enterprise_customer.uuid, - lms_user_for_filter, - course_run_id, - f"[Debug-SAP]: enrollments to process before filtering: {list(enrollment_queryset)}", - ) - ) enrollment_queryset = enrollment_queryset.filter( course_id=course_run_id, enterprise_customer_user__user_id=lms_user_for_filter.id, ) - LOGGER.info( - generate_formatted_log( - channel_name, - self.enterprise_customer.uuid, - lms_user_for_filter, - course_run_id, - f"[Debug-SAP]: enrollments to process after filtering: {list(enrollment_queryset)}", - ) - ) LOGGER.info(generate_formatted_log( channel_name, self.enterprise_customer.uuid, lms_user_for_filter, course_run_id, 'get_enrollments_to_process run for single learner and course.')) enrollment_queryset = enrollment_queryset.order_by('course_id') # return resolved list instead of queryset - LOGGER.info( - generate_formatted_log( - channel_name, - self.enterprise_customer.uuid, - lms_user_for_filter, - course_run_id, - f"[Debug-SAP]: enrollments to process: {list(enrollment_queryset)}", - ) - ) return list(enrollment_queryset) def get_learner_assessment_data_records( diff --git a/integrated_channels/integrated_channel/models.py b/integrated_channels/integrated_channel/models.py index 9fcced2e99..0d2a26f4e3 100644 --- a/integrated_channels/integrated_channel/models.py +++ b/integrated_channels/integrated_channel/models.py @@ -913,7 +913,6 @@ def __str__(self): f' for enterprise customer {self.enterprise_customer}, ' f', enterprise_customer_configuration_id: {self.enterprise_customer_configuration_id}>' f', endpoint: {self.endpoint}' - f', payload: {self.payload}' f', time_taken: {self.time_taken}' f', api_record.body: {self.api_record.body}' f', api_record.status_code: {self.api_record.status_code}' diff --git a/tests/test_integrated_channels/test_integrated_channel/test_models.py b/tests/test_integrated_channels/test_integrated_channel/test_models.py index 8f8c187654..49c4c21bc9 100644 --- a/tests/test_integrated_channels/test_integrated_channel/test_models.py +++ b/tests/test_integrated_channels/test_integrated_channel/test_models.py @@ -256,6 +256,7 @@ def test_offset_naive_error(self): self.config.update_content_synced_at(first_timestamp, True) assert self.config.last_sync_attempted_at == first_timestamp + @mark.django_db class TestIntegratedChannelAPIRequestLogs(unittest.TestCase, EnterpriseMockMixin): """ @@ -287,12 +288,11 @@ def test_content_meta_data_string_representation(self): f' for enterprise customer {self.enterprise_customer}, ' f', enterprise_customer_configuration_id: {self.enterprise_customer_configuration_id}>' f', endpoint: {self.endpoint}' - f', payload: {self.payload}' f', time_taken: {self.time_taken}' f', api_record.body: {self.api_record.body}' f', api_record.status_code: {self.api_record.status_code}' ) - + request_log = IntegratedChannelAPIRequestLogs( id=1, enterprise_customer=self.enterprise_customer,