mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Explore/Loki: Remove regex parsing errors for huge logs (#26405)
* Remove hihglihting for logs with more than 5000 characters * Update limitt, include also parsing for details * Update
This commit is contained in:
parent
6a86e66d76
commit
150778df1a
@ -20,6 +20,7 @@ import { selectThemeVariant } from '../../themes/selectThemeVariant';
|
||||
|
||||
//Components
|
||||
import { LogDetailsRow } from './LogDetailsRow';
|
||||
import { MAX_CHARACTERS } from './LogRowMessage';
|
||||
|
||||
type FieldDef = {
|
||||
key: string;
|
||||
@ -64,6 +65,9 @@ class UnThemedLogDetails extends PureComponent<Props> {
|
||||
getParser = memoizeOne(getParser);
|
||||
|
||||
parseMessage = memoizeOne((rowEntry): FieldDef[] => {
|
||||
if (rowEntry.length > MAX_CHARACTERS) {
|
||||
return [];
|
||||
}
|
||||
const parser = this.getParser(rowEntry);
|
||||
if (!parser) {
|
||||
return [];
|
||||
|
@ -17,6 +17,8 @@ import { stylesFactory } from '../../themes/stylesFactory';
|
||||
import { LogRowContext } from './LogRowContext';
|
||||
import { LogMessageAnsi } from './LogMessageAnsi';
|
||||
|
||||
export const MAX_CHARACTERS = 100000;
|
||||
|
||||
interface Props extends Themeable {
|
||||
row: LogRowModel;
|
||||
hasMoreContextRows?: HasMoreContextRows;
|
||||
@ -86,7 +88,8 @@ class UnThemedLogRowMessage extends PureComponent<Props> {
|
||||
|
||||
const previewHighlights = highlighterExpressions && !_.isEqual(highlighterExpressions, row.searchWords);
|
||||
const highlights = previewHighlights ? highlighterExpressions : row.searchWords;
|
||||
const needsHighlighter = highlights && highlights.length > 0 && highlights[0] && highlights[0].length > 0;
|
||||
const needsHighlighter =
|
||||
highlights && highlights.length > 0 && highlights[0] && highlights[0].length > 0 && entry.length < MAX_CHARACTERS;
|
||||
const highlightClassName = previewHighlights
|
||||
? cx([style.logsRowMatchHighLight, style.logsRowMatchHighLightPreview])
|
||||
: cx([style.logsRowMatchHighLight]);
|
||||
|
@ -22,6 +22,7 @@ import store from 'app/core/store';
|
||||
import { ExploreGraphPanel } from './ExploreGraphPanel';
|
||||
import { MetaInfoText } from './MetaInfoText';
|
||||
import { RowContextOptions } from '@grafana/ui/src/components/Logs/LogRowContextProvider';
|
||||
import { MAX_CHARACTERS } from '@grafana/ui/src/components/Logs/LogRowMessage';
|
||||
|
||||
const SETTINGS_KEYS = {
|
||||
showLabels: 'grafana.explore.logs.showLabels',
|
||||
@ -181,6 +182,14 @@ export class Logs extends PureComponent<Props, State> {
|
||||
});
|
||||
}
|
||||
|
||||
if (logRows.some(r => r.entry.length > MAX_CHARACTERS)) {
|
||||
meta.push({
|
||||
label: 'Info',
|
||||
value: 'Logs with more than 100,000 characters could not be parsed and highlighted',
|
||||
kind: LogsMetaKind.String,
|
||||
});
|
||||
}
|
||||
|
||||
const scanText = scanRange ? `Scanning ${rangeUtil.describeTimeRange(scanRange)}` : 'Scanning...';
|
||||
const series = logsSeries ? logsSeries : [];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user