Skip to content
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

[Discover] Smart Fields #181674

Open
2 of 5 tasks
Kerry350 opened this issue Apr 25, 2024 · 1 comment
Open
2 of 5 tasks

[Discover] Smart Fields #181674

Kerry350 opened this issue Apr 25, 2024 · 1 comment
Assignees
Labels
Project:OneDiscover Enrich Discover with contextual awareness / Merge with Logs Explorer Team:obs-ux-logs Observability Logs User Experience Team

Comments

@Kerry350
Copy link
Contributor

Kerry350 commented Apr 25, 2024

Summary

Smart Fields (originally implemented here: #177626) should be migrated to the Discover codebase, this includes the actual virtual columns code (e.g. for resource and content) as we need to be able to render and display those fields if they are selected.

For the initial version of this code pushdown we will lean on the current customisation framework to say "yes, render logs fields". This will only be a temporary stopgap until the data type contextual awareness is live in Discover.

Reviews

(See also tasklist)

  • To keep the reviews smaller and simpler this will likely be split in to multiple pieces (this will also assist with PTO landing in the middle):
    • Pushdown into Discover whilst maintaining feature parity (this will mostly involve files moving rather than new code)
    • Move functional tests (this will come at a later stage as we will need the real contextual awareness in Discover, at first tests can stay in Logs Explorer)
    • Fix bugs listed below

Bugs

Either in the initial PR or followup PRs we should also fix bugs caused by Smart Fields:

Acceptance Criteria:

  • Smart Fields can be selected in the Unified Field List
  • When Smart Fields are selected their content (virtual columns) can be rendered
  • The code for this should live in Discover (bar the data type decision, which will temporarily fall to Logs Explorer still)

Image reference:

Image
Image

Tasks

@Kerry350 Kerry350 self-assigned this Apr 25, 2024
@botelastic botelastic bot added the needs-team Issues missing a team label label Apr 25, 2024
@Kerry350 Kerry350 added the Team:obs-ux-logs Observability Logs User Experience Team label Apr 25, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/obs-ux-logs-team (Team:obs-ux-logs)

@botelastic botelastic bot removed the needs-team Issues missing a team label label Apr 25, 2024
@Kerry350 Kerry350 changed the title Smart fields [Discover] Smart Fields Apr 25, 2024
@davismcphee davismcphee added the Project:OneDiscover Enrich Discover with contextual awareness / Merge with Logs Explorer label Apr 30, 2024
Kerry350 added a commit that referenced this issue May 16, 2024
…#181870)

## Summary

Implements **part one** of
#181674.

The main focus here is to get the code for Smart Fields and Virtual
Columns located within Discover. Whilst some hooks have been added to
decide what to register / render these should most definitely be treated
as "subject to change" once the real data type context awareness lands
in Discover. For now these hooks rely on the old extension points to say
"yes, this is a logs context". As far as I could see other solutions are
not using the extension points that have been temporarily altered here.

As this is functionality related to a data type (logs) and not a
solution (observability, for example) this is all treated as a first
class citizen. Some code has been moved to the `discover-utils`.

## Reviewer notes

- Nothing should really have *changed*, this is mostly about verifying
that the Smart Fields and Virtual Columns still work as expected when
using Logs Explorer (and that core Discover still works as expected).
Please also check the Flyout still works as expected as this was rebased
on top of https://github.com/elastic/kibana/pull/180262/files and there
were some conflicts between file relocation in the two.

- There are a couple of components now duplicated in Discover and Logs
Explorer as the `actions` column still uses them and hasn't been moved
across yet.

<img width="306" alt="Screenshot 2024-04-28 at 15 39 15"
src="https://github.com/elastic/kibana/assets/471693/7b56df75-8b0b-41a7-8f15-f1066ef269d7">
<img width="1183" alt="Screenshot 2024-04-28 at 15 39 21"
src="https://github.com/elastic/kibana/assets/471693/167ab53c-9e86-464d-9622-86d87b311b46">

---------

Co-authored-by: Achyut Jhunjhunwala <achyut.jhunjhunwala@elastic.co>
Kerry350 added a commit that referenced this issue Jun 3, 2024
…tab when using Smart Fields (#184172)

## Summary

This addresses the bugs listed in
#181674
(#181621 and
#178970).

Smart Fields are compound fields, as such there is no "real" backing
field for them. In these scenarios where we can't use them directly we
fall back to the `fallbackFields` configured for them.

[@amyjtechwriter please could you check the
copy](#181621 (comment)).
I think `derived from...` would have sounded better, but it felt at odds
with the scenario where you might specifically pick a field that is also
a fallback field for a smart field.

## Reviewer notes

- There were quite a lot of cross cutting concerns here between the
`unified-field-list`, `unified-data-table`, core Discover code,
`discover-utils`, and the `data_vizualizer` plugin for the field
statistics table. Where I'd have liked to potentially put more things in
the discover-utils it wasn't possible due to circular project
references.

- I've not added any functional tests for now as we'd be adding them to
the Observability Logs Explorer which is going to be deprecated in due
course. This ties in with part three of
#181674.

- A `renderFieldName` prop has been added to the field statistics table,
this seemed to be the least intrusive way forward rather than a new /
comprehensive cell rendering change (similar to the external cell
renderers).

- I've used the original
[`fallbackFields`](https://github.com/elastic/kibana/blob/main/src/plugins/discover/common/data_types/logs/constants.ts#L35)
configurations but the [virtual column components actually render a bit
extra](https://github.com/elastic/kibana/blob/main/packages/kbn-discover-utils/src/utils/get_message_field_with_fallbacks.ts#L13).
Am I missing anything with regards to potentially extending the
`fallbackFields` definitions?

## Screenshots

<img width="1253" alt="Screenshot 2024-05-23 at 20 25 57"
src="https://github.com/elastic/kibana/assets/471693/c2982f45-c8fa-4caa-935d-7007745ae2ce">

<img width="1477" alt="Screenshot 2024-05-23 at 20 26 21"
src="https://github.com/elastic/kibana/assets/471693/3145fbd1-071e-42fd-a94d-beb15c29c739">

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Davis McPhee <davis.mcphee@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Project:OneDiscover Enrich Discover with contextual awareness / Merge with Logs Explorer Team:obs-ux-logs Observability Logs User Experience Team
Projects
None yet
Development

No branches or pull requests

3 participants