Skip to content

[Logs] Replace log stream component#219425

Merged
achyutjhunjhunwala merged 54 commits intoelastic:mainfrom
achyutjhunjhunwala:replace-log-stream-component
Jun 19, 2025
Merged

[Logs] Replace log stream component#219425
achyutjhunjhunwala merged 54 commits intoelastic:mainfrom
achyutjhunjhunwala:replace-log-stream-component

Conversation

@achyutjhunjhunwala
Copy link
Contributor

@achyutjhunjhunwala achyutjhunjhunwala commented Apr 28, 2025

Summary

closes https://github.com/elastic/logs-dev/issues/111
closes #200668
closes https://github.com/elastic/opentelemetry-dev/issues/792
closes #89042
closes #221746
closes #91717
closes #91717

The PR does the following

  • Enhances the enableDocumentViewer API in the Embeddable to also hide Quality issues and Stacktrace Columns for obs context when the expand icon is also hidden

  • Add a Columns Props the the embeddable so that a new profile is not required to be created when custom columns are required

  • Replaces Log Stream component in all remaining places

  • APM - Transactions Details Page

image
  • Logs tab in the hosts' view page
image
  • Logs Tab in Host Detail view
image
  • Logs Tab in the Flyout from the main Hosts page
image
  • Fleet Agent Logs
image
  • Logs Categories Page
image

What's Pending ?

Code for the old Log Stream Component will be cleaned up in the following PR

@achyutjhunjhunwala achyutjhunjhunwala self-assigned this May 28, 2025
@achyutjhunjhunwala achyutjhunjhunwala added backport:version Backport to applied version labels v8.19.0 Feature:Discover Discover Application Feature:Logs UI Logs UI feature Team:obs-onboarding Observability Onboarding Team release_note:skip Skip the PR/issue when compiling release notes labels May 28, 2025
Copy link
Contributor

@juliaElastic juliaElastic left a comment

Choose a reason for hiding this comment

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

LGTM

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.

LGTM!

Copy link
Contributor

@davismcphee davismcphee left a comment

Choose a reason for hiding this comment

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

The log stream embeddable approach seems ok overall, but I'd really like to avoid special paths in the Discover embeddable to account for it. Could we please try something similar to my suggestion to avoid it instead?

if (!dataView) {
try {
// Try to load with the "All logs" data view ID. This is faster
dataView = await dataService.dataViews.get(ALL_LOGS_DATA_VIEW_ID);
Copy link
Contributor

Choose a reason for hiding this comment

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

I wouldn't block the PR over it, but I don't really think this is necessary. It causes a 404 response whenever the cached data view doesn't exist yet, and using dataViews.create will already check the cache for a data view with a matching ID before creating one by default. The only perf hit incurred by skipping this and always calling create would be from getFlattenedLogSources, which I imagine is negligible.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for clarifying this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also the logsDataAccess pluggin is an optional dependency in Discover. Do you think it should be a requiredPluggin ? That would make certain checks easier

Copy link
Contributor

Choose a reason for hiding this comment

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

That's a great question, and tbh I'm not 100% sure 🙃 All of our required plugins are outside of x-pack so maybe there's some restriction there, but some of the optional ones are actually required for Discover to work (e.g. Lens). So I think we can expect it will always be there at runtime, but your fallback logic will at least protect against it regardless. No need to wait for this PR, but now that you raised it I'm gonna ask operations.

});

// We register the saved search embeddable factory for the log stream embeddable to support old log stream panels.
plugins.embeddable.registerReactEmbeddableFactory('LOG_STREAM_EMBEDDABLE', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't love the idea of having the legacy o11y log stream embeddable registered from Discover, but I also can't think of a good alternative considering it depends on the Discover embeddable factory... We'll just be sure to ping the Logs UX team if we get any bug reports 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah unfortunately, i had to do this. I tried porting dependencies to Infra but it turned out to be a nightmare so i had to do it the other way.

Good part is we have Telemetry captured for the number of clusters using this Panel. Once we see this going to 0, we can plan to remove it completely may be.

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed, definitely not worth trying to port it, and good to know we have telemetry on this.

Copy link
Contributor

@davismcphee davismcphee left a comment

Choose a reason for hiding this comment

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

Data Discovery changes LGTM 👍 Thanks for making adjustments to the embeddable approach!

type: LEGACY_LOG_STREAM_EMBEDDABLE,
buildEmbeddable: async ({ initialState, ...restParams }) => {
const searchSource = await discoverServices.data.search.searchSource.create();
let fallbackPattern = 'logs-*-*';
Copy link
Contributor

Choose a reason for hiding this comment

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

Good idea with the fallback to ensure we always have an index pattern available 👍

if (!dataView) {
try {
// Try to load with the "All logs" data view ID. This is faster
dataView = await dataService.dataViews.get(ALL_LOGS_DATA_VIEW_ID);
Copy link
Contributor

Choose a reason for hiding this comment

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

That's a great question, and tbh I'm not 100% sure 🙃 All of our required plugins are outside of x-pack so maybe there's some restriction there, but some of the optional ones are actually required for Discover to work (e.g. Lens). So I think we can expect it will always be there at runtime, but your fallback logic will at least protect against it regardless. No need to wait for this PR, but now that you raised it I'm gonna ask operations.

});

// We register the saved search embeddable factory for the log stream embeddable to support old log stream panels.
plugins.embeddable.registerReactEmbeddableFactory('LOG_STREAM_EMBEDDABLE', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed, definitely not worth trying to port it, and good to know we have telemetry on this.

@achyutjhunjhunwala achyutjhunjhunwala enabled auto-merge (squash) June 19, 2025 09:43
@achyutjhunjhunwala achyutjhunjhunwala merged commit d9ebb93 into elastic:main Jun 19, 2025
11 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.19

https://github.com/elastic/kibana/actions/runs/15756729781

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
discover 1320 1321 +1
fleet 1179 1249 +70
infra 1470 1443 -27
total +44

Async chunks

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

id before after diff
apm 2.6MB 2.6MB +280.0B
discover 1.1MB 1.1MB +1.5KB
fleet 1.8MB 1.8MB +2.4KB
infra 1.2MB 1.1MB -61.8KB
total -57.6KB

Page load bundle

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

id before after diff
apm 35.5KB 35.4KB -140.0B
discover 21.5KB 21.8KB +229.0B
fleet 168.2KB 168.2KB +38.0B
infra 50.3KB 50.0KB -354.0B
total -227.0B
Unknown metric groups

async chunk count

id before after diff
fleet 9 10 +1
infra 30 29 -1
total -0

History

cc @achyutjhunjhunwala

@kibanamachine
Copy link
Contributor

💔 All backports failed

Status Branch Result
8.19 Backport failed because of merge conflicts

Manual backport

To create the backport manually run:

node scripts/backport --pr 219425

Questions ?

Please refer to the Backport tool documentation

@achyutjhunjhunwala
Copy link
Contributor Author

💚 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

achyutjhunjhunwala added a commit that referenced this pull request Jun 22, 2025
# Backport

This will backport the following commits from `main` to `8.19`:
- [[Logs] Replace log stream component
(#219425)](#219425)

<!--- Backport version: 10.0.1 -->

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

<!--BACKPORT [{"author":{"name":"Achyut
Jhunjhunwala","email":"achyut.jhunjhunwala@elastic.co"},"sourceCommit":{"committedDate":"2025-06-19T11:26:50Z","message":"[Logs]
Replace log stream component (#219425)\n\n## Summary\n\ncloses
https://github.com/elastic/logs-dev/issues/111\ncloses
https://github.com/elastic/kibana/issues/200668\ncloses
https://github.com/elastic/opentelemetry-dev/issues/792\ncloses
https://github.com/elastic/kibana/issues/89042\ncloses
https://github.com/elastic/kibana/issues/221746\ncloses
https://github.com/elastic/kibana/issues/91717\ncloses
https://github.com/elastic/kibana/issues/91717\n\n\nThe PR does the
following\n\n- Enhances the `enableDocumentViewer` API in the Embeddable
to also hide\nQuality issues and Stacktrace Columns for obs context when
the expand\nicon is also hidden\n- Add a `Columns` Props the the
embeddable so that a new profile is not\nrequired to be created when
custom columns are required\n- Replaces Log Stream component in all
remaining places\n\n- [x] APM - Transactions Details Page\n\n<img
width=\"849\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/74e0469b-eecb-461f-98f5-5f0e51f30a59\"\n/>\n\n-
[x] Logs tab in the hosts' view page\n\n<img width=\"1546\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/aae48330-42ca-4717-8cba-cc9974842045\"\n/>\n\n-
[x] Logs Tab in Host Detail view\n\n<img width=\"2559\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/c0184098-f4f7-437f-beb2-c0931ddd1a6a\"\n/>\n\n-
[x] Logs Tab in the Flyout from the main Hosts page\n\n<img
width=\"2547\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/3578022c-1ac2-4ad2-9968-e472926544a3\"\n/>\n\n-
[x] Fleet Agent Logs\n\n<img width=\"722\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/78e66fa6-7872-482e-ba6d-80f10c5e3c4b\"\n/>\n\n-
[x] Logs Categories Page\n\n<img width=\"1348\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/395e531c-f31e-4316-9604-ee08263c0083\"\n/>\n\n##
What's Pending ?\n\nCode for the old Log Stream Component will be
cleaned up in the\nfollowing PR\n\n---------\n\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"d9ebb93cddb9003b1f45b01682b229e4216db15a","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Discover","Feature:Logs
UI","release_note:skip","Team:Fleet","Team:obs-ux-logs","Team:obs-ux-infra_services","backport:version","v9.1.0","v8.19.0"],"title":"[Logs]
Replace log stream
component","number":219425,"url":"https://github.com/elastic/kibana/pull/219425","mergeCommit":{"message":"[Logs]
Replace log stream component (#219425)\n\n## Summary\n\ncloses
https://github.com/elastic/logs-dev/issues/111\ncloses
https://github.com/elastic/kibana/issues/200668\ncloses
https://github.com/elastic/opentelemetry-dev/issues/792\ncloses
https://github.com/elastic/kibana/issues/89042\ncloses
https://github.com/elastic/kibana/issues/221746\ncloses
https://github.com/elastic/kibana/issues/91717\ncloses
https://github.com/elastic/kibana/issues/91717\n\n\nThe PR does the
following\n\n- Enhances the `enableDocumentViewer` API in the Embeddable
to also hide\nQuality issues and Stacktrace Columns for obs context when
the expand\nicon is also hidden\n- Add a `Columns` Props the the
embeddable so that a new profile is not\nrequired to be created when
custom columns are required\n- Replaces Log Stream component in all
remaining places\n\n- [x] APM - Transactions Details Page\n\n<img
width=\"849\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/74e0469b-eecb-461f-98f5-5f0e51f30a59\"\n/>\n\n-
[x] Logs tab in the hosts' view page\n\n<img width=\"1546\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/aae48330-42ca-4717-8cba-cc9974842045\"\n/>\n\n-
[x] Logs Tab in Host Detail view\n\n<img width=\"2559\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/c0184098-f4f7-437f-beb2-c0931ddd1a6a\"\n/>\n\n-
[x] Logs Tab in the Flyout from the main Hosts page\n\n<img
width=\"2547\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/3578022c-1ac2-4ad2-9968-e472926544a3\"\n/>\n\n-
[x] Fleet Agent Logs\n\n<img width=\"722\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/78e66fa6-7872-482e-ba6d-80f10c5e3c4b\"\n/>\n\n-
[x] Logs Categories Page\n\n<img width=\"1348\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/395e531c-f31e-4316-9604-ee08263c0083\"\n/>\n\n##
What's Pending ?\n\nCode for the old Log Stream Component will be
cleaned up in the\nfollowing PR\n\n---------\n\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"d9ebb93cddb9003b1f45b01682b229e4216db15a"}},"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/219425","number":219425,"mergeCommit":{"message":"[Logs]
Replace log stream component (#219425)\n\n## Summary\n\ncloses
https://github.com/elastic/logs-dev/issues/111\ncloses
https://github.com/elastic/kibana/issues/200668\ncloses
https://github.com/elastic/opentelemetry-dev/issues/792\ncloses
https://github.com/elastic/kibana/issues/89042\ncloses
https://github.com/elastic/kibana/issues/221746\ncloses
https://github.com/elastic/kibana/issues/91717\ncloses
https://github.com/elastic/kibana/issues/91717\n\n\nThe PR does the
following\n\n- Enhances the `enableDocumentViewer` API in the Embeddable
to also hide\nQuality issues and Stacktrace Columns for obs context when
the expand\nicon is also hidden\n- Add a `Columns` Props the the
embeddable so that a new profile is not\nrequired to be created when
custom columns are required\n- Replaces Log Stream component in all
remaining places\n\n- [x] APM - Transactions Details Page\n\n<img
width=\"849\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/74e0469b-eecb-461f-98f5-5f0e51f30a59\"\n/>\n\n-
[x] Logs tab in the hosts' view page\n\n<img width=\"1546\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/aae48330-42ca-4717-8cba-cc9974842045\"\n/>\n\n-
[x] Logs Tab in Host Detail view\n\n<img width=\"2559\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/c0184098-f4f7-437f-beb2-c0931ddd1a6a\"\n/>\n\n-
[x] Logs Tab in the Flyout from the main Hosts page\n\n<img
width=\"2547\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/3578022c-1ac2-4ad2-9968-e472926544a3\"\n/>\n\n-
[x] Fleet Agent Logs\n\n<img width=\"722\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/78e66fa6-7872-482e-ba6d-80f10c5e3c4b\"\n/>\n\n-
[x] Logs Categories Page\n\n<img width=\"1348\"
alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/395e531c-f31e-4316-9604-ee08263c0083\"\n/>\n\n##
What's Pending ?\n\nCode for the old Log Stream Component will be
cleaned up in the\nfollowing PR\n\n---------\n\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"d9ebb93cddb9003b1f45b01682b229e4216db15a"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
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 Feature:Discover Discover Application Feature:Logs UI Logs UI feature release_note:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team Team:obs-onboarding Observability Onboarding Team Team:obs-ux-infra_services - DEPRECATED DEPRECATED - Use Team:obs-presentation. v8.19.0 v9.1.0

Projects

None yet

10 participants