Extract KQL autocomplete to a plugin#20747
Conversation
| function escapeSpecialCharacters(string) { | ||
| return string.replace(/[\\():<>"*]/g, '\\$&'); // $& means the whole matched string | ||
| } | ||
| const autocompleteProviders = new Map(); |
There was a problem hiding this comment.
This is basically a registry, but I didn't actually want to use a registry because it relies on Private which would make it difficult to include in APM.
| @@ -1,41 +0,0 @@ | |||
| /* | |||
There was a problem hiding this comment.
This is just a rename.
| uiExports: { | ||
| hacks: ['plugins/kuery_autocomplete/hacks'], | ||
| }, | ||
| init: () => {} |
There was a problem hiding this comment.
For some reason if I don't include this, the plugin doesn't load...
There was a problem hiding this comment.
Hmm, works for me, plugins without init functions are nothing new: https://github.com/elastic/kibana/blob/master/src/core_plugins/kbn_vislib_vis_types/index.js. Maybe you mean you're not seeing the log line about its status? That's because plugins without an init() function can't actually have a status, since the only way to set it would be with an init() function.
💚 Build Succeeded |
Bargs
left a comment
There was a problem hiding this comment.
LGTM. I tested with OSS, basic, and trial licenses to make sure the right thing happened in each case. Not 100% sure if hacks are the best way to do this, but I don't know of a better way, so I'll leave that to someone more familiar with what's happening with the plugin APIs to comment on.
|
I won't have time to review this before I go on vacation, but I want to make sure it gets merged/backported for 6.4 FF. @lukasolson please ask someone else to take a look at this in my stead. |
bmcconaghy
left a comment
There was a problem hiding this comment.
LGTM, follows a similar pattern to how we've handled other xpack/oss interactions in management apps (xpack console autocomplete, rollup support). I made a couple of naming suggestions but they are not blockers.
| // See the Keyword rule in kuery.peg | ||
| function escapeAndOr(string) { | ||
| return string.replace(/(\s+)(and|or)(\s+)/ig, '$1\\$2$3'); | ||
| export function setAutocompleteProvider(language, provider) { |
There was a problem hiding this comment.
I would suggest renaming this to "addAutocompleteProvider" to make it clear that multiple providers can be added.
There was a problem hiding this comment.
👍 Agreed, I'll update this
|
|
||
| this.suggestions = this.getRecentSearchSuggestions(query); | ||
| if (this.localQuery.language !== 'kuery' || !this.getKuerySuggestions) return; | ||
| const suggestionsProvider = getAutocompleteProvider(language); |
There was a problem hiding this comment.
this mismatch b/t suggestionsProvider and autocompleteProvider is weird and possibly confusing.
There was a problem hiding this comment.
👍 Agreed, I'll update this
💔 Build Failed |
|
Jenkins, test this |
💔 Build Failed |
| export const kueryAutocomplete = (kibana) => new kibana.Plugin({ | ||
| id: 'kuery_autocomplete', | ||
| publicDir: resolve(__dirname, 'public'), | ||
| require: ['kibana', 'xpack_main'], |
There was a problem hiding this comment.
this is unnecessary, this plugin doesn't actually require the kibana or xpack_main plugins AFAICT
| id: 'kuery_autocomplete', | ||
| publicDir: resolve(__dirname, 'public'), | ||
| require: ['kibana', 'xpack_main'], | ||
| config: (Joi) => Joi.object({ |
There was a problem hiding this comment.
Also unnecessary, these are the defaults.
spalger
left a comment
There was a problem hiding this comment.
Things seem to work well, I sent lukasolson#15 to switch to a new uiExports type, and I think you could trim down the plugin specification a bit
|
guys it appears to me you're removing the Kuery autocomplete from OSS and making it into xpack only is this correct? |
|
guys it appears to me you're removing the Kuery autocomplete from OSS and making it into xpack only is this correct? |
|
@Spager @lukasolson sorry to insist but it is a quite important for those that are integrating Kibana in more complex environments where the right to modify the code is key. (basic xpack might be free but there is no right to use a modified code even if one purchases the licence ). Please advice is there a roadmap of features that used to be open source and are going to get locked? if so could you please share for us to plan. thanks in advance |
|
Hi @JackRyanson You are correct - this PR moves Kuery autocomplete from an experimental feature in OSS to Basic. Regarding your question about whether there is a roadmap to move open source features to licensed, no, not at all. We have never moved a supported feature from open source to licensed. In fact, we'd only ever consider moving supported features in the opposite direction. Kuery autocomplete doesn't fall into that box because it was experimental. Usually we'd try to have the licensing decided before we first publish a feature, but we reserve the right to make changes to experimental features. May I ask what changes you want to make to autocomplete? Are they things that would be generally useful? If so, why not try to get your changes incorporated into the released code so that they can benefit everybody? |
|
Autocomplete is pretty much the kind of things that benefits from customization in advanced integrations, the DSL might be modified e.g. with specialized functions. Just to make sure i understand this is THE core autocomplete of kibana , just released as highlight feature in 6.3 - not available anymoe in OSS from 6.4 ? (or is it something else) You talk about contributing but i dont understand : how would i possibly want to contribute to something which has a licence which prevents one from using a modified version or on modified kibana code even after paying for the licence (my current understanding of your licence) . Just to be clear, you obviously have the right to do what you want here but i do think is in everyones interest to have a clear policy, and i believe Elastic will miss out big time if you lose the ability to flexibly integrate the stack |
[uiExports] switch to new autocompleteProviders export type
💔 Build Failed |
💔 Build Failed |
💚 Build Succeeded |
* fix: move autocomplete to x-pack basic * fix: apm support * fix: renames * [uiExports] switch to new autocompleteProviders export type * fix: remove unnecessary stuff from the plugin spec
|
6.x (6.4.0): 3bbb9c5 |
By contributing, your changes would be included and you'd be able to use the default distribution, plus you will have helped others. |
|
@clintongormley the default distribution is useless in advanced integration projects. as per my previous message - "default distribution" is useless we need to integrate with other components and that goes at code level. I am not an opensource fanboy : we are using X Pack for security/alerting/support and all, but what you're doing here is extending it to where it blocks and locks Ui capabilities which are general purpose and we need to retain the ability to customize as in "you gotta use our stock or nothing". You guys - the elastic company i guess - moving in an integration unfriendly way locking stuff away with the excuse of "free" ==== FOSS is very worrisome and at least in our case will force us into alternatives to xpack, which frankly exist. It appears a lose lose for all. |
|
@lukasolson Kuery Bar in APM no longer works after this change. Going forward I think it would be a good idea to notify the teams affected by a change, so they can manually test it. |
|
@sqren Oh goodness, my fault, I manually tested APM up until that last commit (definitely should have tested there too...) |
This PR extracts the autocomplete functionality of Kibana's query language into a plugin. We intend to add additional autocomplete providers for other languages, including those provided by a basic license like SQL.
In the new platform we will have plugin contracts, and this also paves the way to accomplishing this.