-
Notifications
You must be signed in to change notification settings - Fork 58
[AAP-40319] merge Feature/analytics to main #1240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signed-off-by: Alex <aizquier@redhat.com> Co-authored-by: Alex <aizquier@redhat.com> Co-authored-by: Joe Shimkus <35382397+jshimkus-rh@users.noreply.github.com> Co-authored-by: Elijah DeLee <kdelee@redhat.com> Co-authored-by: Hui Song <hsong@redhat.com>
…ytics collection (#1207) https://issues.redhat.com/browse/AAP-39884 This PR covers: 1. Add more Pytest cases to improve code coverage for analytics collection 2. Fix errors when the audit_rule table is empty ``` Traceback (most recent call last): File "/home/runner/.cache/pypoetry/virtualenvs/aap-eda-mUpJWeoH-py3.11/lib/python3.11/site-packages/insights_analytics_collector/collection.py", line 59, in gather result = self.fnc_collecting( ^^^^^^^^^^^^^^^^^^^^ File "/home/runner/work/eda-server/eda-server/src/aap_eda/analytics/analytics_collectors.py", line 289, in audit_rules_table audit_rules = _get_audit_rule_qs(since, until).values( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/runner/.cache/pypoetry/virtualenvs/aap-eda-mUpJWeoH-py3.11/lib/python3.11/site-packages/django/db/models/query.py", line 1313, in values clone = self._values(*fields, **expressions) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/runner/.cache/pypoetry/virtualenvs/aap-eda-mUpJWeoH-py3.11/lib/python3.11/site-packages/django/db/models/query.py", line 1308, in _values clone.query.set_values(fields) File "/home/runner/.cache/pypoetry/virtualenvs/aap-eda-mUpJWeoH-py3.11/lib/python3.11/site-packages/django/db/models/sql/query.py", line 2463, in set_values self.add_fields(field_names, True) File "/home/runner/.cache/pypoetry/virtualenvs/aap-eda-mUpJWeoH-py3.11/lib/python3.11/site-packages/django/db/models/sql/query.py", line 2195, in add_fields raise FieldError( django.core.exceptions.FieldError: Cannot resolve keyword 'created_at' into field. Choices are: activation, activation_id, activation_pod_id, activationinstancejobinstance, auditrule, ended_at, git_hash, id, log_read_at, name, organization, organization_id, parent_type, rulebookprocesslog, rulebookprocessqueue, started_at, status, status_message, updated_at ``` 3. Fix the previous two failed Pytest cases: ``` FAILED tests/integration/analytics/test_gather_analytics.py::test_gather_analytics_invalid_settings[https://url-True-Analytics collection is done] - requests.exceptions.ConnectionError: HTTPSConnectionPool(host='url', port=443): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f9acaca9950>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')) FAILED tests/integration/analytics/test_gather_analytics.py::test_gather_analytics_command[--ship-INFO-Analytics collection is done] - requests.exceptions.ConnectionError: HTTPSConnectionPool(host='url', port=443): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f9acb3f0a90>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')) ====== 2 failed, 922 passed, 24 skipped, 15 warnings in 391.17s (0:06:31) ====== ```
https://issues.redhat.com/browse/AAP-39892 This PR covers: 1. remove `payload` from audit event collection table, 2. reduce SQL parameter injection and memory overflow risks
AAP-39884 Test and improve code coverage for analytics collection feature
Renames feature flag to be inline with naming convention FEATURE_(FEATURE_NAME)_ENABLED
<!-- Mandatory: Provide a clear, concise description of the changes and their purpose --> Sets the default to False to align on feature requirements Closes #XXX (if applicable) Jira: [AAP-XXXXX](https://jira.aap.com/browse/AAP-XXXXX) (if applicable) <!-- Mandatory: Check one or more boxes that apply --> - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] Documentation update - [ ] Test update - [ ] Refactoring (no functional changes) - [ ] Development environment change - [ ] Configuration change - [ ] CI change <!-- These items help ensure quality - they complement our automated CI checks --> - [ ] I have performed a self-review of my code - [ ] I have added relevant comments to complex code sections - [ ] I have updated documentation where needed - [ ] I have considered the security impact of these changes - [ ] I have considered performance implications - [ ] I have thought about error handling and edge cases - [ ] I have tested the changes in my local environment - [ ] I have run the linters and test suite locally - [ ] I have tested the changes on integration environment <!-- Optional for test-only changes. Mandatory for all other changes --> <!-- Must be detailed enough for reviewers to reproduce --> <!-- List any specific setup required --> 1. 2. 3. <!-- Describe what should happen after following the steps --> <!-- Optional but helpful information --> <!-- Check if changes require work in other areas --> <!-- Remove section if no external actions needed --> - [ ] Requires documentation updates <!-- API docs, feature docs, deployment guides --> - [ ] Requires downstream repository changes <!-- Specify repos: django-ansible-base, eda-server, etc. --> - [ ] Requires infrastructure/deployment changes <!-- CI/CD, installer updates, new services --> - [ ] Requires coordination with other teams <!-- UI team, platform services, infrastructure --> - [ ] Blocked by PR/MR: #XXX | <https://github.com/example/repo/pull/XXX> <!-- Reference blocking PRs/MRs with brief context --> <!-- Add if relevant to demonstrate the changes -->
This PR contains: 1. change `activations_stats.csv` into `activations_stats_table.csv` 2. remove `created_by_id` and `modified_by_id` from `teams_table.csv` https://issues.redhat.com/browse/AAP-41167
Codecov ReportAttention: Patch coverage is
@@ Coverage Diff @@
## main #1240 +/- ##
==========================================
+ Coverage 93.90% 94.55% +0.64%
==========================================
Files 290 309 +19
Lines 16123 18047 +1924
==========================================
+ Hits 15141 17065 +1924
Misses 982 982
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
zkayyali812
reviewed
Mar 21, 2025
zkayyali812
previously approved these changes
Mar 21, 2025
hsong-rh
reviewed
Mar 21, 2025
fd0b510 to
99b9bb5
Compare
hsong-rh
previously approved these changes
Mar 21, 2025
99b9bb5 to
6366d47
Compare
|
hsong-rh
approved these changes
Mar 21, 2025
zkayyali812
approved these changes
Mar 21, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.


Merge feature branch analytics back to main
AAP-40319