Skip to content

Commit

Permalink
[Logs Explorer] Rename malformed docs to degraded docs (elastic#177158)
Browse files Browse the repository at this point in the history
## Summary

Rename Malformed Docs to Degraded Docs
  • Loading branch information
achyutjhunjhunwala authored Feb 19, 2024
1 parent 392bb40 commit 76551dd
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ export const ORCHESTRATOR_NAMESPACE_FIELD = 'orchestrator.namespace';
export const CONTAINER_NAME_FIELD = 'container.name';
export const CONTAINER_ID_FIELD = 'container.id';

// Malformed Docs
export const MALFORMED_DOCS_FIELD = 'ignored_field_values';
// Degraded Docs
export const DEGRADED_DOCS_FIELD = 'ignored_field_values';

// Error Stacktrace
export const ERROR_STACK_TRACE = 'error.stack_trace';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,10 +259,10 @@ export const actionsHeaderTooltipExpandAction = i18n.translate(
{ defaultMessage: 'Expand log details' }
);

export const actionsHeaderTooltipMalformedAction = (
export const actionsHeaderTooltipDegradedAction = (
<FormattedMessage
id="xpack.logsExplorer.dataTable.controlColumn.actions.button.malformedDoc"
defaultMessage="Access to malformed doc with {ignoredProperty} field"
id="xpack.logsExplorer.dataTable.controlColumn.actions.button.degradedDoc"
defaultMessage="Access to degraded doc with {ignoredProperty} field"
values={{
ignoredProperty: (
<EuiCode language="json" transparentBackground>
Expand All @@ -278,16 +278,16 @@ export const actionsHeaderTooltipStacktraceAction = i18n.translate(
{ defaultMessage: 'Access to available stacktraces based on:' }
);

export const malformedDocButtonLabelWhenPresent = i18n.translate(
'xpack.logsExplorer.dataTable.controlColumn.actions.button.malformedDocPresent',
export const degradedDocButtonLabelWhenPresent = i18n.translate(
'xpack.logsExplorer.dataTable.controlColumn.actions.button.degradedDocPresent',
{
defaultMessage:
"This document couldn't be parsed correctly. Not all fields are properly populated",
}
);

export const malformedDocButtonLabelWhenNotPresent = i18n.translate(
'xpack.logsExplorer.dataTable.controlColumn.actions.button.malformedDocNotPresent',
export const degradedDocButtonLabelWhenNotPresent = i18n.translate(
'xpack.logsExplorer.dataTable.controlColumn.actions.button.degradedDocNotPresent',
{
defaultMessage: 'All fields in this document were parsed correctly',
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { EuiFlexGroup, EuiFlexItem, EuiIcon, EuiText } from '@elastic/eui';
import { euiThemeVars } from '@kbn/ui-theme';
import {
actionsHeaderTooltipExpandAction,
actionsHeaderTooltipMalformedAction,
actionsHeaderTooltipDegradedAction,
actionsHeaderTooltipParagraph,
actionsHeaderTooltipStacktraceAction,
actionsLabel,
Expand Down Expand Up @@ -64,7 +64,7 @@ export const ActionsColumnTooltip = () => {
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiText size="s">
<p>{actionsHeaderTooltipMalformedAction}</p>
<p>{actionsHeaderTooltipDegradedAction}</p>
</EuiText>
</EuiFlexItem>
</EuiFlexGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import type { DataTableRecord } from '@kbn/discover-utils/src/types';
import { useActor } from '@xstate/react';
import { LogsExplorerControllerStateService } from '../state_machines/logs_explorer_controller';
import {
malformedDocButtonLabelWhenNotPresent,
malformedDocButtonLabelWhenPresent,
degradedDocButtonLabelWhenNotPresent,
degradedDocButtonLabelWhenPresent,
stacktraceAvailableControlButton,
stacktraceNotAvailableControlButton,
} from '../components/common/translations';
Expand All @@ -27,7 +27,7 @@ import { getStacktraceFields } from '../utils/get_stack_trace';
import { LogDocument } from '../../common/document';
import { ActionsColumnTooltip } from '../components/virtual_columns/column_tooltips/actions_column_tooltip';

const ConnectedMalformedDocs = ({
const ConnectedDegradedDocs = ({
rowIndex,
service,
}: {
Expand All @@ -38,7 +38,7 @@ const ConnectedMalformedDocs = ({

if (state.matches('initialized') && state.context.rows) {
const row = state.context.rows[rowIndex];
return <MalformedDocs row={row} rowIndex={rowIndex} />;
return <DegradedDocs row={row} rowIndex={rowIndex} />;
}

return null;
Expand All @@ -61,34 +61,34 @@ const ConnectedStacktraceDocs = ({
return null;
};

const MalformedDocs = ({ row, rowIndex }: { row: DataTableRecord; rowIndex: number }) => {
const isMalformedDocumentExists = !!row.raw[constants.MALFORMED_DOCS_FIELD];
const DegradedDocs = ({ row, rowIndex }: { row: DataTableRecord; rowIndex: number }) => {
const isDegradedDocumentExists = !!row.raw[constants.DEGRADED_DOCS_FIELD];

return isMalformedDocumentExists ? (
return isDegradedDocumentExists ? (
<DataTableRowControl>
<EuiToolTip content={malformedDocButtonLabelWhenPresent} delay="long">
<EuiToolTip content={degradedDocButtonLabelWhenPresent} delay="long">
<EuiButtonIcon
id={`malformedDocExists_${rowIndex}`}
id={`degradedDocExists_${rowIndex}`}
size="xs"
iconSize="s"
data-test-subj={'docTableMalformedDocExist'}
data-test-subj={'docTableDegradedDocExist'}
color={'danger'}
aria-label={malformedDocButtonLabelWhenPresent}
aria-label={degradedDocButtonLabelWhenPresent}
iconType={'indexClose'}
/>
</EuiToolTip>
</DataTableRowControl>
) : (
<DataTableRowControl>
<EuiToolTip content={malformedDocButtonLabelWhenNotPresent} delay="long">
<EuiToolTip content={degradedDocButtonLabelWhenNotPresent} delay="long">
<EuiButtonIcon
id={`malformedDocExists_${rowIndex}`}
id={`degradedDocExists_${rowIndex}`}
size="xs"
iconSize="s"
data-test-subj={'docTableMalformedDocDoesNotExist'}
data-test-subj={'docTableDegradedDocDoesNotExist'}
color={'text'}
iconType={'pagesSelect'}
aria-label={malformedDocButtonLabelWhenNotPresent}
aria-label={degradedDocButtonLabelWhenNotPresent}
/>
</EuiToolTip>
</DataTableRowControl>
Expand Down Expand Up @@ -137,7 +137,7 @@ export const createCustomControlColumnsConfiguration =
return (
<span>
<ExpandButton rowIndex={rowIndex} setCellProps={setCellProps} {...rest} />
<ConnectedMalformedDocs rowIndex={rowIndex} service={service} />
<ConnectedDegradedDocs rowIndex={rowIndex} service={service} />
<ConnectedStacktraceDocs rowIndex={rowIndex} service={service} />
</span>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,21 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});
});

it('should render the malformed icon in the last control column if malformed doc exists', async () => {
it('should render the degraded icon in the last control column if degraded doc exists', async () => {
await retry.tryForTime(TEST_TIMEOUT, async () => {
const cellElement = await dataGrid.getCellElement(1, 4);
const malformedButton = await cellElement.findByTestSubject('docTableMalformedDocExist');
expect(malformedButton).to.not.be.empty();
const degradedButton = await cellElement.findByTestSubject('docTableDegradedDocExist');
expect(degradedButton).to.not.be.empty();
});
});

it('should render the disabled malformed icon in the last control column when malformed doc does not exists', async () => {
it('should render the disabled degraded icon in the last control column when degraded doc does not exists', async () => {
await retry.tryForTime(TEST_TIMEOUT, async () => {
const cellElement = await dataGrid.getCellElement(0, 4);
const malformedDisableButton = await cellElement.findByTestSubject(
'docTableMalformedDocDoesNotExist'
const degradedDisableButton = await cellElement.findByTestSubject(
'docTableDegradedDocDoesNotExist'
);
expect(malformedDisableButton).to.not.be.empty();
expect(degradedDisableButton).to.not.be.empty();
});
});

Expand Down Expand Up @@ -115,10 +115,7 @@ function generateLogsData({ to, count = 1 }: { to: string; count?: number }) {
})
);

const malformedDocs = timerange(
moment(to).subtract(2, 'second'),
moment(to).subtract(1, 'second')
)
const degradedDocs = timerange(moment(to).subtract(2, 'second'), moment(to).subtract(1, 'second'))
.interval('1m')
.rate(1)
.generator((timestamp) =>
Expand All @@ -127,7 +124,7 @@ function generateLogsData({ to, count = 1 }: { to: string; count?: number }) {
.map(() => {
return log
.create()
.message('A malformed doc')
.message('A degraded doc')
.logLevel(MORE_THAN_1024_CHARS)
.timestamp(timestamp)
.defaults({ 'service.name': 'synth-service' });
Expand Down Expand Up @@ -185,5 +182,5 @@ function generateLogsData({ to, count = 1 }: { to: string; count?: number }) {
})
);

return [logs, malformedDocs, logsWithErrorMessage, logsWithErrorException, logsWithErrorInLog];
return [logs, degradedDocs, logsWithErrorMessage, logsWithErrorException, logsWithErrorInLog];
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
it('should render the malformed icon in the last control column if malformed doc exists', async () => {
await retry.tryForTime(TEST_TIMEOUT, async () => {
const cellElement = await dataGrid.getCellElement(1, 4);
const malformedButton = await cellElement.findByTestSubject('docTableMalformedDocExist');
const malformedButton = await cellElement.findByTestSubject('docTableDegradedDocExist');
expect(malformedButton).to.not.be.empty();
});
});
Expand All @@ -73,7 +73,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await retry.tryForTime(TEST_TIMEOUT, async () => {
const cellElement = await dataGrid.getCellElement(0, 4);
const malformedDisableButton = await cellElement.findByTestSubject(
'docTableMalformedDocDoesNotExist'
'docTableDegradedDocDoesNotExist'
);
expect(malformedDisableButton).to.not.be.empty();
});
Expand Down

0 comments on commit 76551dd

Please sign in to comment.