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

Move public SO APIs to SOM #189240

Open
TinaHeiligers opened this issue Jul 25, 2024 · 10 comments
Open

Move public SO APIs to SOM #189240

TinaHeiligers opened this issue Jul 25, 2024 · 10 comments
Assignees
Labels
blocked Feature:Saved Objects Management Feature:Saved Objects Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc test-api-integration

Comments

@TinaHeiligers
Copy link
Contributor

TinaHeiligers commented Jul 25, 2024

Moving the public saved objects (import/export/resolve_import_error) APIs from Core to the Saved Objects management plugin (SOM) could improve code organization and API management.

If the APIs allow us to leverage more platform features. E.g. we could use the file service to store the export, taskManager to schedule export as background tasks, and so on.

If we used the file service, we could remove the resolve_import_error API: this API exists only because we need to re-send the import file for error resolution. Storing the imported file would improve UX (especially for non-UI usage) because consumers only need to use import to resolve conflicts.

Rationale

  1. Isolation of Concerns:

    • Core: should primarily handle fundamental services that plugins and solutions rely on.
    • Plugins: Implement features and add-on functionality to Kibana.

    This ensures a clear separation of responsibilities and better modularity.

  2. API Path Structure:

    • Current path prefix: /api/saved_objects/
      • These APIs currently reside under a generic path, which can be misleading. SOM is more distinct and specific.
    • Proposed path prefix: /api/kibana/management/saved_objects/
      A dedicated path under the SOM plugin is more descriptive and aligns with the purpose of these APIs, making it easier for users and developers to discover and understand the APIs.
  3. Deprecation and Transition:

    • Deprecation Strategy: Maintain the current API prefix (/api/saved_objects/) as deprecated to provide a transition period for users and integrations to migrate to the new path.
    • New Stable Path: Encourage usage of the new API prefix (/api/kibana/management/saved_objects/) for all future development, ensuring a smooth transition.

Implementation Steps

  1. Move APIs to SO Management Plugin:

    • Move the API code for import, export, and resolve_import_error APIs from Core to the SO management plugin.
    • Keep the importer/exporter code in Core. Update import paths throughout Kibana.
  2. Update API Paths:

    • Implement the new API endpoints under the /api/kibana/management/saved_objects/ path within the SO management plugin.
    • Maintain the current API paths as deprecated, ensuring they continue to function but with clear deprecation warnings.
  3. Documentation and Communication:

    • Update all relevant documentation to reflect the new API paths.
    • Communicate the changes and deprecation timeline to users and developers through appropriate channels (e.g., release notes, migration guides, kibana contributors newsletter).
  4. Backward Compatibility:

    • Implement backward compatibility for the current API paths to ensure existing integrations do not break immediately.
    • Monitor usage and ensure there isn't any use before removing them after an appropriate deprecation period.

Benefits

  1. Modularity:

    • Improves code organization by isolating SO management-related APIs within a dedicated plugin.
    • Makes API maintenance and potential future enhancements easier.
  2. Clarity and Usability:

    • Provides a more intuitive and descriptive API path structure, enhancing the developer experience.
    • Helps users quickly identify the purpose and scope of the APIs.
  3. Future-proofing:

    • Establishes a clear path for future SOM-related features and APIs in a dedicated plugin context.

By moving the public saved objects APIs to the SO management plugin and updating their API paths, we align the system architecture with best practices for modularity and clarity, ensuring a more maintainable and user-friendly API structure.

Related code references

@botelastic botelastic bot added the needs-team Issues missing a team label label Jul 25, 2024
@TinaHeiligers TinaHeiligers changed the title Move _import, _export and _resolve_import_error APIs to SOM Move public SO APIs to SOM Jul 25, 2024
@TinaHeiligers TinaHeiligers added Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc test-api-integration Feature:Saved Objects Management labels Jul 25, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-core (Team:Core)

@botelastic botelastic bot removed the needs-team Issues missing a team label label Jul 25, 2024
@jloleysens
Copy link
Contributor

Moving the public saved objects (import/export/resolve_import_error)

Just checking: my understanding of the proposal is that our desired state for/by 9.0 is:

Deprecate the folllowing:

public, deprecated: /api/saved_objects/_import
public, deprecated: /api/saved_objects/_export
public, deprecated: /api/saved_objects/_resolve_import_errors

Introduce the following:

public: /api/kibana/management/saved_objects/_import
public: /api/kibana/management/saved_objects/_export

@pgayvallet mentioned once we move these to SO Management plugin a path is available to get rid of _resolve_import_errors entirely. Might be worth taking stock of any implications that might have for the new /api/kibana/management/saved_objects/_import

@TinaHeiligers
Copy link
Contributor Author

TinaHeiligers commented Jul 26, 2024

@jloleysens I was thinking more along the lines of introducing new SOM APIs for each of them:

Step 1:

public: /api/kibana/management/saved_objects/_import
public: /api/kibana/management/saved_objects/_export
public: /api/kibana/management/saved_objects/_resolve_import_errors

Step 2:
Validate we can remove _resolve_import_errors and deprecate the API

Step 3:
Wait until deprecation period is over

Step 4:
Remove the api.

_resolve_import_errors is public and we can't remove it without some sort of deprecation notice first.

I'm not saying we need to wait 18 months. We also don't need to wait long, only as long as it takes to make sure it's not consumed at all.

@TinaHeiligers
Copy link
Contributor Author

spin-off from https://github.com/elastic/dev/issues/2200 , cleaning up core

@TinaHeiligers
Copy link
Contributor Author

Not urgent since we're not removing the SO HTTP APIs in v9.

@afharo afharo added the good first issue low hanging fruit label Oct 22, 2024
@afharo
Copy link
Member

afharo commented Oct 30, 2024

@TinaHeiligers, just to clarify. This issue is "just" about moving the HTTP API definitions to the SOM plugin. No need for additional optimizations, correct?

@TinaHeiligers
Copy link
Contributor Author

@afharo This issue is for moving the public export and import HTTP routes to SOM. Enhancements and optimizations aren't directly in scope.

@afharo
Copy link
Member

afharo commented Oct 30, 2024

Nice! Thanks! I'll add links to the relevant code then to make it more good first issue :)

@afharo afharo removed the good first issue low hanging fruit label Nov 28, 2024
@afharo
Copy link
Member

afharo commented Nov 28, 2024

Removing the label good first issue and moved to Clarifying because we noticed 2 side-effects that require further discussion:

  1. Reporting usage of the APIs via coreUsageDataClient is no-longer possible. Do we want to use usageCounters instead?
  2. The config savedObjects.maxImportPayloadBytes and savedObjects.maxImportExportSize must be moved to the SOM plugin (deprecations => BCC?) or exposed by the core service for the plugin to read.

@TinaHeiligers TinaHeiligers removed their assignment Dec 10, 2024
@TinaHeiligers TinaHeiligers self-assigned this Jan 6, 2025
@TinaHeiligers
Copy link
Contributor Author

Related is to start working on documentation for migrating off of the existing, deprecated APIs.
ideally, we'd have that automated or at the very least, some tooling to help end users.
I'll be fleshing a concept that's stewing in more detail over the next months.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked Feature:Saved Objects Management Feature:Saved Objects Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc test-api-integration
Projects
None yet
Development

No branches or pull requests

5 participants