Skip to content

[One Discover] Add logic to customise column header in Discover via contextual exper…#226039

Merged
achyutjhunjhunwala merged 18 commits intoelastic:mainfrom
achyutjhunjhunwala:Add-column-header-customisation-hook-via-contextual-profiles
Jul 9, 2025
Merged

[One Discover] Add logic to customise column header in Discover via contextual exper…#226039
achyutjhunjhunwala merged 18 commits intoelastic:mainfrom
achyutjhunjhunwala:Add-column-header-customisation-hook-via-contextual-profiles

Conversation

@achyutjhunjhunwala
Copy link
Contributor

@achyutjhunjhunwala achyutjhunjhunwala commented Jul 1, 2025

closes https://github.com/elastic/logs-dev/issues/187

This PR adds an extension point to update Discover Column Headers in general via Contextual Profiles. For this particular PR, we only add icons for the summary column, but this PR would enable users to completely control the column header.

Tooltip with Contextual Experience - Logs

image

Tooltip with Contextual Experience - Traces

image

Tooltip without Contextual Experience - Default

image

@achyutjhunjhunwala achyutjhunjhunwala self-assigned this Jul 1, 2025
@achyutjhunjhunwala achyutjhunjhunwala added release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting labels Jul 1, 2025
@achyutjhunjhunwala achyutjhunjhunwala requested a review from a team July 1, 2025 15:21
@achyutjhunjhunwala achyutjhunjhunwala requested review from a team as code owners July 1, 2025 15:21
@achyutjhunjhunwala achyutjhunjhunwala added the Team:obs-onboarding Observability Onboarding Team label Jul 1, 2025
@achyutjhunjhunwala achyutjhunjhunwala requested a review from a team as a code owner July 1, 2025 15:21
@elasticmachine
Copy link
Contributor

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

Copy link
Contributor

@logeekal logeekal left a comment

Choose a reason for hiding this comment

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

Hey @achyutjhunjhunwala , it will be great if you can add a demo of how this change changes UI. It helps to get some context regarding the change.

Thanks.

Copy link
Contributor

@jughosta jughosta left a comment

Choose a reason for hiding this comment

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

Hi @achyutjhunjhunwala,

Thanks for working on this new extension! Left some suggestions in comments.

@achyutjhunjhunwala
Copy link
Contributor Author

Hey @achyutjhunjhunwala , it will be great if you can add a demo of how this change changes UI. It helps to get some context regarding the change.

Thanks.

@logeekal Sorry, i missed to post it here. I added it in the original linked ticket

https://github.com/elastic/logs-dev/issues/187#issuecomment-3024117125

@kertal kertal added Feature:Discover Discover Application Project:OneDiscover Enrich Discover with contextual awareness labels Jul 2, 2025
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.

Codewise looks good to me and Julia already commented about improvements, it would be great to get a quick check on the copies.

@achyutjhunjhunwala
Copy link
Contributor Author

Codewise looks good to me and Julia already commented about improvements, it would be great to get a quick check on the copies.

@tonyghiani Thank you so much for the feedback and review. The copy has already been verified in the linked original ticket here - https://github.com/elastic/logs-dev/issues/187#issuecomment-3024167718

@achyutjhunjhunwala achyutjhunjhunwala enabled auto-merge (squash) July 7, 2025 20:09
Copy link
Contributor

@cauemarcondes cauemarcondes left a comment

Choose a reason for hiding this comment

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

LGTM

<FormattedMessage
id="discover.unifiedDataTable.tableHeader.logsContext.sourceFieldIconTooltip"
defaultMessage="Displays the most relevant resource identifiers like:{br}{br}service.name{br}host.name{br}kubernetes.pod.name{br}etc.{br}{br}followed by the log or error message.{br}if no message fields are present, it shows the full document instead"
values={{ br: <br /> }}
Copy link
Contributor

Choose a reason for hiding this comment

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

I tested it locally because the screenshots you shared didn’t quite match the content, just wanted to double check how it looked in the UI.

In the logs one, for example, it feels a bit off: there are line breaks, some sentences start without a capital letter after a dot, and the final dot is missing.
Screenshot 2025-07-08 at 09 06 11

Copy link
Contributor Author

@achyutjhunjhunwala achyutjhunjhunwala Jul 8, 2025

Choose a reason for hiding this comment

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

@iblancof The text was changed after the demo session to the team last week.I will update the screenshot in the description of this PR now.

The text and design both are indeed intended.

Line breaks are required here to make this list looks more readable.
The whole thing is a single sentence, just formatted like this.

Good catch on the period at the end of the sentence, and the missing capitalisation at start of the sentence. i will add that

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed e366f15

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for sharing the context and making those small tweaks!

Copy link
Contributor

Choose a reason for hiding this comment

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

Agree with @iblancof that the tooltip content looks off. Even after the latest changes. Too many line breaks reduces readability of it.

Also instead of:

servicen.name
host.name
kubernetes.pod.name
etc

we could rather show it as a list:

- servicen.name
- host.name
- kubernetes.pod.name
- etc

Copy link
Contributor

Choose a reason for hiding this comment

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

Or rewrite it as 2 paragraphs:

Displays the most relevant resource identifiers (service.name, host.name, kubernetes.pod.name, etc) followed by the log or error message.
If no message-fields are present, it shows key:value pairs for the available fields.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jughosta This design has been discussed multiple times and already approved by the Product team (cc: @LucaWintergerst)

Too many line breaks may be makes it difficult to read it in the code, but the intention here is to make it more readable to end user.

I like the suggestion to make it as a list adding the hyphens.

Unfortunately this could have been better handled inside a EuiPopover but given EUI guidenlines, we cannot use a Popover for onHover triggers.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please check the description for updated Screenshot

@achyutjhunjhunwala
Copy link
Contributor Author

@logeekal @jughosta Can you both please have a look on the PR and provide the final approval

Copy link
Contributor

@logeekal logeekal left a comment

Choose a reason for hiding this comment

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

Thanks for reminder. I did the desk testing of Security solution and changes look good.

Copy link
Contributor

@jughosta jughosta left a comment

Choose a reason for hiding this comment

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

Thanks for the changes!

...column,
display: (
<DataTableSummaryColumnHeaderLogsContext
columnDisplayName={column.displayAsText}
Copy link
Contributor

Choose a reason for hiding this comment

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

It will be controlled then by another logic

const columnDisplayName = getColumnDisplayName(
columnName,
dataViewField?.displayName,
columnDisplay
);

Suggested change
columnDisplayName={column.displayAsText}

If the prop is removed, then it would use the new default value which you defined in src/platform/packages/shared/kbn-unified-data-table/src/components/data_table_summary_column_header.tsx

Copy link
Contributor Author

@achyutjhunjhunwala achyutjhunjhunwala Jul 9, 2025

Choose a reason for hiding this comment

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

May be this is the intended behaviour.

How i see this is, the column get passed as a prop to this customisation which is used to render the column header. Now i want to keep the existing logic as much a possible and only apply customisation where required.

Meaning the columnDisplayNameis currently controlled via this function getColumnDisplayName. If tomorrow someone does some changes to this generic function, every other usage of this customisation would automatically inherit it.

whereas the default handling logic would handle situation where a generic customisation decided to completely remove the name, which wouldn't be ideal


return (
<UnifiedDataTableSummaryColumnHeader
columnDisplayName={columnDisplayName}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
columnDisplayName={columnDisplayName}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

same as above

...column,
display: (
<DataTableSummaryColumnHeaderTracesContext
columnDisplayName={column.displayAsText}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
columnDisplayName={column.displayAsText}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

same as above


return (
<UnifiedDataTableSummaryColumnHeader
columnDisplayName={columnDisplayName}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
columnDisplayName={columnDisplayName}

<FormattedMessage
id="discover.unifiedDataTable.tableHeader.logsContext.sourceFieldIconTooltip"
defaultMessage="Displays the most relevant resource identifiers like:{br}{br}service.name{br}host.name{br}kubernetes.pod.name{br}etc.{br}{br}followed by the log or error message.{br}if no message fields are present, it shows the full document instead"
values={{ br: <br /> }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Agree with @iblancof that the tooltip content looks off. Even after the latest changes. Too many line breaks reduces readability of it.

Also instead of:

servicen.name
host.name
kubernetes.pod.name
etc

we could rather show it as a list:

- servicen.name
- host.name
- kubernetes.pod.name
- etc

<FormattedMessage
id="discover.unifiedDataTable.tableHeader.logsContext.sourceFieldIconTooltip"
defaultMessage="Displays the most relevant resource identifiers like:{br}{br}service.name{br}host.name{br}kubernetes.pod.name{br}etc.{br}{br}followed by the log or error message.{br}if no message fields are present, it shows the full document instead"
values={{ br: <br /> }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Or rewrite it as 2 paragraphs:

Displays the most relevant resource identifiers (service.name, host.name, kubernetes.pod.name, etc) followed by the log or error message.
If no message-fields are present, it shows key:value pairs for the available fields.

@achyutjhunjhunwala achyutjhunjhunwala merged commit 1d6038d into elastic:main Jul 9, 2025
12 checks passed
@achyutjhunjhunwala achyutjhunjhunwala deleted the Add-column-header-customisation-hook-via-contextual-profiles branch July 9, 2025 13:06
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
cloudSecurityPosture 714 715 +1
discover 1462 1465 +3
esqlDataGrid 445 446 +1
lens 1446 1447 +1
securitySolution 7838 7839 +1
slo 1300 1301 +1
total +8

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
@kbn/unified-data-table 93 100 +7

Async chunks

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

id before after diff
cloudSecurityPosture 555.0KB 555.9KB +866.0B
discover 1.1MB 1.1MB -850.0B
esqlDataGrid 157.2KB 158.1KB +865.0B
securitySolution 9.8MB 9.8MB +865.0B
slo 988.7KB 989.6KB +871.0B
total +2.6KB

Page load bundle

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

id before after diff
cloudSecurityPosture 19.0KB 19.0KB -1.0B
discover 22.5KB 22.5KB +36.0B
total +35.0B
Unknown metric groups

API count

id before after diff
@kbn/unified-data-table 102 109 +7

async chunk count

id before after diff
discover 39 40 +1

History

cc @achyutjhunjhunwala

kertal pushed a commit to kertal/kibana that referenced this pull request Jul 25, 2025
…ontextual exper… (elastic#226039)

closes elastic/logs-dev#187

This PR adds an extension point to update Discover Column Headers in
general via Contextual Profiles. For this particular PR, we only add
icons for the summary column, but this PR would enable users to
completely control the column header.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting Feature:Discover Discover Application Project:OneDiscover Enrich Discover with contextual awareness release_note:skip Skip the PR/issue when compiling release notes Team:obs-onboarding Observability Onboarding Team v9.2.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants