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
Explore/Logs: Escaping of incorrectly escaped log lines #31352
Conversation
I like this, seems like a useful thing and I like that it's visible only with needed with good copy explaining why it's there. @davkal @jessover9000 what do you think? |
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.
I played with it a bit and seems to work like a charm! 🚀 🔥
I only have some doubts regarding some phrasing/naming for which I added a few comments.
I also couldn't see any major perf issue, did you run some tests as well?
EDIT: Also, I'm not sure if the button can be instead a switch placed beside all the other options, it would make things a bit more consistent but it's starting to get crowded in there, so I'd wait for more UI/UX feedback.
@@ -42,14 +43,15 @@ interface Props extends Themeable { | |||
timeZone: TimeZone; | |||
allowDetails?: boolean; | |||
logsSortOrder?: LogsSortOrder | null; | |||
escapedNewlines?: boolean; |
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.
what about forceEscape
instead?
or something else in an "active" form, like showEscaped
, would it make it clearer?
public/app/features/explore/Logs.tsx
Outdated
<MetaInfoText | ||
metaItems={[ | ||
{ | ||
label: 'Your logs might have incorrectly escaped newlines', |
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.
maybe, as it's also about tabs:
label: 'Your logs might have incorrectly escaped newlines', | |
label: 'Your logs might have incorrectly escaped content', |
@@ -62,6 +62,7 @@ export interface LogRowModel { | |||
// Actual log line | |||
entry: string; | |||
hasAnsi: boolean; | |||
hasUnescapedNewlines: boolean; |
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.
what about hasUnescapedContent
(we are also applying this to \t
)
I found an issue when using this log line: Screen.Recording.2021-03-03.at.14.04.01.movwhich also happens if the unescaped but works fine when there's no ANSI code in the string: Screen.Recording.2021-03-03.at.14.07.15.movAlso, which is a minor thing probably, as It's a very super-edge case, if I change the time range to only show a subset of logs that don't need escaping, the button will still be there. the only way to make it go away is to refresh the page. I don't know if this was intended, but it might be confusing: Screen.Recording.2021-03-03.at.14.10.52.mov |
* POC: Escaping of incorrectly escaped log lines * Remove unused import * Fix test, change copy * Make escapedNewlines optional * Fix typechecks * Remove loading state from the escaping button * Update namings
Rewrite the tooltip for the smart feature in PR grafana#31352 that replaces incorrectly escaped newlines in log lines. - Clarify the functionality of the feature to emphasize its interactivity. - Remove language suggesting that the feature is experimental, when we intended to suggest reviewing the results manually for correctness.
Describe and provide steps for using the "Escape newlines" feature in Explore added in PR grafana#31352.
…es feature (#46709) * Explore/Logs: Clarify phrasing of newline escape fix tooltip Rewrite the tooltip for the smart feature in PR #31352 that replaces incorrectly escaped newlines in log lines. - Clarify the functionality of the feature to emphasize its interactivity. - Remove language suggesting that the feature is experimental, when we intended to suggest reviewing the results manually for correctness. * Docs: Document escape newlines feature Describe and provide steps for using the "Escape newlines" feature in Explore added in PR #31352. * Rewrite topic lead to clarify conditional behavior * Describe reversion of replacements as a standalone task Reverting the replacements is a separate action, so it should have its own task. This also describes the option's transformation and tightens the task language. * Remove Grafana 7 version qualifier * Clarify escape sequence detection lede on task Co-authored-by: Fiona Artiaga <89225282+GrafanaWriter@users.noreply.github.com> * Clarify "Remove escaping" state change Co-authored-by: Fiona Artiaga <89225282+GrafanaWriter@users.noreply.github.com> * Clarify confidence of tooltip content Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com> Co-authored-by: Fiona Artiaga <89225282+GrafanaWriter@users.noreply.github.com> Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>
…es feature (#46709) * Explore/Logs: Clarify phrasing of newline escape fix tooltip Rewrite the tooltip for the smart feature in PR #31352 that replaces incorrectly escaped newlines in log lines. - Clarify the functionality of the feature to emphasize its interactivity. - Remove language suggesting that the feature is experimental, when we intended to suggest reviewing the results manually for correctness. * Docs: Document escape newlines feature Describe and provide steps for using the "Escape newlines" feature in Explore added in PR #31352. * Rewrite topic lead to clarify conditional behavior * Describe reversion of replacements as a standalone task Reverting the replacements is a separate action, so it should have its own task. This also describes the option's transformation and tightens the task language. * Remove Grafana 7 version qualifier * Clarify escape sequence detection lede on task Co-authored-by: Fiona Artiaga <89225282+GrafanaWriter@users.noreply.github.com> * Clarify "Remove escaping" state change Co-authored-by: Fiona Artiaga <89225282+GrafanaWriter@users.noreply.github.com> * Clarify confidence of tooltip content Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com> Co-authored-by: Fiona Artiaga <89225282+GrafanaWriter@users.noreply.github.com> Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com> (cherry picked from commit 42431e6)
…es feature (#46709) (#47606) * Explore/Logs: Clarify phrasing of newline escape fix tooltip Rewrite the tooltip for the smart feature in PR #31352 that replaces incorrectly escaped newlines in log lines. - Clarify the functionality of the feature to emphasize its interactivity. - Remove language suggesting that the feature is experimental, when we intended to suggest reviewing the results manually for correctness. * Docs: Document escape newlines feature Describe and provide steps for using the "Escape newlines" feature in Explore added in PR #31352. * Rewrite topic lead to clarify conditional behavior * Describe reversion of replacements as a standalone task Reverting the replacements is a separate action, so it should have its own task. This also describes the option's transformation and tightens the task language. * Remove Grafana 7 version qualifier * Clarify escape sequence detection lede on task Co-authored-by: Fiona Artiaga <89225282+GrafanaWriter@users.noreply.github.com> * Clarify "Remove escaping" state change Co-authored-by: Fiona Artiaga <89225282+GrafanaWriter@users.noreply.github.com> * Clarify confidence of tooltip content Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com> Co-authored-by: Fiona Artiaga <89225282+GrafanaWriter@users.noreply.github.com> Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com> (cherry picked from commit 42431e6) Co-authored-by: Garrett Guillotte <100453168+gguillotte-grafana@users.noreply.github.com>
…es feature (#46709) * Explore/Logs: Clarify phrasing of newline escape fix tooltip Rewrite the tooltip for the smart feature in PR #31352 that replaces incorrectly escaped newlines in log lines. - Clarify the functionality of the feature to emphasize its interactivity. - Remove language suggesting that the feature is experimental, when we intended to suggest reviewing the results manually for correctness. * Docs: Document escape newlines feature Describe and provide steps for using the "Escape newlines" feature in Explore added in PR #31352. * Rewrite topic lead to clarify conditional behavior * Describe reversion of replacements as a standalone task Reverting the replacements is a separate action, so it should have its own task. This also describes the option's transformation and tightens the task language. * Remove Grafana 7 version qualifier * Clarify escape sequence detection lede on task Co-authored-by: Fiona Artiaga <89225282+GrafanaWriter@users.noreply.github.com> * Clarify "Remove escaping" state change Co-authored-by: Fiona Artiaga <89225282+GrafanaWriter@users.noreply.github.com> * Clarify confidence of tooltip content Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com> Co-authored-by: Fiona Artiaga <89225282+GrafanaWriter@users.noreply.github.com> Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>
Over the time, we've had a decent amount of reported issues related to escaping of newlines. Wast majority of those was due to the fact, that users had incorrectly escaped log lines. In that case, there is not much we can do at client side - at Grafana, as we don't know which characters are actual newlines and which have just the
\n
pattern.@ethirolle came up with and documented a good idea to give users a chance to replace their incorrectly escaped newlines and tabs with simply replacing
\t
,\n
,\r
, with actual newline or tab.❗️What is very important - we should communicate to users that the lines aren't correctly escaped and that the first step should be fixing escaping. However, for some logs it is very hard/almost impossible to correctly escape them. And for those cases, we would provide them with a feature that would replace incorrectly escapes newlines with actual newlines. Of course, it might always produce incorrect results, as we don't know which characters are actual newlines and which have just the
\n
pattern, but I think that if we communicate it clearly, users will understand.In this PR, I am showing the Escaping button only when we detect
\t
,\n
,\r
in any of the log lines. It has also experimental feature tooltip. We are also escaping and re-rendering only those lines, that are incorrectly escaped.escaping.mov
When no incorrectly escaped lines - no button:
Which issue(s) this PR fixes:
Fixes #27964
Special notes for your reviewer:
This is the POC/my hack day project.