Don't expose Elasticsearch client as Observable#53824
Don't expose Elasticsearch client as Observable#53824mshustov merged 14 commits intoelastic:masterfrom
Conversation
|
Pinging @elastic/kibana-platform (Team:Platform) |
azasypkin
left a comment
There was a problem hiding this comment.
Security/Spaces changes LGTM.
pgayvallet
left a comment
There was a problem hiding this comment.
This seems definitely better in term of developer experience.
| plugins: AlertingPluginsSetup | ||
| ): Promise<PluginSetupContract> { | ||
| this.adminClient = await core.elasticsearch.adminClient$.pipe(first()).toPromise(); | ||
| this.adminClient = core.elasticsearch.adminClient; |
There was a problem hiding this comment.
Proof by usage that the PR was needed.
| createSetupContract: createSetupContractMock, | ||
| createInternalSetup: createInternalSetupContractMock, | ||
| createSetup: createSetupContractMock, |
There was a problem hiding this comment.
I think I'm in favor of this 'new' naming without the contract suffix, however this is inconsistent with every other service mocks we got. Should we decide to go with this and change the others when we can?
There was a problem hiding this comment.
I think we should unify this naming. Right now we have inconsistency across the codebase. example
Should we add this to NP conventions and fix all the mocks?
There was a problem hiding this comment.
This is minor, but I think we should
| async callAsCurrentUser( | ||
| endpoint: string, | ||
| clientParams: Record<string, any> = {}, | ||
| options?: CallAPIOptions | ||
| ) { |
There was a problem hiding this comment.
NIT: does explicitly typing the clients to IClusterClient avoid to redefine the callAsXXXUser parameter types?
There was a problem hiding this comment.
nope. TS complaints Parameter '...' implicitly has an 'any' type
| it('returns data and admin client as a part of the contract', async () => { | ||
| const mockAdminClusterClientInstance = elasticsearchServiceMock.createClusterClient(); | ||
| const mockDataClusterClientInstance = elasticsearchServiceMock.createClusterClient(); | ||
| MockClusterClient.mockImplementationOnce( | ||
| () => mockAdminClusterClientInstance | ||
| ).mockImplementationOnce(() => mockDataClusterClientInstance); | ||
|
|
||
| const setupContract = await elasticsearchService.setup(deps); |
There was a problem hiding this comment.
Do we have any reasons to keep this now? (the filter I mean. Comment is unrelated to the actual test file)
kibana/src/core/server/elasticsearch/elasticsearch_service.ts
Lines 61 to 68 in bde2895
There was a problem hiding this comment.
As I understand, our code is ready for runtime config updates, but we don't have such requirements at the moment.
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
* expose ES clients without observables * expose observable-less api to plugins * update core api and mocks * update plugins * NP SO & legacy use updated API * update SO tests * update TSDocs * update types * update docs * document createCluster analog in np * typo
* expose ES clients without observables * expose observable-less api to plugins * update core api and mocks * update plugins * NP SO & legacy use updated API * update SO tests * update TSDocs * update types * update docs * document createCluster analog in np * typo
* master: (55 commits) [ui/public/utils] Copy rarely used items to where they are consumed (elastic#53819) set AppArch team as an owner of the search endpoints (elastic#54131) Don't expose Elasticsearch client as Observable (elastic#53824) [SIEM] Cleanup unnecessary use of enzyme-to-json (elastic#53980) fix ui exports doc (elastic#54138) change markdown element title (elastic#54194) [Logs UI] Refactor log position to hooks (elastic#53540) [SIEM] Implement NP Plugin Setup (elastic#54030) [DOCS] Updates ML links (elastic#53613) sort renovate packages in config Spaces - fix flakey api tests (elastic#54154) Remove dependency that was causing effect to re-execute infinitely. (elastic#54160) [dev/run] expose unexpected flags as more than just names (elastic#54080) [DOCS] Moves index pattern doc to Discover (elastic#53347) [SIEM] Cleanup React imports (elastic#53981) Update eslint related packages (elastic#54107) [Uptime] Added date range filter into expanded list query (elastic#52609) [SIEM] Add react/display-name eslint rule (elastic#53107) [SIEM] Enable eslint prefer-template rule (elastic#53983) Elasticsearch snapshots automation (elastic#53706) ...
….com:mbondyra/kibana into IS-50036_show-sum-for-a-field-with-formatter * 'IS-50036_show-sum-for-a-field-with-formatter' of github.com:mbondyra/kibana: [Telemetry] Fix license page crashing on telemetry.enabled: fa… (elastic#54174) [ui/public/utils] Copy rarely used items to where they are consumed (elastic#53819) set AppArch team as an owner of the search endpoints (elastic#54131) Don't expose Elasticsearch client as Observable (elastic#53824) [SIEM] Cleanup unnecessary use of enzyme-to-json (elastic#53980)
|
Oh ignore me, I missed the kibana/src/core/server/elasticsearch/elasticsearch_service.ts Lines 90 to 92 in 56041f0 |
Summary
Closes #53267
TODO:
see related discussion in the parent task.
Checklist
Use
strikethroughsto remove checklist items you don't feel are applicable to this PR.[ ] This was checked for cross-browser compatibility, including a check against IE11[ ] Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n support[ ] This was checked for keyboard-only and screenreader accessibilityFor maintainers
Dev docs
Elasticsearch clients aren't exposed via the Observable interface anymore. Elasticsearch client provides a static API that handles all elasticsearch config updates under the hood, transparent to the end-user.