Skip to content
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

Add api registry and allow it to be added into client config in data source plugin #5895

Merged
merged 4 commits into from
Feb 19, 2024

Conversation

BionIT
Copy link
Collaborator

@BionIT BionIT commented Feb 18, 2024

Description

This change allows consumers of data source plugin to register the API schema to be used in OpenSearch client and legacy client.

Issues Resolved

Fixes #5854

Screenshot

5854.mp4

Testing the changes

Here are the steps which was performed in the screenshot

  1. disable data source plugin
  2. add sample data from local cluster, and checked dashboard displays as expected
  3. enable data source plugin
  4. check the dashboard added from remote data source, and verified dashboard displays as expected
  5. go to query bench which was changed locally to register the schema and use the new client, and verified that it can connect with remote data source and perform query as expected

Check List

  • All tests pass
    • yarn test:jest
    • yarn test:jest_integration
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

Signed-off-by: Lu Yu <nluyu@amazon.com>
@BionIT BionIT changed the title Add api registry and allow it to be added into client config Add api registry and allow it to be added into client config in data source plugin Feb 18, 2024
Signed-off-by: Lu Yu <nluyu@amazon.com>
Copy link

codecov bot commented Feb 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (55443f7) 66.98% compared to head (6d160b8) 66.98%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5895   +/-   ##
=======================================
  Coverage   66.98%   66.98%           
=======================================
  Files        3304     3305    +1     
  Lines       63569    63574    +5     
  Branches    10153    10153           
=======================================
+ Hits        42580    42585    +5     
  Misses      18521    18521           
  Partials     2468     2468           
Flag Coverage Δ
Linux_1 35.21% <ø> (ø)
Linux_2 55.11% <ø> (ø)
Linux_3 43.55% <100.00%> (+0.02%) ⬆️
Linux_4 35.20% <ø> (ø)
Windows_1 35.24% <ø> (ø)
Windows_2 55.07% <ø> (ø)
Windows_3 43.56% <100.00%> (+<0.01%) ⬆️
Windows_4 35.20% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@seraphjiang
Copy link
Member

@BionIT would you take a look https://github.com/opensearch-project/OpenSearch-Dashboards/blob/main/docs/multi-datasource/client_management_design.md

and update doc accordingly if necessary.

we could share the latest design doc to plugin team as reference.

Signed-off-by: Lu Yu <nluyu@amazon.com>
@BionIT
Copy link
Collaborator Author

BionIT commented Feb 19, 2024

@BionIT would you take a look https://github.com/opensearch-project/OpenSearch-Dashboards/blob/main/docs/multi-datasource/client_management_design.md

and update doc accordingly if necessary.

we could share the latest design doc to plugin team as reference.

Sure, just commit change to update the document

Signed-off-by: Lu Yu <nluyu@amazon.com>
@@ -155,7 +165,8 @@ export class DataSourcePlugin implements Plugin<DataSourcePluginSetup, DataSourc
cryptography: CryptographyServiceSetup,
logger: Logger,
auditTrailPromise: Promise<AuditorFactory>,
authRegistryPromise: Promise<IAuthenticationMethodRegistery>
authRegistryPromise: Promise<IAuthenticationMethodRegistery>,
customApiSchemaRegistryPromise: Promise<CustomApiSchemaRegistry>
Copy link
Member

@xinruiba xinruiba Feb 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:
Overall LGTM approved, Thanks for this change~

If not complex, do we also want to create a ICustomApiSchemaRegistry type similar to IAuthenticationMethodRegistery to only expose register() also make the code format here consistent?

@ZilongX ZilongX merged commit eff7cb5 into opensearch-project:main Feb 19, 2024
65 of 67 checks passed
@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.x failed:

The process '/usr/bin/git' failed with exit code 128

To backport manually, run these commands in your terminal:

# Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/OpenSearch-Dashboards/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/OpenSearch-Dashboards/backport-2.x
# Create a new branch
git switch --create backport/backport-5895-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 eff7cb5536a552692c43fedd60fb8a9f87f1e801
# Push it to GitHub
git push --set-upstream origin backport/backport-5895-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/OpenSearch-Dashboards/backport-2.x

Then, create a pull request where the base branch is 2.x and the compare/head branch is backport/backport-5895-to-2.x.

BionIT added a commit to BionIT/OpenSearch-Dashboards that referenced this pull request Feb 21, 2024
…source plugin (opensearch-project#5895)

* add api registry and allow it to be added into client config

Signed-off-by: Lu Yu <nluyu@amazon.com>

* add changelog

Signed-off-by: Lu Yu <nluyu@amazon.com>

* add documentation for multi data source plugin api registry

Signed-off-by: Lu Yu <nluyu@amazon.com>

* change to resolve promise before calling getQueryClient

Signed-off-by: Lu Yu <nluyu@amazon.com>

---------

Signed-off-by: Lu Yu <nluyu@amazon.com>
Flyingliuhub pushed a commit that referenced this pull request Feb 21, 2024
…source plugin (#5895) (#5906)

* add api registry and allow it to be added into client config



* add changelog



* add documentation for multi data source plugin api registry



* change to resolve promise before calling getQueryClient



---------

Signed-off-by: Lu Yu <nluyu@amazon.com>
@manasvinibs
Copy link
Member

Manual Backport #5906

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[MDS] Supporting OpenSearch plugin APIs in data source client.
7 participants