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

[Multiple Datasource][Version Decoupling] Support Version Decoupling in Index Patterns Dashboards Plugin #7100

Merged

Conversation

ZilongX
Copy link
Collaborator

@ZilongX ZilongX commented Jun 24, 2024

Description

  • This PR is to add support of Version Decoupling in Index Patterns Dashboards Plugin
  • This is achieved mainly by add a new entry supportedOSDataSourceVersions in the plugin manifest file
  • For Index Patterns Plugin it would support all versions of OS clusters so the supported range would be >=1.0.0
  • The current behavior is to filter out the incompatible data sources out of the data source list.

Issues Resolved

#7099

Screenshot

Screen.Recording.2024-06-24.at.1.30.34.PM.mov

Changelog

  • fix: [MDS][Version Decoupling] Add support of Version Decoupling in Index Patterns Dashboards Plugin

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

…in Index Patterns Dashboards Plugin

Signed-off-by: Zilong Xia <[email protected]>
@ZilongX ZilongX added multiple datasource multiple datasource project version decoupling labels Jun 24, 2024
Copy link

codecov bot commented Jun 24, 2024

Codecov Report

Attention: Patch coverage is 25.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 67.45%. Comparing base (e6aa9d6) to head (2b6db3b).

Files Patch % Lines
...ents/step_data_source/components/header/header.tsx 0.00% 2 Missing ⚠️
...ndex_pattern_management/public/components/utils.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7100      +/-   ##
==========================================
+ Coverage   67.43%   67.45%   +0.01%     
==========================================
  Files        3448     3448              
  Lines       67960    67964       +4     
  Branches    11057    11057              
==========================================
+ Hits        45832    45845      +13     
+ Misses      19454    19446       -8     
+ Partials     2674     2673       -1     
Flag Coverage Δ
Linux_1 33.10% <0.00%> (-0.01%) ⬇️
Linux_2 55.06% <100.00%> (+<0.01%) ⬆️
Linux_3 45.25% <0.00%> (+<0.01%) ⬆️
Linux_4 34.83% <0.00%> (-0.01%) ⬇️
Windows_1 33.12% <0.00%> (?)
Windows_2 55.01% <100.00%> (+<0.01%) ⬆️
Windows_3 45.25% <0.00%> (-0.01%) ⬇️
Windows_4 34.83% <0.00%> (-0.01%) ⬇️

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.

Copy link
Contributor

@yujin-emma yujin-emma left a comment

Choose a reason for hiding this comment

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

LGTM

@bandinib-amzn
Copy link
Member

Can you please add more UT for uncovered lines so that codecov CI would pass?

@bandinib-amzn
Copy link
Member

For Index Patterns Plugin it would support all versions of OS clusters so the supported range would be >=1.0.0

Do we have any test result to support above sentence? Can we attach that here as source of truth?

import { useOpenSearchDashboards } from '../../../../../../../../../plugins/opensearch_dashboards_react/public';
import { getDataSources } from '../../../../../../components/utils';
import { DataSourceTableItem, StepInfo } from '../../../../types';
import { LoadingState } from '../../../loading_state';
import * as pluginManifest from '../../../../../../../opensearch_dashboards.json';
Copy link
Member

Choose a reason for hiding this comment

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

nit: can we use absolute path here instead of relative path with directory traversal?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes, this one just to keep the save relative style as existing imports lol

@@ -92,4 +92,5 @@ export interface DataSourceTableItem {
sort: string;
checked?: 'on' | 'off';
label: string;
datasourceversion: string;
Copy link
Member

Choose a reason for hiding this comment

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

Is it expected that each plugin needs to have this change in order to onboard version decoupling?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, datasource would be the minimal fields to check in order to decide the version compatibility

@@ -99,13 +99,15 @@ export async function getDataSources(savedObjectsClient: SavedObjectsClientContr
const id = dataSource.id;
const type = dataSource.type;
const title = dataSource.get('title');
const datasourceversion = dataSource.get('dataSourceVersion');
Copy link
Member

Choose a reason for hiding this comment

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

same as above.

@@ -68,6 +70,12 @@ export const Header: React.FC<HeaderProps> = (props: HeaderProps) => {
.then((fetchedDataSources: DataSourceTableItem[]) => {
setIsLoading(false);
if (fetchedDataSources?.length) {
fetchedDataSources = fetchedDataSources.filter((dataSource) =>
semver.satisfies(
dataSource.datasourceversion,
Copy link
Member

Choose a reason for hiding this comment

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

what about for existing/old data sources that doesn't have this field? Does it break backwards compatibility?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

for older data sources it won't work yest as they won't support version decoupling, MDS initially just list out all data sources created regardless so there would be a bunch of unexpected behaviors, version decoupling is aiming to improve that user experiences by only allowing consumption against compatible data sources.

besides there is a refresh flow of data sources planning in progress which would also resolve the concern here, which will refresh the current saved object to bring it up-to-date

@ZilongX ZilongX requested a review from LDrago27 as a code owner June 26, 2024 19:55
@ZilongX
Copy link
Collaborator Author

ZilongX commented Jun 27, 2024

Can you please add more UT for uncovered lines so that codecov CI would pass?

Yes I was planned yet later found the whole section was not covered in the first place, I'll try to add coverage for the whole section or maybe in separate PR

@ZilongX
Copy link
Collaborator Author

ZilongX commented Jun 27, 2024

For Index Patterns Plugin it would support all versions of OS clusters so the supported range would be >=1.0.0

Do we have any test result to support above sentence? Can we attach that here as source of truth?

Yes, we have test results indicating latest Index Pattern would only support ES 7.9 + which for OS it would be 1.0 +

@ZilongX ZilongX merged commit 5ee6f58 into opensearch-project:main Jun 27, 2024
66 of 67 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Jun 27, 2024
…in Index Patterns Dashboards Plugin (#7100)

* [Multiple Datasource][Version Decoupling] Support Version Decoupling in Index Patterns Dashboards Plugin

Signed-off-by: Zilong Xia <[email protected]>

* Changeset file for PR #7100 created/updated

---------

Signed-off-by: Zilong Xia <[email protected]>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
(cherry picked from commit 5ee6f58)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
ZilongX pushed a commit that referenced this pull request Jun 27, 2024
…in Index Patterns Dashboards Plugin (#7100) (#7123)

* [Multiple Datasource][Version Decoupling] Support Version Decoupling in Index Patterns Dashboards Plugin



* Changeset file for PR #7100 created/updated

---------



(cherry picked from commit 5ee6f58)

Signed-off-by: Zilong Xia <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
@ZilongX ZilongX deleted the index_pattern_version_decoupling branch June 28, 2024 21:01
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.

5 participants