-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Discover] Format JSON messages in Observability Logs profile #205666
base: main
Are you sure you want to change the base?
Conversation
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Public APIs missing comments
Async chunks
Page load bundle
Unknown metric groupsAPI count
cc @davismcphee |
Pinging @elastic/kibana-data-discovery (Team:DataDiscovery) |
Pinging @elastic/obs-ux-logs-team (Team:obs-ux-logs) |
const { row, dataView, fieldFormats, onFilter, closePopover, share, core } = props; | ||
|
||
const resourceFields = createResourceFields(row, core, share); | ||
const shouldRenderResource = resourceFields.length > 0; | ||
|
||
const documentOverview = getLogDocumentOverview(row, { dataView, fieldFormats }); | ||
const { field, value } = getMessageFieldWithFallbacks(documentOverview); | ||
const { field, value, formattedValue } = getMessageFieldWithFallbacks(documentOverview, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tip
Since the EuiCodeBlock component might receive conditionally the children props, what about pre-computing the props early and passing them into the component to prevent overlaps?
const messageCodeBlockProps = formattedValue
? { language: 'json', dangerouslySetInnerHTML: { __html: value ?? '' } }
: { language: 'txt', children: formattedValue }
<EuiCodeBlock
overflowHeight={100}
paddingSize="s"
isCopyable
fontSize="s"
{...messageCodeBlockProps}
/>
Same could be applied to the other usage in the flyout.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I left a suggestion to avoid props overlapping but nothing blocking this to get merged
Summary
This PR updates the Observability Logs profile to detect and auto format JSON message values within both the Log overview doc viewer tab and the Summary cell popover. Additionally, it enables CTRL/CMD + F find functionality within the doc viewer JSON tab for all contexts to make it easier for users to search the JSON output.
JSON message formatting:
JSON tab find functionality:
Checklist
release_note:breaking
label should be applied in these situations.release_note:*
label is applied per the guidelines