[Logs UI] Store Logs UI settings in a dedicated infrastructure-monitoring-log-view saved object#125014
Conversation
|
@Kerry350 Thanks for taking on the review of this sizable PR ❤️ I removed the |
|
I think I've tested out everything and couldn't find any problems. The UI works as expected (including things like ML job configs). I tried out the various paths, e.g. loading straight from the new saved object vs loading from the I also verified multiple log views (I know we don't expose it, but I checked the underlying mechanism). That worked great too. I created that with the API directly, and then also tested that out in a few ways. Nice work 🙌 |
|
Took this for another spin with the changes to Singular: Multiples using import / export with newly generated IDs: For all of Fallback mechanism and Singular
Resolution worked as expected, using the last updated view as the As an example, here the import stripped two of the columns so there was only timestamp in use, this became the default view as expected. |
💚 Build SucceededMetrics [docs]Module Count
Public APIs missing comments
Async chunks
Public APIs missing exports
Page load bundle
Saved Objects .kibana field count
Unknown metric groupsAPI count
ESLint disabled line counts
References to deprecated APIs
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: cc @weltenwort |
afharo
left a comment
There was a problem hiding this comment.
SO type_registrations test LGTM!
| return await load(); | ||
| } | ||
| }, [isUninitialized, load]); | ||
| useEffect(() => { |
There was a problem hiding this comment.
LGTM 👍
Thanks for persevering with the back and forth on this PR.
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
…efineInternalLogView` with new LogViewService (#147673) ## 📝 Summary Closes #129080 With the introduction of the "log view" concept in #125014, this PR migrates all usages of the previous `defineInternalSourceConfiguration` function in the infra plugin's setup() contract to the new `logViews.defineInternalLogView` function on the contract. This affects `enterprise_search`, `monitoring` and `upgrade_assistant` plugins. **N.B.** As these usages were not following the same restrictive configuration for the attributes we have now defined in the `.defineInternalLogView` method, I made the `logViewAttributes` passed to `logViews.defineInternalLogView` merge with the `defaultLogViewAttributes`. Co-authored-by: Marco Antonio Ghiani <marcoantonio.ghiani@elastic.co> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>





📝 Summary
This replaces the concept of "log sources" (which was used the shared "source configurations" internally) with "log views", which are separate saved objects.
closes #120924
closes #100057
🆕 New and changed concepts
To fulfill the ACs of #120924 this PR introduces a few new concepts and rearranges the architecture slightly to follow the platform conventions more closely:
New
infrastructure-monitoring-log-viewsaved object typeThe new
infrastructure-monitoring-log-viewsaved object type is an extracted sub-set of the log-specific properties from the old sharedinfrastructure-ui-sourcesaved object type. Simulaneously, theindex_patternlog index reference type has been renamed todata_view.New
LogViewsService(server-side implementation, client-side implementation)
A new
LogViewsServicemediates access to the newLogViewsClienton the server and client (see below). As recommended in the platform architecture guidelines it mimicks the plugin's lifecycle:setup()it exposes aregisterInternalLogViewfunction to replace the oldregisterInternalSourceConfiguration.start()it exposesgetClient()andgetScopedClient()functions to get access toLogViewsClientinstances.start()it exposes aclientproperty to get access to a pre-scopedLogViewsClient.Jest mocks for the service are provided alongside the implementation files.
New
LogViewsClient(server-side implementation, client-side implementation)
The
LogViewsClientabstracts read and write access to the underlying saved objects as described in the lookup order in #120924.On the server it uses the
data.search,data_views,saved_object, andInfraSourceservices to facilitate get, put and resolve operations. The rest of the server-side infra plugin (e.g. the HTTP routes and the log rate metrics code) as well as other plugins should use it to access log views. To that end it's available via thelogViews.getClient()andlogViews.getScopedClient()functions on theinfraplugins start contract. The start contract is made available in the legacy dependency injectionlibsasgetStartServices().On the client it uses the
http,data.search, anddata_viewsservices to access the log view HTTP routes and resolve the log view configurations. The rest of the client-side infra plugin (e.g. the React hierarchy) as well as other plugins should use it to access log views. To that that end it's available via thelogViews.clientproperty on theinfraplugin start contract and injected into theinfrapluginsKibanaContextForPlugin. In some special cases it's also useful to directly instantiate it if a reference to the start contract cannot be obtained (currently the case in the shared log stream component, which will be improved in a follow-up step).It offers the following set of features:
missing,emptyoravailable)Jest mocks for the client are provided alongside the implementation files.
New
LogViewProvider,useLogViewContext, anduseLogViewhooks(client-side implementation)
The new
useLogViewhook integrates theLogViewsClientgiven via the argument into the React render lifecycle. It replace theuseLogSourcehook. The constate-generatedLogViewsProvideris available in the Logs UI's page hierarchy, so theuseLogViewContexthook can be used to access the hook state and functions without initiating multiple (potentially expensive) requests. Its API mimics the predecessor's with all its quirks, so it should be cleaned up in a follow-up task.A jest mock for the hook is provided alongside the implementation file.
New
/logViews/:logViewIdHTTP routes(common type definitions, HTTP API type definitions)
The new
/logViews/:logViewIdHTTP route allows the client-side client to communicate with the server-side implementation. It supports theGETmethod for reading and thePUTmethod for writing log view attributes. Since it's not a public API it should normally not be used directly, but only via the client-sideLogViewsClient. Direct access should be reserved for debugging situations.Self-sufficient log threshold rule expression
The client-side log threshold rule now wraps the lazily loaded parameter expression component into a context provider. That means it's not longer dependent on the surrounding context and can therefore access the
infraplugin'sLogViewsClientinstance even in the common rule management UI. This pattern would be applicable for the metrics rules as well.Additional notes
sourceIdcomponent props) remain un-renamed to limit the scope of the PR.➡️ Follow-up tasks
defineInternalSourceConfigurationtodefineInternalLogView#129080useLogViewinternal state and API.