-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[Core] Don't expose Elasticsearch client as Observable #53267
Comments
Pinging @elastic/kibana-platform (Team:Platform) |
In this PR we can separate:
interface ElasticsearchPublicInterface {
createClient: (type: string, clientConfig?..) => ICustomClusterClient;
adminClient: IClusterClient;
dataClient: IClusterClient;
}
interface ElasticsearchInternalInterface {
legacy: {config$: ..};
adminClient$: Observable<IClusterClient>;
dataClient$: Observable<IClusterClient>;
}
interface IClusterClient {
callAsInternalUser: (...) => any;
asScoped: (req) => IScopedClusterClient;
}
interface ICustomClusterClient extends IClusterClient{
close: () => void;
}
// SetupContract before
adminClient: {
callAsInternalUser(){...} ,
asScoped(request) {
return {
callAsInternalUser(){...}
callAsCurrentUser(){...}
},
}
dataClient: {
callAsInternalUser(){...} ,
asScoped(request) {
return {
callAsInternalUser(){...}
callAsCurrentUser(){...}
},
}
// SetupContract after
callAsInternalUser(){...}
asScoped(request) {
return {
callAsInternalUser(){...}
callAsCurrentUser(){...}
}
} |
I agree, I don't see any reason we should give a different client to the request context than what we give to plugins. From context rfc:
I think the reason this was specified was so that code in a context handler doesn't need to deal with observables or promises, a context handler should get a ready-to-use client. @joshdover what do you think?
I like this suggestion 👍
As something low-priority, it's probably not worth doing if it's a lot of work, but it will reduce the code complexity, so if it's low effort it seems like a good bonus. |
I merged the current implementation. We can remove the difference later. |
Yeah I don't think the observable is important to the request handler context provider any more. However, I do think we should still have the request context provider to do the |
https://github.com/elastic/kibana/blob/6042a01f385078587e8e09418ef07f69ec2dadf7/rfcs/text/0007_lifecycle_unblocked.md#3-core-should-not-expose-apis-as-observables
The text was updated successfully, but these errors were encountered: