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

[Connectors] Use Connector API to create a connector #183398

Merged
merged 8 commits into from
Jun 6, 2024

Conversation

jedrazb
Copy link
Member

@jedrazb jedrazb commented May 14, 2024

Summary

Use Connector API endpoint in the create connectors action. Note: elastic/elasticsearch#109248 was merged into ES very recently, you might need to pull latest ES image to get this working.

Note: some crawler features also utilise connector index, since it was agreed not to support those features in the Connector API I'm leaving crawler related logic unchanged

Validation

  • Add unit tests
  • Test locally with stack
  • Test locally with serverless

Stack manual tests:

Screen.Recording.2024-06-05.at.09.59.59.mov

Serveless:

Screen.Recording.2024-06-05.at.10.05.56.mov

@jedrazb jedrazb added release_note:skip Skip the PR/issue when compiling release notes backport:skip This commit does not require backporting labels May 14, 2024
@jedrazb
Copy link
Member Author

jedrazb commented Jun 4, 2024

@elasticmachine merge upstream

@jedrazb
Copy link
Member Author

jedrazb commented Jun 5, 2024

@elasticmachine merge upstream

@@ -87,9 +88,10 @@ export function connectorStatusToColor(connector: Connector): 'warning' | 'dange
if (
isLastSeenOld(connector) ||
connectorStatus === ConnectorStatus.ERROR ||
connector.error === SyncStatus.ERROR ||
Copy link
Member Author

Choose a reason for hiding this comment

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

The previous check didn't make sense (error can be arbitrary string), I adapted to check for last sync status

connector.last_access_control_sync_error !== null
connector.last_sync_status === SyncStatus.ERROR ||
connector.last_access_control_sync_status === SyncStatus.ERROR ||
connector.last_sync_error != null ||
Copy link
Member Author

@jedrazb jedrazb Jun 5, 2024

Choose a reason for hiding this comment

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

Change !== to !=, use type coercion when checking for nulls and undefined values (it's seems to be acceptable way for ts)

Copy link
Member

Choose a reason for hiding this comment

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

!= null is a common thing to check isNullish normally. But I think we have a utility to do the same to prevent misreadings. Just search for isNullish in code you may find it and use it if it is useful.

@jedrazb jedrazb marked this pull request as ready for review June 5, 2024 08:09
@jedrazb jedrazb requested a review from a team as a code owner June 5, 2024 08:09
@jedrazb jedrazb changed the title [Connectors] Use API to create a connector [Connectors] Use Connector API to create a connector Jun 5, 2024
@@ -23,19 +23,46 @@ export const createConnector = async (
name?: string;
pipeline?: IngestPipelineParams;
serviceType?: string | null;
instant_response?: boolean;
Copy link
Member Author

Choose a reason for hiding this comment

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

@jedrazb
Copy link
Member Author

jedrazb commented Jun 5, 2024

@elasticmachine merge upstream

@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #22 / Index Management APIs Inference endpoints "before all" hook in "Inference endpoints"

Metrics [docs]

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
@kbn/search-connectors 3688 3687 -1

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
enterpriseSearch 2.7MB 2.7MB +272.0B
Unknown metric groups

API count

id before after diff
@kbn/search-connectors 3688 3687 -1

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

Copy link
Member

@efegurkan efegurkan left a comment

Choose a reason for hiding this comment

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

LGTM with a simple change

connector.last_access_control_sync_error !== null
connector.last_sync_status === SyncStatus.ERROR ||
connector.last_access_control_sync_status === SyncStatus.ERROR ||
connector.last_sync_error != null ||
Copy link
Member

Choose a reason for hiding this comment

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

!= null is a common thing to check isNullish normally. But I think we have a utility to do the same to prevent misreadings. Just search for isNullish in code you may find it and use it if it is useful.

@jedrazb jedrazb merged commit 678ffa0 into elastic:main Jun 6, 2024
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team:EnterpriseSearch v8.15.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants