Skip to content

Conversation

@MiriamAparicio
Copy link
Contributor

@MiriamAparicio MiriamAparicio commented Jun 17, 2025

Closes #221927

Summary

New Component: AttributesOverview

  • Introduced a new component to provide a unified, user-friendly overview of document attributes in the Observability context.
  • The component organizes attributes into three main groups:
    • Signal attributes (e.g., attributes.*)
    • Resource attributes (e.g., resource.attributes.*)
    • Scope attributes (e.g., scope.attributes.*)
  • Each group is rendered in its own accordion section for clarity and ease of navigation.

Search and Filtering

  • Added a search bar to filter attribute fields by name or value, improving discoverability.
  • Filtering logic ensures only relevant fields are shown in each section, based on both prefix and search term.

Table Actions for Fields

  • Each attribute row in the table now includes cell actions, allowing users to:
  • Filter by field value directly from the table.
  • Add or remove fields as columns in Discover with a single click.
  • These actions improve workflow efficiency and align with Discover’s interactive capabilities.

Integration

  • The new overview is integrated into the unified doc viewer, replacing or enhancing previous attribute display mechanisms.
  • Each accordion section uses the AttributesAccordion and AttributesTable components.

Result

The new attributes overview provides a clear, organized, and filterable view of all relevant document attributes, improving usability and consistency across the Observability UI.

image

image

Test:

How to generate OTel data

How to test

  • Make sure your solution view is Observability
  • update your kibana.yml
discover.experimental.enabledProfiles:
   - observability-root-profile-with-attributes-tab
   #  if you want to test it with the additional profiles add the following to your `kibana.yaml` 
   - observability-traces-data-source-profile
   - observability-traces-transaction-document-profile
   - observability-traces-span-document-profile

@MiriamAparicio MiriamAparicio added backport:skip This PR does not require backporting release_note:feature Makes this part of the condensed release notes Team:obs-ux-infra_services - DEPRECATED DEPRECATED - Use Team:obs-presentation. v9.1.0 labels Jun 17, 2025
@MiriamAparicio MiriamAparicio marked this pull request as ready for review June 17, 2025 10:31
@MiriamAparicio MiriamAparicio requested review from a team as code owners June 17, 2025 10:31
@elasticmachine
Copy link
Contributor

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

@MiriamAparicio MiriamAparicio added backport:version Backport to applied version labels v8.19.0 and removed backport:skip This PR does not require backporting labels Jun 17, 2025
Copy link
Contributor

@rmyz rmyz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

onAddColumn,
onRemoveColumn,
}: DocViewRenderProps) {
const [containerRef, setContainerRef] = useState<HTMLDivElement | null>(null);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not useRef here instead of useState? That's usually recommended when dealing with refs

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you're right, I changed at some point and don't remember why

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now, I remembered why I changed, using useRef, the containerHeight is not working, we needed so it not scrolls the tabs up

Screen.Recording.2025-06-18.at.08.56.32.mov

So, I checked how was done in table.tsx in platform, and they make it work with useState

type DataStreamType = 'logs' | 'metrics' | 'traces' | undefined;

export function getDataStreamType(record: DataTableRecord): DataStreamType {
const types = getFieldValue(record, 'data_stream.type') as string[] | undefined;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this type assertion needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added it because ts was complaining that getFieldValue return unknown

Comment on lines +126 to +128
const containerHeight = containerRef
? getTabContentAvailableHeight(containerRef, decreaseAvailableHeightBy ?? DEFAULT_MARGIN_BOTTOM)
: 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: since we need a ref for some rendering should this be a useLayoutEffect/useEffect + useState?

Copy link
Contributor Author

@MiriamAparicio MiriamAparicio Jun 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi @AlexGPlay, that's what also @crespocarlos commented, I used the same as in table.tsx to not scroll the tabs, see my comment here
I'm open to find a better solution if you have a suggestion

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no worries then, it's pretty similar to the useEffect + useState solution in terms of re-renders and this one looks good 👍

Copy link
Contributor

@tonyghiani tonyghiani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes to get_doc_viewer LGTM 👌

Copy link
Contributor

@crespocarlos crespocarlos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for the changes.

@elasticmachine
Copy link
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #93 / Entity Analytics - Entity Store @ess Host transform logic Install Entity Store and test Host transform "before each" hook for "Should return 200 and status 'running' for all engines"

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
unifiedDocViewer 326 332 +6

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
unifiedDocViewer 15 16 +1

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
discover 1.1MB 1.1MB +42.0B
unifiedDocViewer 222.5KB 229.4KB +6.9KB
total +6.9KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
unifiedDocViewer 12.7KB 13.0KB +245.0B
Unknown metric groups

API count

id before after diff
unifiedDocViewer 22 24 +2

async chunk count

id before after diff
unifiedDocViewer 10 12 +2

ESLint disabled line counts

id before after diff
unifiedDocViewer 10 11 +1

Total ESLint disabled count

id before after diff
unifiedDocViewer 10 11 +1

History

@MiriamAparicio MiriamAparicio merged commit 04116c4 into elastic:main Jun 18, 2025
10 checks passed
@MiriamAparicio MiriamAparicio deleted the 221927-discover-attributes-accordions branch June 18, 2025 14:05
@kibanamachine
Copy link
Contributor

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jun 18, 2025
Closes elastic#221927

## Summary

#### New Component: `AttributesOverview`

- Introduced a new component to provide a unified, user-friendly
overview of document attributes in the Observability context.
- The component organizes attributes into three main groups:
  - Signal attributes (e.g., attributes.*)
  - Resource attributes (e.g., resource.attributes.*)
  - Scope attributes (e.g., scope.attributes.*)
- Each group is rendered in its own accordion section for clarity and
ease of navigation.

#### Search and Filtering

- Added a search bar to filter attribute fields by name or value,
improving discoverability.
- Filtering logic ensures only relevant fields are shown in each
section, based on both prefix and search term.

#### Table Actions for Fields

- Each attribute row in the table now includes cell actions, allowing
users to:
- Filter by field value directly from the table.
- Add or remove fields as columns in Discover with a single click.
- These actions improve workflow efficiency and align with Discover’s
interactive capabilities.

#### Integration

- The new overview is integrated into the unified doc viewer, replacing
or enhancing previous attribute display mechanisms.
- Each accordion section uses the `AttributesAccordion` and
`AttributesTable` components.

#### Result
The new attributes overview provides a clear, organized, and filterable
view of all relevant document attributes, improving usability and
consistency across the Observability UI.

<img width="770" alt="image"
src="https://github.com/user-attachments/assets/36fee343-fe63-4c55-ab37-0317a8512abf"
/>

![image](https://github.com/user-attachments/assets/8e1b2aea-5354-418b-a84f-1fd077502563)

### Test:
#### How to generate OTel data
- Follow
https://github.com/smith/elastic-stack-docker-compose?tab=readme-ov-file#elastic-stack-docker-compose

#### How to test
- Make sure your solution view is Observability
- update your `kibana.yml`

```
discover.experimental.enabledProfiles:
   - observability-root-profile-with-attributes-tab
   #  if you want to test it with the additional profiles add the following to your `kibana.yaml`
   - observability-traces-data-source-profile
   - observability-traces-transaction-document-profile
   - observability-traces-span-document-profile
```

(cherry picked from commit 04116c4)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.19

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Jun 18, 2025
…#224435)

# Backport

This will backport the following commits from `main` to `8.19`:
- [[ObsUX] Add accordion sections and attributes tables
(#224185)](#224185)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT
[{"author":{"name":"Miriam","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-06-18T14:05:48Z","message":"[ObsUX]
Add accordion sections and attributes tables (#224185)\n\nCloses
https://github.com/elastic/kibana/issues/221927\n\n## Summary\n\n####
New Component: `AttributesOverview`\n\n- Introduced a new component to
provide a unified, user-friendly\noverview of document attributes in the
Observability context.\n- The component organizes attributes into three
main groups:\n - Signal attributes (e.g., attributes.*)\n - Resource
attributes (e.g., resource.attributes.*)\n - Scope attributes (e.g.,
scope.attributes.*)\n- Each group is rendered in its own accordion
section for clarity and\nease of navigation.\n\n#### Search and
Filtering\n\n- Added a search bar to filter attribute fields by name or
value,\nimproving discoverability.\n- Filtering logic ensures only
relevant fields are shown in each\nsection, based on both prefix and
search term.\n\n#### Table Actions for Fields\n\n- Each attribute row in
the table now includes cell actions, allowing\nusers to:\n- Filter by
field value directly from the table.\n- Add or remove fields as columns
in Discover with a single click.\n- These actions improve workflow
efficiency and align with Discover’s\ninteractive capabilities.\n\n####
Integration\n\n- The new overview is integrated into the unified doc
viewer, replacing\nor enhancing previous attribute display
mechanisms.\n- Each accordion section uses the `AttributesAccordion`
and\n`AttributesTable` components.\n\n#### Result\nThe new attributes
overview provides a clear, organized, and filterable\nview of all
relevant document attributes, improving usability and\nconsistency
across the Observability UI.\n\n<img width=\"770\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/36fee343-fe63-4c55-ab37-0317a8512abf\"\n/>\n\n\n![image](https://github.com/user-attachments/assets/8e1b2aea-5354-418b-a84f-1fd077502563)\n\n###
Test:\n#### How to generate OTel data\n-
Follow\nhttps://github.com/smith/elastic-stack-docker-compose?tab=readme-ov-file#elastic-stack-docker-compose\n\n####
How to test\n- Make sure your solution view is Observability\n- update
your `kibana.yml` \n\n```\ndiscover.experimental.enabledProfiles:\n -
observability-root-profile-with-attributes-tab\n # if you want to test
it with the additional profiles add the following to your `kibana.yaml`
\n - observability-traces-data-source-profile\n -
observability-traces-transaction-document-profile\n -
observability-traces-span-document-profile\n```","sha":"04116c4d15b28153ac42015607b75a683f573b5a","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:feature","Team:obs-ux-infra_services","backport:version","v9.1.0","v8.19.0"],"title":"[ObsUX]
Add accordion sections and attributes
tables","number":224185,"url":"https://github.com/elastic/kibana/pull/224185","mergeCommit":{"message":"[ObsUX]
Add accordion sections and attributes tables (#224185)\n\nCloses
https://github.com/elastic/kibana/issues/221927\n\n## Summary\n\n####
New Component: `AttributesOverview`\n\n- Introduced a new component to
provide a unified, user-friendly\noverview of document attributes in the
Observability context.\n- The component organizes attributes into three
main groups:\n - Signal attributes (e.g., attributes.*)\n - Resource
attributes (e.g., resource.attributes.*)\n - Scope attributes (e.g.,
scope.attributes.*)\n- Each group is rendered in its own accordion
section for clarity and\nease of navigation.\n\n#### Search and
Filtering\n\n- Added a search bar to filter attribute fields by name or
value,\nimproving discoverability.\n- Filtering logic ensures only
relevant fields are shown in each\nsection, based on both prefix and
search term.\n\n#### Table Actions for Fields\n\n- Each attribute row in
the table now includes cell actions, allowing\nusers to:\n- Filter by
field value directly from the table.\n- Add or remove fields as columns
in Discover with a single click.\n- These actions improve workflow
efficiency and align with Discover’s\ninteractive capabilities.\n\n####
Integration\n\n- The new overview is integrated into the unified doc
viewer, replacing\nor enhancing previous attribute display
mechanisms.\n- Each accordion section uses the `AttributesAccordion`
and\n`AttributesTable` components.\n\n#### Result\nThe new attributes
overview provides a clear, organized, and filterable\nview of all
relevant document attributes, improving usability and\nconsistency
across the Observability UI.\n\n<img width=\"770\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/36fee343-fe63-4c55-ab37-0317a8512abf\"\n/>\n\n\n![image](https://github.com/user-attachments/assets/8e1b2aea-5354-418b-a84f-1fd077502563)\n\n###
Test:\n#### How to generate OTel data\n-
Follow\nhttps://github.com/smith/elastic-stack-docker-compose?tab=readme-ov-file#elastic-stack-docker-compose\n\n####
How to test\n- Make sure your solution view is Observability\n- update
your `kibana.yml` \n\n```\ndiscover.experimental.enabledProfiles:\n -
observability-root-profile-with-attributes-tab\n # if you want to test
it with the additional profiles add the following to your `kibana.yaml`
\n - observability-traces-data-source-profile\n -
observability-traces-transaction-document-profile\n -
observability-traces-span-document-profile\n```","sha":"04116c4d15b28153ac42015607b75a683f573b5a"}},"sourceBranch":"main","suggestedTargetBranches":["8.19"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/224185","number":224185,"mergeCommit":{"message":"[ObsUX]
Add accordion sections and attributes tables (#224185)\n\nCloses
https://github.com/elastic/kibana/issues/221927\n\n## Summary\n\n####
New Component: `AttributesOverview`\n\n- Introduced a new component to
provide a unified, user-friendly\noverview of document attributes in the
Observability context.\n- The component organizes attributes into three
main groups:\n - Signal attributes (e.g., attributes.*)\n - Resource
attributes (e.g., resource.attributes.*)\n - Scope attributes (e.g.,
scope.attributes.*)\n- Each group is rendered in its own accordion
section for clarity and\nease of navigation.\n\n#### Search and
Filtering\n\n- Added a search bar to filter attribute fields by name or
value,\nimproving discoverability.\n- Filtering logic ensures only
relevant fields are shown in each\nsection, based on both prefix and
search term.\n\n#### Table Actions for Fields\n\n- Each attribute row in
the table now includes cell actions, allowing\nusers to:\n- Filter by
field value directly from the table.\n- Add or remove fields as columns
in Discover with a single click.\n- These actions improve workflow
efficiency and align with Discover’s\ninteractive capabilities.\n\n####
Integration\n\n- The new overview is integrated into the unified doc
viewer, replacing\nor enhancing previous attribute display
mechanisms.\n- Each accordion section uses the `AttributesAccordion`
and\n`AttributesTable` components.\n\n#### Result\nThe new attributes
overview provides a clear, organized, and filterable\nview of all
relevant document attributes, improving usability and\nconsistency
across the Observability UI.\n\n<img width=\"770\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/36fee343-fe63-4c55-ab37-0317a8512abf\"\n/>\n\n\n![image](https://github.com/user-attachments/assets/8e1b2aea-5354-418b-a84f-1fd077502563)\n\n###
Test:\n#### How to generate OTel data\n-
Follow\nhttps://github.com/smith/elastic-stack-docker-compose?tab=readme-ov-file#elastic-stack-docker-compose\n\n####
How to test\n- Make sure your solution view is Observability\n- update
your `kibana.yml` \n\n```\ndiscover.experimental.enabledProfiles:\n -
observability-root-profile-with-attributes-tab\n # if you want to test
it with the additional profiles add the following to your `kibana.yaml`
\n - observability-traces-data-source-profile\n -
observability-traces-transaction-document-profile\n -
observability-traces-span-document-profile\n```","sha":"04116c4d15b28153ac42015607b75a683f573b5a"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Miriam <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:version Backport to applied version labels release_note:feature Makes this part of the condensed release notes Team:obs-ux-infra_services - DEPRECATED DEPRECATED - Use Team:obs-presentation. v8.19.0 v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Discover][OTel] Add accordion sections for Attributes tab

7 participants