Skip to content
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

[Logs Explorer] Add logic to render degraded fields table in Logs Flyout #186287

Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
b0ee72f
Add logic to render degraded fields table in Logs Flyout
achyutjhunjhunwala Jun 17, 2024
ae4bfba
The accordion must stay closed by default
achyutjhunjhunwala Jun 17, 2024
d4852ad
Merge branch 'main' into Add-quality-issues-table-to-Logs-Flyout
achyutjhunjhunwala Jun 17, 2024
0f503a4
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Jun 17, 2024
1a47705
Fix typing issue
achyutjhunjhunwala Jun 17, 2024
35420ab
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Jun 17, 2024
cb13801
Merge branch 'main' into Add-quality-issues-table-to-Logs-Flyout
achyutjhunjhunwala Jun 17, 2024
1eb8bef
Remove that comma
achyutjhunjhunwala Jun 17, 2024
8ec13c3
Merge branch 'main' into Add-quality-issues-table-to-Logs-Flyout
achyutjhunjhunwala Jun 18, 2024
93caf7e
Merge branch 'main' into Add-quality-issues-table-to-Logs-Flyout
achyutjhunjhunwala Jun 20, 2024
1b463e3
Add locator for DQ Flyout
achyutjhunjhunwala Jun 20, 2024
dde1a6c
Merge branch 'main' into Add-quality-issues-table-to-Logs-Flyout
achyutjhunjhunwala Jun 20, 2024
6785637
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Jun 20, 2024
e4428a8
Fix one test, which seems flaky
achyutjhunjhunwala Jun 20, 2024
e03fd30
Merge branch 'main' into Add-quality-issues-table-to-Logs-Flyout
achyutjhunjhunwala Jun 21, 2024
bb9cbdf
Merge branch 'main' into Add-quality-issues-table-to-Logs-Flyout
achyutjhunjhunwala Jul 3, 2024
942527c
Merge branch 'main' into Add-quality-issues-table-to-Logs-Flyout
achyutjhunjhunwala Jul 4, 2024
2122200
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Jul 4, 2024
56b02c8
Add Unit tests
achyutjhunjhunwala Jul 4, 2024
4a0b5f3
Importing only type for share
achyutjhunjhunwala Jul 4, 2024
3a53bba
Update dependencies and fix a type error with unit test
achyutjhunjhunwala Jul 5, 2024
9af5f72
Merge branch 'main' into Add-quality-issues-table-to-Logs-Flyout
achyutjhunjhunwala Jul 5, 2024
347aded
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Jul 5, 2024
e4cf60d
Merge branch 'main' into Add-quality-issues-table-to-Logs-Flyout
achyutjhunjhunwala Jul 6, 2024
6706220
Fix review comments
achyutjhunjhunwala Jul 8, 2024
2618397
Fix issue with Title param
achyutjhunjhunwala Jul 8, 2024
5d28004
Merge branch 'main' into Add-quality-issues-table-to-Logs-Flyout
achyutjhunjhunwala Jul 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions packages/deeplinks/observability/locators/dataset_quality.ts
yngrdyn marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import { SerializableRecord } from '@kbn/utility-types';

export const DATASET_QUALITY_LOCATOR_ID = 'DATASET_QUALITY_LOCATOR';
export const DATA_QUALITY_LOCATOR_ID = 'DATA_QUALITY_LOCATOR';

// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
type RefreshInterval = {
Expand All @@ -23,11 +23,22 @@ type TimeRangeConfig = {
refresh: RefreshInterval;
};

// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
type DatasetConfig = {
rawName: string;
type: string;
name: string;
namespace: string;
};

// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
type Filters = {
timeRange: TimeRangeConfig;
};

export interface DatasetQualityLocatorParams extends SerializableRecord {
export interface DataQualityLocatorParams extends SerializableRecord {
filters?: Filters;
flyout?: {
dataset: DatasetConfig;
};
}
2 changes: 1 addition & 1 deletion src/plugins/unified_doc_viewer/kibana.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"server": false,
"browser": true,
"requiredBundles": ["kibanaUtils"],
"requiredPlugins": ["data", "discoverShared", "fieldFormats"],
"requiredPlugins": ["data", "discoverShared", "fieldFormats", "share"],
"optionalPlugins": ["fieldsMetadata"]
}
}
2 changes: 2 additions & 0 deletions src/plugins/unified_doc_viewer/public/__mocks__/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { discoverSharedPluginMock } from '@kbn/discover-shared-plugin/public/moc
import { fieldFormatsMock } from '@kbn/field-formats-plugin/common/mocks';
import { fieldsMetadataPluginPublicMock } from '@kbn/fields-metadata-plugin/public/mocks';
import { uiSettingsServiceMock } from '@kbn/core-ui-settings-browser-mocks';
import { sharePluginMock } from '@kbn/share-plugin/public/mocks';
import type { UnifiedDocViewerServices, UnifiedDocViewerStart } from '../types';
import { Storage } from '@kbn/kibana-utils-plugin/public';
import { DocViewsRegistry } from '@kbn/unified-doc-viewer';
Expand All @@ -29,4 +30,5 @@ export const mockUnifiedDocViewerServices: jest.Mocked<UnifiedDocViewerServices>
storage: new Storage(localStorage),
uiSettings: uiSettingsServiceMock.createStartContract(),
unifiedDocViewer: mockUnifiedDocViewer,
share: sharePluginMock.createStartContract(),
};
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ const DATASET_NAME = 'logs.overview';
const NAMESPACE = 'default';
const DATA_STREAM_NAME = `logs-${DATASET_NAME}-${NAMESPACE}`;
const NOW = Date.now();
const MORE_THAN_1024_CHARS =
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?';

const dataView = {
fields: {
Expand Down Expand Up @@ -82,7 +84,7 @@ const fullHit = buildDataTableRecord(
cloud: {
provider: ['gcp'],
region: 'us-central-1',
availability_zone: 'us-central-1a',
availability_zone: MORE_THAN_1024_CHARS,
project: {
id: 'elastic-project',
},
Expand All @@ -92,6 +94,9 @@ const fullHit = buildDataTableRecord(
},
'agent.name': 'node',
},
ignored_field_values: {
'cloud.availability_zone': [MORE_THAN_1024_CHARS],
},
},
dataView
);
Expand Down Expand Up @@ -159,4 +164,37 @@ describe('LogsOverview', () => {
expect(screen.queryByTestId('unifiedDocViewLogsOverviewLogShipper')).toBeInTheDocument();
});
});
describe('Degraded Fields section', () => {
it('should load the degraded fields container when present', async () => {
expect(
screen.queryByTestId('unifiedDocViewLogsOverviewDegradedFieldsAccordion')
).toBeInTheDocument();
expect(
screen.queryByTestId('unifiedDocViewLogsOverviewDegradedFieldsTechPreview')
).toBeInTheDocument();
expect(
screen.queryByTestId('unifiedDocViewLogsOverviewDegradedFieldTitleCount')
).toBeInTheDocument();

// The accordion must be closed by default
const accordion = screen.queryByTestId('unifiedDocViewLogsOverviewDegradedFieldsAccordion1');

if (accordion === null) {
return;
}
const button = accordion.querySelector('button');

if (button === null) {
return;
}
// Check the aria-expanded property of the button
const isExpanded = button.getAttribute('aria-expanded');
expect(isExpanded).toBe('false');

button.click();
expect(
screen.queryByTestId('unifiedDocViewLogsOverviewDegradedFieldsQualityIssuesTable')
).toBeInTheDocument();
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { LogsOverviewHighlights } from './logs_overview_highlights';
import { FieldActionsProvider } from '../../hooks/use_field_actions';
import { getUnifiedDocViewerServices } from '../../plugin';
import { LogsOverviewAIAssistant } from './logs_overview_ai_assistant';
import { LogsOverviewDegradedFields } from './logs_overview_degraded_fields';

export function LogsOverview({
columns,
Expand All @@ -38,6 +39,7 @@ export function LogsOverview({
<LogsOverviewHeader doc={parsedDoc} />
<EuiHorizontalRule margin="xs" />
<LogsOverviewHighlights formattedDoc={parsedDoc} flattenedDoc={hit.flattened} />
<LogsOverviewDegradedFields rawDoc={hit.raw} />
<LogsOverviewAIAssistant doc={hit} />
</FieldActionsProvider>
);
Expand Down
Loading