kibana/packages/kbn-data-view-utils
Felix Stürmer 051b91a47f
[Discover] Add logs source and document contexts (#184601)
## 📝 Summary

This PR adds basic implementations for resolving "logs" data source and
document contexts to their respective profiles. Due to the limited set
of profile customization points the new profiles are empty.

- closes #184079 
- closes #184080 

## 🔍 Implementation details

- In order to organize these and future profiles this PR introduces the
`profile_providers` folder in `context_awareness`.
- For a more structured organization, utilities for resolving logs
sources have been moved/implemented in the `@kbn/discover-utils` and
`@kbn/data-view-utils` packages.
- The code ownership for the two logs profiles is shared between the
data discovery team and the obs ux logs team.

### Document Level Logs Resolution
The document logs context resolution is performed with the following
criteria, as far as one complies, the context will be evaluated as a
match:
- The `data_stream.type` field exists on the document and it's equal to
`logs`
- The document contains any field from the [ECS Log field
set](https://www.elastic.co/guide/en/ecs/current/ecs-log.html) (fields
staring with `log.`)
- The `_index` field exists and tests positive against the allowed
indices from the [built-in definition/
settings](https://github.com/elastic/kibana/pull/184601/files#diff-5e1646fa4ec758a92aa38910dc047b18cb826e287a36b43e811eb5fc7a3b0fe9R28).

### Data Source Logs Resolution
The data source logs context resolution is performed with the following
criteria, as far as one complies, the context will be evaluated as a
match:
- Being the source of a data view type, the related index tests positive
against the allowed indices from the [built-in definition/
settings](https://github.com/elastic/kibana/pull/184601/files#diff-5e1646fa4ec758a92aa38910dc047b18cb826e287a36b43e811eb5fc7a3b0fe9R28).
- Being the source of a ES|QL query type, the related index extracted
from the query tests positive against the allowed indices from the
[built-in definition/
settings](https://github.com/elastic/kibana/pull/184601/files#diff-5e1646fa4ec758a92aa38910dc047b18cb826e287a36b43e811eb5fc7a3b0fe9R28).


## 🕵️‍♀️ Review notes 

> [!NOTE]
> Notes in this format have been left through the PR to give additional
context about some choices, any further feedback is welcome

---------

Co-authored-by: Davis McPhee <davis.mcphee@elastic.co>
Co-authored-by: Marco Antonio Ghiani <marcoantonio.ghiani@elastic.co>
Co-authored-by: Marco Antonio Ghiani <marcoantonio.ghiani01@gmail.com>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Kerry Gallagher <k.gallagher.05@gmail.com>
2024-06-18 12:18:07 +02:00
..
src [Discover] Add logs source and document contexts (#184601) 2024-06-18 12:18:07 +02:00
index.ts [Discover] Add logs source and document contexts (#184601) 2024-06-18 12:18:07 +02:00
jest.config.js
kibana.jsonc
package.json
README.md
tsconfig.json

@kbn/data-view-utils

Data View utilities.