-
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
[Discover] Format JSON messages in Observability Logs profile #205666
Conversation
Pinging @elastic/kibana-data-discovery (Team:DataDiscovery) |
Pinging @elastic/obs-ux-logs-team (Team:obs-ux-logs) |
...cover-contextual-components/src/data_types/logs/components/summary_column/summary_column.tsx
Show resolved
Hide resolved
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
💛 Build succeeded, but was flaky
Failed CI StepsMetrics [docs]Public APIs missing comments
Async chunks
Page load bundle
Unknown metric groupsAPI count
History
cc @davismcphee |
|
||
if (includeFormattedValue) { | ||
try { | ||
formattedValue = JSON.stringify(JSON.parse(unescape(value)), null, 2); |
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.
Just wanted to clarify here: This will return a formattedValue
for things that are not JSON objects (such as true
or null
or "hello"
). In my testing this seemed to work fine, but I just wanted to clarify that this is the desired behavior.
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.
Hmm good point... It wasn't intentional but I think it's ok since at worst they get some highlighting in the code block. If there's a concern about this we can update it to add an additional check that the parsed value is an object or array.
Starting backport for target branches: 8.x |
…c#205666) ## 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](https://github.com/user-attachments/assets/a7c63afd-bef7-4050-b8cf-08e4f469ffa9) JSON tab find functionality: ![find](https://github.com/user-attachments/assets/aac51e05-6126-4770-8976-0d9057bad557) ### Checklist - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [x] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) (cherry picked from commit 518e0af)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…205666) (#206153) # Backport This will backport the following commits from `main` to `8.x`: - [[Discover] Format JSON messages in Observability Logs profile (#205666)](#205666) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Davis McPhee","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-01-10T00:05:18Z","message":"[Discover] Format JSON messages in Observability Logs profile (#205666)\n\n## Summary\r\n\r\nThis PR updates the Observability Logs profile to detect and auto format\r\nJSON message values within both the Log overview doc viewer tab and the\r\nSummary cell popover. Additionally, it enables CTRL/CMD + F find\r\nfunctionality within the doc viewer JSON tab for all contexts to make it\r\neasier for users to search the JSON output.\r\n\r\nJSON message formatting:\r\n\r\n![json](https://github.com/user-attachments/assets/a7c63afd-bef7-4050-b8cf-08e4f469ffa9)\r\n\r\nJSON tab find functionality:\r\n\r\n![find](https://github.com/user-attachments/assets/aac51e05-6126-4770-8976-0d9057bad557)\r\n\r\n### Checklist\r\n\r\n- [ ] Any text added follows [EUI's writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\r\nsentence case text and includes [i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\r\n- [ ]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas added for features that require explanation or tutorials\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n- [ ] If a plugin configuration key changed, check if it needs to be\r\nallowlisted in the cloud and added to the [docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n- [ ] This was checked for breaking HTTP API changes, and any breaking\r\nchanges have been approved by the breaking-change committee. The\r\n`release_note:breaking` label should be applied in these situations.\r\n- [ ] [Flaky Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\r\nused on any tests changed\r\n- [x] The PR description includes the appropriate Release Notes section,\r\nand the correct `release_note:*` label is applied per the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"518e0afbde3f0391d7c99bfbb1ef6252a2623d12","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:enhancement","Feature:Discover","v9.0.0","Team:DataDiscovery","backport:prev-minor","Team:obs-ux-logs"],"title":"[Discover] Format JSON messages in Observability Logs profile","number":205666,"url":"https://github.com/elastic/kibana/pull/205666","mergeCommit":{"message":"[Discover] Format JSON messages in Observability Logs profile (#205666)\n\n## Summary\r\n\r\nThis PR updates the Observability Logs profile to detect and auto format\r\nJSON message values within both the Log overview doc viewer tab and the\r\nSummary cell popover. Additionally, it enables CTRL/CMD + F find\r\nfunctionality within the doc viewer JSON tab for all contexts to make it\r\neasier for users to search the JSON output.\r\n\r\nJSON message formatting:\r\n\r\n![json](https://github.com/user-attachments/assets/a7c63afd-bef7-4050-b8cf-08e4f469ffa9)\r\n\r\nJSON tab find functionality:\r\n\r\n![find](https://github.com/user-attachments/assets/aac51e05-6126-4770-8976-0d9057bad557)\r\n\r\n### Checklist\r\n\r\n- [ ] Any text added follows [EUI's writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\r\nsentence case text and includes [i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\r\n- [ ]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas added for features that require explanation or tutorials\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n- [ ] If a plugin configuration key changed, check if it needs to be\r\nallowlisted in the cloud and added to the [docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n- [ ] This was checked for breaking HTTP API changes, and any breaking\r\nchanges have been approved by the breaking-change committee. The\r\n`release_note:breaking` label should be applied in these situations.\r\n- [ ] [Flaky Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\r\nused on any tests changed\r\n- [x] The PR description includes the appropriate Release Notes section,\r\nand the correct `release_note:*` label is applied per the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"518e0afbde3f0391d7c99bfbb1ef6252a2623d12"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/205666","number":205666,"mergeCommit":{"message":"[Discover] Format JSON messages in Observability Logs profile (#205666)\n\n## Summary\r\n\r\nThis PR updates the Observability Logs profile to detect and auto format\r\nJSON message values within both the Log overview doc viewer tab and the\r\nSummary cell popover. Additionally, it enables CTRL/CMD + F find\r\nfunctionality within the doc viewer JSON tab for all contexts to make it\r\neasier for users to search the JSON output.\r\n\r\nJSON message formatting:\r\n\r\n![json](https://github.com/user-attachments/assets/a7c63afd-bef7-4050-b8cf-08e4f469ffa9)\r\n\r\nJSON tab find functionality:\r\n\r\n![find](https://github.com/user-attachments/assets/aac51e05-6126-4770-8976-0d9057bad557)\r\n\r\n### Checklist\r\n\r\n- [ ] Any text added follows [EUI's writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\r\nsentence case text and includes [i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\r\n- [ ]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas added for features that require explanation or tutorials\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n- [ ] If a plugin configuration key changed, check if it needs to be\r\nallowlisted in the cloud and added to the [docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n- [ ] This was checked for breaking HTTP API changes, and any breaking\r\nchanges have been approved by the breaking-change committee. The\r\n`release_note:breaking` label should be applied in these situations.\r\n- [ ] [Flaky Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\r\nused on any tests changed\r\n- [x] The PR description includes the appropriate Release Notes section,\r\nand the correct `release_note:*` label is applied per the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"518e0afbde3f0391d7c99bfbb1ef6252a2623d12"}}]}] BACKPORT--> Co-authored-by: Davis McPhee <[email protected]>
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