[Logs] Use central log sources setting in Logs Explorer as the default data source#190438
Conversation
🤖 GitHub commentsExpand to view the GitHub comments
Just comment with:
|
03c81c0 to
af94e9a
Compare
af94e9a to
aba77bb
Compare
|
/ci |
…-sources-setting-in-logs-explorer
|
/ci |
|
/ci |
| } | ||
|
|
||
| type InitialState = LogsExplorerPublicStateUpdate; | ||
| type InitialState = LogsExplorerPublicStateUpdate & { allSelection?: AllDatasetSelection }; |
There was a problem hiding this comment.
Intersection here so that LogsExplorerPublicStateUpdate maintains it's tidy 1:1 with public state.
|
|
||
| import { AllDatasetSelection } from '../../../../common'; | ||
|
|
||
| export const DEFAULT_ALL_SELECTION = AllDatasetSelection.create({ indices: 'logs-*-*' }); |
There was a problem hiding this comment.
This is in it's own file to make sure there aren't bundle size explosions from defaults.ts.
|
Pinging @elastic/obs-ux-logs-team (Team:obs-ux-logs) |
...ability_logs_explorer/public/state_machines/observability_logs_explorer/src/state_machine.ts
Show resolved
Hide resolved
...ability_logs_explorer/public/state_machines/observability_logs_explorer/src/state_machine.ts
Outdated
Show resolved
Hide resolved
|
Overall the implementation looks good, but I have some concerns about restoring the selection. This has now pros and cons, as the selected index pattern is not hard-coded anymore but we rely on the user setting:
This might complicate things a bit, I guess it depends on what is more important, although we must admit that this makes it tricky to inspect logs anytime we get a URL with the all-log selection. IMO, restoring a URL should keep the current data source selection, including the indices, as it acts as a source of truth for the user, while it should restore the user settings when the URL has no saved state, wdyt? |
...ability_solution/logs_explorer/common/data_source_selection/hydrate_data_source_selection.ts
Show resolved
Hide resolved
Yeah, so I went back and forth on this and went with this approach. However, there's pros and cons to both as you've laid out. My leaning was that "all" should always map to "all" and users would probably drill down (select a specific dataset) for link sharing. This follows the precedent set by things like the log stream where if the link contains Equally, we could store the indices in the URL and hydrate from that. And if the user explicitly clicks "Show all logs" it would switch back to the setting value. Edit: I guess there'd also be some UI considerations. E.g if this is a hydrated version can we really show "All logs" for the button, it's all logs at the time then, so we'd probably need to list the indices in some way. So there are additional concerns. Storing the indices will also complicate the locator usages, as they'll also need to resolve the setting. Honestly, I'm not strongly drawn to either, they both have merits. @flash1293 Would you like to make a judgement call? 😁 |
|
I think it's OK to not persist the indices, but reference the setting for sharing - this is also how data views work. |
…-sources-setting-in-logs-explorer
|
@tonyghiani Thanks for the review. Based on the comment from Joe regarding the URL behaviour (keeping it as is), this should be ready for another look 👀 |
💚 Build Succeeded
Metrics [docs]Module Count
Public APIs missing comments
Async chunks
Public APIs missing exports
Page load bundle
Unknown metric groupsAPI count
async chunk count
History
To update your PR or re-run it, just comment with: cc @Kerry350 |
tonyghiani
left a comment
There was a problem hiding this comment.
Thanks for addressing the comments, good work here!
TinaHeiligers
left a comment
There was a problem hiding this comment.
.tsconfig changes LGTM
Summary
Implements https://github.com/elastic/logs-dev/issues/169.
This uses the new central log sources setting as the default data source in the Logs Explorer. The
AllSelectionis now amended to use a set of indices, thisAllSelectioncan be defined by the consumer (or falls back to a default). In the case of the Observability Logs Explorer this value is resolved from the setting and used as theAllSelectionpassed to the Logs Explorer controller.