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

[One Discover] Display stacktrace in the logs overview tab #204521

Open
wants to merge 39 commits into
base: main
Choose a base branch
from

Conversation

gbamparop
Copy link
Contributor

@gbamparop gbamparop commented Dec 17, 2024

📓 Summary

Adds a new section to the overview tab in the log details flyout in Discover to display stacktrace information for logs and exceptions.

In a follow-up, the stacktrace could be moved to a new tab in the log details flyout and actions can be added to the stacktrace (and quality) icons in the document table to open the relevant sections in the flyout.

Closes #190460

APM - Log stacktrace (library frames)

image

APM - Exception (with cause)

image

APM - Exception (simple stacktrace)

image

Apache Tomcat Integration (Catalina) - Stacktrace

image

📝 Notes for reviewers

  • The @kbn/apm-types package was marked as platform / shared as it's being used by the unified_doc_viewer
  • The code used to render stacktraces in APM was moved into a new @kbn/event-stacktrace package as it is reused in the unified_doc_viewer
  • The code used to render metadata table in APM was moved into a new @kbn/key-value-metadata-table package

🧪 Testing instructions

The deployed environments have sample logs that can be used (time range: Jan 1, 2025 - now). For a local setup, please follow the instructions below:

  1. Ingest sample logs with stacktraces (gist). Please note that these are test data and some fields that are not used by stacktraces might not be consistent
  2. View relevant logs in Discover (Query: service.name: "synth-node-0" OR apache_tomcat :*, Time range: Jan 1, 2025 - now)

@gbamparop gbamparop added release_note:skip Skip the PR/issue when compiling release notes backport:skip This commit does not require backporting labels Dec 17, 2024
@gbamparop
Copy link
Contributor Author

/ci

@gbamparop gbamparop force-pushed the discover-logs-stacktrace branch from e11d28d to b41227d Compare December 17, 2024 08:57
@gbamparop
Copy link
Contributor Author

/ci

@gbamparop
Copy link
Contributor Author

/ci

@gbamparop
Copy link
Contributor Author

/ci

@gbamparop
Copy link
Contributor Author

/ci

@gbamparop
Copy link
Contributor Author

/oblt-deploy

@gbamparop
Copy link
Contributor Author

/ci

@gbamparop
Copy link
Contributor Author

/ci

@gbamparop gbamparop changed the title Discover logs stacktrace [One Discover] Display stacktrace in the logs overview tab Dec 31, 2024
@gbamparop
Copy link
Contributor Author

/ci

@gbamparop
Copy link
Contributor Author

/ci

1 similar comment
@gbamparop
Copy link
Contributor Author

/ci

@gbamparop
Copy link
Contributor Author

/ci

@@ -40,7 +40,7 @@ export function ExceptionStacktraceTitle({
}

return (
<EuiTitle size="xs">
<EuiTitle size="xxs">
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was changed so the font-size of the exception title is smaller than the section title in Discover's flyout:

image

It will affect APM too, but LGTM.

Before

image

After

image

@gbamparop
Copy link
Contributor Author

/oblt-deploy

@gbamparop gbamparop added the ci:project-deploy-observability Create an Observability project label Jan 16, 2025
Copy link
Contributor

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • /oblt-deploy : Deploy a Kibana instance using the Observability test environments.
  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)

@gbamparop
Copy link
Contributor Author

/ci

dataStreamTypeField === APM_ERROR_DATASTREAM_FIELDS.dataStreamType &&
dataStreamDatasetField === APM_ERROR_DATASTREAM_FIELDS.dataStreamDataset
) {
return <ApmStacktrace hit={hit} dataView={dataView} />;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This component is only used for APM data, as it requires the APM data model to be displayed properly.

@elasticmachine
Copy link
Contributor

elasticmachine commented Jan 16, 2025

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] APM Cypress Tests #3 / service map when navigating to service map when there is no data shows empty state shows empty state
  • [job] [logs] FTR Configs #44 / Stateful Observability - Deployment-agnostic API integration tests SyntheticsAPITests getSyntheticsMonitors get many monitors without params

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
apm 1695 1697 +2
unifiedDocViewer 236 277 +41
total +43

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/discover-utils 228 229 +1
@kbn/event-stacktrace - 18 +18
@kbn/key-value-metadata-table - 10 +10
total +29

Async chunks

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

id before after diff
apm 3.9MB 3.9MB +22.0B
discover 844.1KB 844.3KB +258.0B
logsExplorer 223.2KB 223.2KB +36.0B
unifiedDocViewer 124.1KB 148.4KB +24.4KB
total +24.7KB

Page load bundle

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

id before after diff
logsExplorer 26.5KB 26.6KB +111.0B
Unknown metric groups

API count

id before after diff
@kbn/discover-utils 278 279 +1
@kbn/event-stacktrace - 18 +18
@kbn/key-value-metadata-table - 10 +10
total +29

ESLint disabled line counts

id before after diff
@kbn/event-stacktrace - 3 +3
@kbn/key-value-metadata-table - 2 +2
total +5

Total ESLint disabled count

id before after diff
@kbn/event-stacktrace - 3 +3
@kbn/key-value-metadata-table - 2 +2
total +5

History

@gbamparop gbamparop marked this pull request as ready for review January 17, 2025 06:50
@gbamparop gbamparop requested review from a team as code owners January 17, 2025 06:50
@tonyghiani tonyghiani self-requested a review January 17, 2025 11:15
Copy link
Member

@jbudz jbudz left a comment

Choose a reason for hiding this comment

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

src/dev/storybook/aliases.ts LGTM

@botelastic botelastic bot added the Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team label Jan 17, 2025
@elasticmachine
Copy link
Contributor

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

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.

I made a first pass, the functionalities work and the new code LGTM, I left some questions/suggestions but overall looks good!

@@ -148,14 +149,18 @@ setUnifiedDocViewerServices(
const renderLogsOverview = (props: Partial<DocViewRenderProps> = {}) => {
const { rerender: baseRerender, ...tools } = render(
<EuiProvider>
<LogsOverview dataView={dataView} hit={fullHit} {...props} />
<IntlProvider locale="en">
Copy link
Contributor

Choose a reason for hiding this comment

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

question: Can you explain why we need an explicit provider for intl here?

Copy link
Contributor

Choose a reason for hiding this comment

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

note: With the changes done in #200958, this file shouldn't be necessary anymore. You only need to update the import for the typings in the tsconfig file.

@@ -47,6 +51,7 @@ export function LogsOverview({
<EuiHorizontalRule margin="xs" />
<LogsOverviewHighlights formattedDoc={parsedDoc} flattenedDoc={hit.flattened} />
<LogsOverviewDegradedFields rawDoc={hit.raw} />
{isStacktraceAvailable && <LogsOverviewStacktraceSection hit={hit} dataView={dataView} />}
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: we probably need some spacing here to separate from the AI Assistant.
Screenshot 2025-01-17 at 14 46 18

Copy link
Contributor

Choose a reason for hiding this comment

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

note: With the changes done in #200958, this file shouldn't be necessary anymore. You only need to update the import for the typings in the tsconfig file.

Copy link
Contributor

Choose a reason for hiding this comment

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

note: I was about to suggest we already have a shared object flattening function, but looking at the implementation it has a different purpose than object flattening.

Probably it was fine to use it in the scope of APM only, but this naming is quite generic for a utility now exported on a shared package, specially since it matches another exported utility.

Could we rename this to something more specific to what it does, maybe getFlattenedKeyValuePairs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting ci:project-deploy-observability Create an Observability project release_note:skip Skip the PR/issue when compiling release notes Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[One Discover] Display stacktraces in the log details flyout
5 participants