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

Dashboards sanitizer #910

Closed
wants to merge 3 commits into from
Closed

Dashboards sanitizer #910

wants to merge 3 commits into from

Conversation

arunx2
Copy link
Contributor

@arunx2 arunx2 commented Aug 16, 2024

Description

This tool helps to migrate Kibana objects to OpenSearch dashboards object by fixing the versions for compatible objects and removing the object that are incompatible with OpenSearch Dashboards.

  • Category (New feature)
  • Why these changes are required?
    The Kibana object that are created after the fork are not compatible with OpenSearch Dashboards. To avoid recreating all the dashboards, this tool helps to fix the compatible objects.
  • What is the old behavior before changes and new behavior after changes?

Issues Resolved

[List any issues this PR will resolve]

Is this a backport? If so, please add backport PR # and/or commits #

Testing

Manually tested the kibana objects extracted from V7.11 through 7.17, Not tested with objects in V8.x

Check List

  • New functionality includes testing
    • All tests pass, including unit test, integration test and doctest
  • New functionality has been documented
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Copy link
Member

@peternied peternied left a comment

Choose a reason for hiding this comment

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

Wow! You made my weekend @arunx2, thanks for putting hard work into this! Really great to see this, I'll unblock the CI for you, can you see about getting all the checks to come back passing while you work on some of the changes?

* @throws JsonProcessingException
* @throws IOException
*/
public void makeCompatibleToOS() throws JsonProcessingException, IOException {
Copy link
Member

Choose a reason for hiding this comment

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

Lets move this into the transformation project, in that project can you:

  • You'll need to add a new entity called Document.
  • Create a new transformation rule called something like OSComptaibleDashboardObject
  • Make that class implementing TransformationRule<Document> with the functionality you've got in Dashboard.java

Please feel free to take inspiration from the existing transformation
transformation/src/main/java/org/opensearch/migrations/transformation/rules/IndexMappingTypeRemoval.java

package org.opensearch.migrations.dashboards;

import static org.junit.jupiter.api.Assertions.*;
class SanitizerTest {
Copy link
Member

Choose a reason for hiding this comment

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

Lets add some test cases to covers the key scenarios for objects that are compatible and transformed along with a couple of cases where they cannot be transformed.

Copy link

codecov bot commented Aug 21, 2024

Codecov Report

Attention: Patch coverage is 0% with 167 lines in your changes missing coverage. Please review.

Project coverage is 73.64%. Comparing base (325c61a) to head (8a7bd92).
Report is 100 commits behind head on main.

Files with missing lines Patch % Lines
...nsearch/migrations/dashboards/model/Dashboard.java 0.00% 88 Missing ⚠️
...rg/opensearch/migrations/dashboards/Sanitizer.java 0.00% 42 Missing ⚠️
...g/opensearch/migrations/dashboards/util/Stats.java 0.00% 26 Missing ⚠️
.../migrations/dashboards/model/MigrationVersion.java 0.00% 5 Missing ⚠️
...search/migrations/dashboards/model/References.java 0.00% 4 Missing ⚠️
...h/migrations/dashboards/model/SavedObjectMeta.java 0.00% 2 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##               main     #910       +/-   ##
=============================================
- Coverage     88.63%   73.64%   -15.00%     
- Complexity        0     1958     +1958     
=============================================
  Files            68      349      +281     
  Lines          3809    13703     +9894     
  Branches          0      799      +799     
=============================================
+ Hits           3376    10091     +6715     
- Misses          433     3125     +2692     
- Partials          0      487      +487     
Flag Coverage Δ
gradle-test 67.86% <0.00%> (?)
python-test 88.58% <ø> (ø)

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.

@peternied
Copy link
Member

@arunx2 Thanks for this contribution, with the pull request #930 getting ready for merge I am going to close out this old pull request.

@peternied peternied closed this Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants