-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[ML] Move Index Data Visualizer into separate plugin (Part 1) #100922
Conversation
@@ -0,0 +1,6 @@ | |||
/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this file needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for catching that. Deleted here 76a7b5b
share, | ||
security, | ||
fileUpload, | ||
indexPatternFieldEditor, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it might be worth adding a comment here to say that indexPatternFieldEditor
isn't used by the file data visualizer, but we need to add it here as we're sharing a context with the index data visualizer.
At least, that's my assumption as to why it's being added here.
Same for fileUpload
in the index data visualizer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be better to create a shared component which provides the KibanaContextProvider
wrapper. as this code is duplicated across both data visualizers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it looks like lens
should also be added to these lists of services
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for catching that. The indexPatternFieldEditor
should not have been in the file data visualizer and have been removed here 76a7b5b. For now the index data visualizer and file data visualizer have different contexts.
Also added lens
to the list of services for the index data here visualizer 267d3b7
) => { | ||
core.capabilities.registerProvider(() => { | ||
return { | ||
dataVisualizer: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don't think we need this capability at all. as the switcher does not contain any logic, this will aways be true.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point 👍 I removed capabilities registration altogether here b043d6e
@@ -0,0 +1,1385 @@ | |||
/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is a bit too big IMO.
This might be a good opportunity to separate out util functions and types to make this more manageable.
Or for a follow up...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Split up the model into other files here 403a8e3
body: results, | ||
}); | ||
} catch (e) { | ||
logger.warn(e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably be logger.error
but i'm not sure we should be just throwing the error to the log like this without any context of where it has come from.
As these errors are passed to the client for display, do we even need to add them to the kibana log?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed logging and Logger here 403a8e3
export class FileDataVisualizerPlugin implements Plugin { | ||
setup() {} | ||
start() {} | ||
export interface StartDeps { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
StartDeps
should live next to SetupDeps
This file probably isn't needed and StartDeps
can be moved to the plugin.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think originally StartDeps was in a different types
in order avoid circular dependencies because it was also used in server/routes
. For now, I moved SetupDeps
into the same file for better consistency.
|
||
type RuntimeType = typeof RUNTIME_FIELD_TYPES[number]; | ||
|
||
export const isPopulatedObject = <U extends string = string>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this has already been added to common
x-pack/plugins/data_visualizer/common/utils/object_utils.ts
There would be no harm in moving the two functions below to common too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This addition is unfortunately in the file_upload
plugin, which the data_visualizer
plugin depends on. We had to add runtime mapping support for the file_upload/time_field_range
end point in this PR and these two functions are used to validate the runtimeMappingsSchema
. I think this is something we can consolidate later once we have a way to share utility functions across all of our plugins.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah ok, sorry i missed the file path and didn't realise this was in a different plugin.
@@ -1,9 +1,9 @@ | |||
.mlDataGridChart__histogram { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do these classes need renaming when they are in ML?
The data visualizer should not rely on any styles in ML
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for catching that. Reverted the ML changes here aaf142c
getIndexDataVisualizerComponent().then(setIndexDataVisualizer); | ||
} | ||
}, []); | ||
return IndexDataVisualizer ? ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not for this PR, but it would be good to switch this and the file data viz to use React.lazy
rather than these custom lazy loaders.
file data viz has FileDataVisualizerWrapper
to do this when embedding in home
, but I didn't change how ML was doing it as I intended to change it after this PR was in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll add this item to the meta issue #101435 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
limits.yml LGTM
|
||
const [lastRefresh, setLastRefresh] = useState(0); | ||
|
||
useEffect(() => { | ||
timeBasedIndexCheck(currentIndexPattern, true); | ||
}, []); | ||
if (!currentIndexPattern.isTimeBased()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that this check and warning probably only apply when using the data visualizer inside of ML.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added this item to the meta issue #101435 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gave this a test and functionally LGTM. Just left a couple of earlier comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
💚 Build Succeeded
Metrics [docs]Module Count
Public APIs missing comments
Any counts in public APIs
Async chunks
Page load bundle
Unknown metric groupsAPI count
async chunk count
References to deprecated APIs
History
To update your PR or re-run it, just comment with: cc @qn895 |
💔 Backport failed
To backport manually run: |
* master: (54 commits) Implement "select all" rules feature (elastic#100554) [ML] Remove script fields from the Anomaly detection alerting rule executor (elastic#101607) [Security solutions][Endpoint] Update event filtering texts (elastic#101563) [Enterprise Search] Mocks/tests tech debt - avoid hungry mocking (elastic#101107) [FTR] Updates esArchive paths [FTR] Updates esArchive paths [Security Solution][Detection Engine] Adds runtime field tests (elastic#101664) Added APM PHP agent to the list of agent names (elastic#101062) [CI] Restore old version_info behavior when .git directory is present (elastic#101642) [Fleet] Add fleet server telemetry (elastic#101400) [APM] Syncs agent config settings to APM Fleet policies (elastic#100744) [esArchiver] drop support for --dir, use repo-relative paths instead (elastic#101345) Revert "[xpack/test] restore incremental: false in ts project" [Security Solution] Remove Host Isolation feature flag (elastic#101655) [xpack/test] restore incremental: false in ts project [DOCS] Adds link to video landing page (elastic#101413) [ML] Move Index Data Visualizer into separate plugin (Part 1) (elastic#100922) Improve security plugin return types (elastic#101492) [ts] migrate `x-pack/test` to composite ts project (elastic#101441) [App Search] Updated Search UI to new URL (elastic#101320) ...
Summary
This PR is a follow up of #96408 (comment) and is part of the migration to move the index based Data Visualizer into its own separate plugin. Changes include:
get_overall_stats
andget_field_stats
routes and services to internal/data_visualizerIIndexPattern
withIndexPattern
and replace deprecatedIFieldType
withIndexPatternField
RuntimeMappings
withestypes.RuntimeFields
ml
prefixruntime_mappings
support tofile_upload/time_field_range
To follow-up in future PR
data_visualizer
folderReviewer tips
plugins/ml
toplugins/file_data_visualizer
Testing the Index Data Visualizer
View in Lens
should navigate to Lens page with previously set query, time range, and prefilled chart for the fieldChecklist
Delete any items that are not applicable to this PR.