-
Notifications
You must be signed in to change notification settings - Fork 918
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
Improve dynamic configurations by adding cache and simplifying client fetch #6364
Conversation
Send the functional part for early feedback. Will add more tests and polish code later. |
cc @seraphjiang for visibility |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6364 +/- ##
===========================================
- Coverage 55.58% 44.20% -11.38%
===========================================
Files 1199 2762 +1563
Lines 24259 54606 +30347
Branches 4087 8595 +4508
===========================================
+ Hits 13485 24141 +10656
- Misses 10133 29022 +18889
- Partials 641 1443 +802
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Thanks for the early feedback! Now the PR is polished to be ready for review. Could you please take a look? @SuZhou-Joe |
@tianleh, I have a question about
In the current situation, I can only adapt manually. |
Good call out! Each use case which uses app config may have different input type. For simplicity, we just use a string as input and output. Then each use case can parse and stringify accordingly. |
The failed one https://github.com/opensearch-project/OpenSearch-Dashboards/actions/runs/8625666516/job/23642618463?pr=6364 is not related to my change and seems flaky. Could anyone help re-run it? |
@SuZhou-Joe All checks passed. |
Signed-off-by: Tianle Huang <[email protected]>
Signed-off-by: Tianle Huang <[email protected]>
The commits seem out of sync. Fixing it now. |
Signed-off-by: Tianle Huang <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks for the refactor.
Tests call the get API twice
We find two entries in the logs where the first one doesn't show cache entry but the second one shows cache entry.
Verified that the CSP rules are set properly. call update API
call the get API
From the logs, we can see that cache value is used.
call the delete API
call the get API
From the log, we can see that cache entry has been removed.
The CSP default values are being used on UI. |
… fetch (#6364) * Improve dynamic config Signed-off-by: Tianle Huang <[email protected]> * reset yml Signed-off-by: Tianle Huang <[email protected]> * bring back previous changes Signed-off-by: Tianle Huang <[email protected]> --------- Signed-off-by: Tianle Huang <[email protected]> (cherry picked from commit cd857cb) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> # Conflicts: # CHANGELOG.md
… fetch (#6364) * Improve dynamic config Signed-off-by: Tianle Huang <[email protected]> * reset yml Signed-off-by: Tianle Huang <[email protected]> * bring back previous changes Signed-off-by: Tianle Huang <[email protected]> --------- Signed-off-by: Tianle Huang <[email protected]> (cherry picked from commit cd857cb) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> # Conflicts: # CHANGELOG.md
… fetch (opensearch-project#6364) * Improve dynamic config Signed-off-by: Tianle Huang <[email protected]> * reset yml Signed-off-by: Tianle Huang <[email protected]> * bring back previous changes Signed-off-by: Tianle Huang <[email protected]> --------- Signed-off-by: Tianle Huang <[email protected]> Signed-off-by: yubonluo <[email protected]> # Conflicts: # CHANGELOG.md # src/plugins/application_config/server/types.ts # src/plugins/csp_handler/server/csp_handlers.test.ts # src/plugins/csp_handler/server/csp_handlers.ts
… fetch (opensearch-project#6364) (#324) * Improve dynamic config Signed-off-by: Tianle Huang <[email protected]> * reset yml Signed-off-by: Tianle Huang <[email protected]> * bring back previous changes Signed-off-by: Tianle Huang <[email protected]> --------- Signed-off-by: Tianle Huang <[email protected]> Signed-off-by: yubonluo <[email protected]> # Conflicts: # CHANGELOG.md # src/plugins/application_config/server/types.ts # src/plugins/csp_handler/server/csp_handlers.test.ts # src/plugins/csp_handler/server/csp_handlers.ts Co-authored-by: Tianle Huang <[email protected]>
… fetch (#6364) (#6404) * Improve dynamic config Signed-off-by: Tianle Huang <[email protected]> * reset yml Signed-off-by: Tianle Huang <[email protected]> * bring back previous changes Signed-off-by: Tianle Huang <[email protected]> --------- Signed-off-by: Tianle Huang <[email protected]> (cherry picked from commit cd857cb) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> # Conflicts: # CHANGELOG.md Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
… fetch (#6364) * Improve dynamic config Signed-off-by: Tianle Huang <[email protected]> * reset yml Signed-off-by: Tianle Huang <[email protected]> * bring back previous changes Signed-off-by: Tianle Huang <[email protected]> --------- Signed-off-by: Tianle Huang <[email protected]> (cherry picked from commit cd857cb) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> # Conflicts: # CHANGELOG.md
… fetch (#6364) * Improve dynamic config Signed-off-by: Tianle Huang <[email protected]> * reset yml Signed-off-by: Tianle Huang <[email protected]> * bring back previous changes Signed-off-by: Tianle Huang <[email protected]> --------- Signed-off-by: Tianle Huang <[email protected]> (cherry picked from commit cd857cb) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> # Conflicts: # CHANGELOG.md
… fetch (#6364) * Improve dynamic config Signed-off-by: Tianle Huang <[email protected]> * reset yml Signed-off-by: Tianle Huang <[email protected]> * bring back previous changes Signed-off-by: Tianle Huang <[email protected]> --------- Signed-off-by: Tianle Huang <[email protected]> (cherry picked from commit cd857cb) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> # Conflicts: # CHANGELOG.md
… fetch (#6364) * Improve dynamic config Signed-off-by: Tianle Huang <[email protected]> * reset yml Signed-off-by: Tianle Huang <[email protected]> * bring back previous changes Signed-off-by: Tianle Huang <[email protected]> --------- Signed-off-by: Tianle Huang <[email protected]> (cherry picked from commit cd857cb) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> # Conflicts: # CHANGELOG.md
… fetch (#6364) (#6403) * Improve dynamic config Signed-off-by: Tianle Huang <[email protected]> * reset yml Signed-off-by: Tianle Huang <[email protected]> * bring back previous changes Signed-off-by: Tianle Huang <[email protected]> --------- Signed-off-by: Tianle Huang <[email protected]> (cherry picked from commit cd857cb) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> # Conflicts: # CHANGELOG.md Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Description
Address the comments from this issue #6300
This PR updates the parameters to the
getConfigurationClient
function and adds a cache.Issues Resolved
closes #6300
closes #6341
Screenshot
Testing the changes
call the get API
Then call the get API again.
We find two entries in the logs where the first one doesn't show cache entry but the second one shows cache entry.
Verified that the CSP rules are set properly.
call update API
call the get API
From the logs, we can see that cache value is used.
call the delete API
call the get API
From the log, we can see that cache entry has been removed.
Check List
yarn test:jest
yarn test:jest_integration