Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TT-11912]: Added Analytics expiry period to OAS (#6825)
### **User description** <details open> <summary><a href="https://tyktech.atlassian.net/browse/TT-11912" title="TT-11912" target="_blank">TT-11912</a></summary> <br /> <table> <tr> <th>Summary</th> <td>[OAS] Analytics expiry period</td> </tr> <tr> <th>Type</th> <td> <img alt="Story" src="https://tyktech.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10315?size=medium" /> Story </td> </tr> <tr> <th>Status</th> <td>In Dev</td> </tr> <tr> <th>Points</th> <td>N/A</td> </tr> <tr> <th>Labels</th> <td>-</td> </tr> </table> </details> <!-- do not remove this marker as it will break jira-lint's functionality. added_by_jira_lint --> --- <!-- Provide a general summary of your changes in the Title above --> ## Description Added retention period to the analytics config in the OAS definition [TT-11912](https://tyktech.atlassian.net/browse/TT-11912) <!-- Describe your changes in detail --> ## Related Issue <!-- This project only accepts pull requests related to open issues. --> <!-- If suggesting a new feature or change, please discuss it in an issue first. --> <!-- If fixing a bug, there should be an issue describing it with steps to reproduce. --> <!-- OSS: Please link to the issue here. Tyk: please create/link the JIRA ticket. --> ## Motivation and Context <!-- Why is this change required? What problem does it solve? --> ## How This Has Been Tested <!-- Please describe in detail how you tested your changes --> <!-- Include details of your testing environment, and the tests --> <!-- you ran to see how your change affects other areas of the code, etc. --> <!-- This information is helpful for reviewers and QA. --> ## Screenshots (if appropriate) ## Types of changes <!-- What types of changes does your code introduce? Put an `x` in all the 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 change) - [ ] Refactoring or add test (improvements in base code or adds test coverage to functionality) ## Checklist <!-- Go over all the following points, and put an `x` in all the boxes that apply --> <!-- If there are no documentation updates required, mark the item as checked. --> <!-- Raise up any additional concerns not covered by the checklist. --> - [ ] I ensured that the documentation is up to date - [ ] I explained why this PR updates go.mod in detail with reasoning why it's required - [ ] I would like a code coverage CI quality gate exception and have explained why [TT-11912]: https://tyktech.atlassian.net/browse/TT-11912?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ ___ ### **PR Type** Enhancement, Tests ___ ### **Description** - Added `DisableExpireAnalytics` field to API definition for analytics expiration control. - Introduced `RetentionPeriod` struct for detailed analytics retention configuration. - Updated middleware logic to handle retention period extraction and filling. - Added unit tests for retention period functionality in traffic logs. ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table> <tr> <td> <details> <summary><strong>api_definitions.go</strong><dd><code>Introduced `DisableExpireAnalytics` field in API definition</code></dd></summary> <hr> apidef/api_definitions.go <li>Added <code>DisableExpireAnalytics</code> field to API definition.<br> <li> Enhanced analytics expiration functionality with a new field. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6825/files#diff-9961ccc89a48d32db5b47ba3006315ef52f6e5007fb4b09f8c5d6d299c669d67">+1/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>migration.go</strong><dd><code>Updated migration logic for analytics expiration</code> </dd></summary> <hr> apidef/migration.go <li>Set <code>DisableExpireAnalytics</code> to true in <code>SetDisabledFlags</code>.<br> <li> Ensured analytics expiration is disabled in migration logic. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6825/files#diff-e1d9b55a26f9d6225d56d6f0161959217308e5ad4d6934e7d7df4595d9c2a130">+1/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>middleware.go</strong><dd><code>Added `RetentionPeriod` struct and related logic</code> </dd></summary> <hr> apidef/oas/middleware.go <li>Added <code>RetentionPeriod</code> struct for analytics retention configuration.<br> <li> Updated traffic logs logic to handle retention period.<br> <li> Implemented <code>Fill</code> and <code>ExtractTo</code> methods for <code>RetentionPeriod</code>. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6825/files#diff-992ec7c28d25fd54f6491d295389757705cd114bc869a35cba50d42e548cdc6e">+61/-0</a> </td> </tr> </table></td></tr><tr><td><strong>Tests</strong></td><td><table> <tr> <td> <details> <summary><strong>middleware_test.go</strong><dd><code>Added tests for analytics retention period</code> </dd></summary> <hr> apidef/oas/middleware_test.go <li>Added unit tests for <code>RetentionPeriod</code> functionality.<br> <li> Verified retention period extraction and filling logic. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6825/files#diff-0af31cb29ae298a6ac3e402b283ab364a6fd793fd04f253ef7c4983234c17bef">+22/-0</a> </td> </tr> </table></td></tr></tr></tbody></table> ___ > 💡 **PR-Agent usage**: Comment `/help "your question"` on any pull request to receive relevant information --------- Co-authored-by: Tit Petric <[email protected]>
- Loading branch information