Skip to content

Commit

Permalink
Address some of the no_group_crossing dependencies (#198261)
Browse files Browse the repository at this point in the history
### Summary

This PR relocates some plugins and packages that are incorrectly
categorised, aiming at reducing inter-solution dependencies. It also
fixes some incorrect import statements that introduce unnecessary
dependencies with other components.

---------

Co-authored-by: kibanamachine <[email protected]>
Co-authored-by: Maryam Saeidi <[email protected]>
(cherry picked from commit 730f4c9)

# Conflicts:
#	.eslintrc.js
#	src/plugins/ai_assistant_management/selection/kibana.jsonc
#	x-pack/packages/kbn-ai-assistant/kibana.jsonc
#	x-pack/plugins/dashboard_enhanced/kibana.jsonc
#	x-pack/plugins/observability_solution/observability_ai_assistant/kibana.jsonc
#	x-pack/plugins/screenshotting/kibana.jsonc
  • Loading branch information
gsoldevila committed Nov 6, 2024
1 parent 8cf6d9c commit c91614d
Show file tree
Hide file tree
Showing 44 changed files with 162 additions and 140 deletions.
28 changes: 28 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -1978,6 +1978,34 @@ module.exports = {
'max-classes-per-file': 'off',
},
},
{
files: [
// logsShared depends on o11y/private plugins, but platform plugins depend on it
'x-pack/plugins/observability_solution/logs_shared/**',

// this plugin depends on visTypeTimeseries plugin (for TSVB viz) which is platform/private ATM
'x-pack/plugins/observability_solution/infra/**',

// TODO @kibana/operations
'scripts/create_observability_rules.js', // is importing "@kbn/observability-alerting-test-data" (observability/private)
'src/cli_setup/**', // is importing "@kbn/interactive-setup-plugin" (platform/private)
'src/dev/build/tasks/install_chromium.ts', // is importing "@kbn/screenshotting-plugin" (platform/private)

// @kbn/osquery-plugin could be categorised as Security, but @kbn/infra-plugin (observability) depends on it!
'x-pack/plugins/osquery/**',

// For now, we keep the exception to let tests depend on anythying.
// Ideally, we need to classify the solution specific ones to reduce CI times
'test/**',
'x-pack/test_serverless/**',
'x-pack/test/**',
'x-pack/test/plugin_functional/plugins/resolver_test/**',
],
rules: {
'@kbn/imports/no_group_crossing_manifests': 'warn',
'@kbn/imports/no_group_crossing_imports': 'warn',
},
},
],
};

Expand Down
4 changes: 3 additions & 1 deletion packages/shared-ux/page/analytics_no_data/impl/kibana.jsonc
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"type": "shared-browser",
"id": "@kbn/shared-ux-page-analytics-no-data",
"owner": "@elastic/appex-sharedux"
"owner": "@elastic/appex-sharedux",
"group": "platform",
"visibility": "private"
}
4 changes: 3 additions & 1 deletion packages/shared-ux/page/analytics_no_data/mocks/kibana.jsonc
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"type": "shared-common",
"id": "@kbn/shared-ux-page-analytics-no-data-mocks",
"owner": "@elastic/appex-sharedux"
"owner": "@elastic/appex-sharedux",
"group": "platform",
"visibility": "private"
}
4 changes: 3 additions & 1 deletion packages/shared-ux/page/analytics_no_data/types/kibana.jsonc
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"type": "shared-browser",
"id": "@kbn/shared-ux-page-analytics-no-data-types",
"owner": "@elastic/appex-sharedux"
"owner": "@elastic/appex-sharedux",
"group": "platform",
"visibility": "private"
}
25 changes: 19 additions & 6 deletions src/plugins/ai_assistant_management/selection/kibana.jsonc
Original file line number Diff line number Diff line change
@@ -1,16 +1,29 @@
{
"type": "plugin",
"id": "@kbn/ai-assistant-management-plugin",
"owner": "@elastic/obs-knowledge-team",
"owner": [
"@elastic/obs-knowledge-team"
],
// This should probably be platform. While the code owner is currently observability, the package is a platform AI assistant selector.
"group": "platform",
"visibility": "shared",
"plugin": {
"id": "aiAssistantManagementSelection",
"server": true,
"browser": true,
"requiredPlugins": ["management"],
"optionalPlugins": ["home", "serverless", "features"],
"requiredBundles": ["kibanaReact"],
"requiredPlugins": [
"management"
],
"optionalPlugins": [
"home",
"serverless",
"features"
],
"requiredBundles": [
"kibanaReact"
],
"configPath": [
"aiAssistantManagementSelection"
],
},
]
}
}
2 changes: 2 additions & 0 deletions x-pack/examples/exploratory_view_example/kibana.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"type": "plugin",
"id": "@kbn/exploratory-view-example-plugin",
"owner": "@elastic/obs-ux-infra_services-team",
"group": "observability",
"visibility": "private",
"plugin": {
"id": "exploratoryViewExample",
"server": false,
Expand Down
4 changes: 4 additions & 0 deletions x-pack/examples/screenshotting_example/kibana.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
"type": "plugin",
"id": "@kbn/screenshotting-example-plugin",
"owner": "@elastic/appex-sharedux",
// This plugin is not meant to be referenced or imported
"visibility": "private",
// If cloned / used as an inspiration, please bear in mind that your plugin might belong to a specific solution group
"group": "platform",
"description": "An example integration with the screenshotting plugin.",
"plugin": {
"id": "screenshottingExample",
Expand Down
4 changes: 4 additions & 0 deletions x-pack/examples/ui_actions_enhanced_examples/kibana.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
"type": "plugin",
"id": "@kbn/ui-actions-enhanced-examples-plugin",
"owner": "@elastic/appex-sharedux",
// This plugin is not meant to be referenced or imported
"visibility": "private",
// If cloned / used as an inspiration, please bear in mind that your plugin might belong to a specific solution group
"group": "platform",
"plugin": {
"id": "uiActionsEnhancedExamples",
"server": false,
Expand Down
4 changes: 3 additions & 1 deletion x-pack/packages/kbn-ai-assistant/kibana.jsonc
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"id": "@kbn/ai-assistant",
"owner": "@elastic/search-kibana",
"type": "shared-browser"
"type": "shared-browser",
"group": "platform",
"visibility": "shared"
}
4 changes: 3 additions & 1 deletion x-pack/packages/security-solution/data_table/kibana.jsonc
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"type": "shared-common",
"id": "@kbn/securitysolution-data-table",
"owner": "@elastic/security-threat-hunting-investigations"
"owner": "@elastic/security-threat-hunting-investigations",
"group": "security",
"visibility": "private"
}
6 changes: 5 additions & 1 deletion x-pack/plugins/dashboard_enhanced/kibana.jsonc
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
"type": "plugin",
"id": "@kbn/dashboard-enhanced-plugin",
"owner": "@elastic/kibana-presentation",
"owner": [
"@elastic/kibana-presentation"
],
"group": "platform",
"visibility": "shared",
"plugin": {
"id": "dashboardEnhanced",
"server": true,
Expand Down
2 changes: 2 additions & 0 deletions x-pack/plugins/data_quality/kibana.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"type": "plugin",
"id": "@kbn/data-quality-plugin",
"owner": "@elastic/obs-ux-logs-team",
"group": "observability",
"visibility": "private",
"plugin": {
"id": "dataQuality",
"server": true,
Expand Down
2 changes: 2 additions & 0 deletions x-pack/plugins/ingest_pipelines/kibana.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"type": "plugin",
"id": "@kbn/ingest-pipelines-plugin",
"owner": "@elastic/kibana-management",
"group": "platform",
"visibility": "shared",
"plugin": {
"id": "ingestPipelines",
"server": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import { ElasticsearchClient } from '@kbn/core/server';
import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import { ESLicense } from '@kbn/telemetry-collection-xpack-plugin/server';
import type { LicenseGetLicenseInformation } from '@elastic/elasticsearch/lib/api/types';
import { INDEX_PATTERN_ELASTICSEARCH, USAGE_FETCH_INTERVAL } from '../../common/constants';

/**
Expand All @@ -18,7 +18,7 @@ export async function getLicenses(
callCluster: ElasticsearchClient,
timestamp: number,
maxBucketSize: number
): Promise<{ [clusterUuid: string]: ESLicense | undefined }> {
): Promise<{ [clusterUuid: string]: LicenseGetLicenseInformation | undefined }> {
const response = await fetchLicenses(callCluster, clusterUuids, timestamp, maxBucketSize);
return handleLicenses(response);
}
Expand Down Expand Up @@ -76,7 +76,7 @@ export async function fetchLicenses(
export interface ESClusterStatsWithLicense {
cluster_uuid: string;
type: 'cluster_stats';
license?: ESLicense;
license?: LicenseGetLicenseInformation;
}

/**
Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/monitoring/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"@kbn/features-plugin",
"@kbn/infra-plugin",
"@kbn/licensing-plugin",
"@kbn/telemetry-collection-xpack-plugin",
"@kbn/triggers-actions-ui-plugin",
"@kbn/expect",
"@kbn/i18n",
Expand Down
2 changes: 2 additions & 0 deletions x-pack/plugins/observability_solution/infra/kibana.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"type": "plugin",
"id": "@kbn/infra-plugin",
"owner": ["@elastic/obs-ux-logs-team", "@elastic/obs-ux-infra_services-team"],
"group": "observability",
"visibility": "private",
"description": "This plugin visualizes data from Filebeat and Metricbeat, and integrates with other Observability solutions",
"plugin": {
"id": "infra",
Expand Down
2 changes: 2 additions & 0 deletions x-pack/plugins/observability_solution/inventory/kibana.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"type": "plugin",
"id": "@kbn/inventory-plugin",
"owner": "@elastic/obs-ux-infra_services-team",
"group": "observability",
"visibility": "private",
"plugin": {
"id": "inventory",
"server": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"type": "plugin",
"id": "@kbn/investigate-app-plugin",
"owner": "@elastic/obs-ux-management-team",
"group": "observability",
"visibility": "private",
"plugin": {
"id": "investigateApp",
"server": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {
} from '@kbn/data-plugin/server';
import { PluginStart as DataViewsPluginStart } from '@kbn/data-views-plugin/server';
import { HomeServerPluginSetup } from '@kbn/home-plugin/server';
import { VisTypeTimeseriesSetup } from '@kbn/vis-type-timeseries-plugin/server';
import { FeaturesPluginSetup } from '@kbn/features-plugin/server';
import { SpacesPluginSetup } from '@kbn/spaces-plugin/server';
import { PluginSetupContract as AlertingPluginContract } from '@kbn/alerting-plugin/server';
Expand All @@ -37,7 +36,6 @@ export interface InfraServerPluginSetupDeps {
share: SharePluginSetup;
spaces: SpacesPluginSetup;
usageCollection: UsageCollectionSetup;
visTypeTimeseries: VisTypeTimeseriesSetup;
ml?: MlPluginSetup;
metricsDataAccess: MetricsDataPluginSetup;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"@kbn/data-plugin",
"@kbn/data-views-plugin",
"@kbn/home-plugin",
"@kbn/vis-type-timeseries-plugin",
"@kbn/features-plugin",
"@kbn/spaces-plugin",
"@kbn/alerting-plugin",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
ALERT_STATUS_RECOVERED,
ALERT_STATUS_UNTRACKED,
} from '@kbn/rule-data-utils';
import { Filter } from '@kbn/es-query';
import type { Filter } from '@kbn/es-query';
import { ALERT_STATUS_ALL } from './constants';

export type Maybe<T> = T | null | undefined;
Expand Down Expand Up @@ -54,5 +54,10 @@ export interface TimeRange {
to?: string;
}

export interface EventNonEcsData {
field: string;
value?: Maybe<string[]>;
}

// Alert fields['kibana.alert.group] type
export type GroupBy = Group[];
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@
* 2.0.
*/

/**
* We need to produce types and code transpilation at different folders during the build of the package.
* We have types and code at different imports because we don't want to import the whole package in the resulting webpack bundle for the plugin.
* This way plugins can do targeted imports to reduce the final code bundle
*/
import type { EuiDataGridColumn } from '@elastic/eui';
import {
ALERT_EVALUATION_VALUE,
ALERT_EVALUATION_THRESHOLD,
Expand All @@ -21,30 +17,18 @@ import {
ALERT_INSTANCE_ID,
TAGS,
} from '@kbn/rule-data-utils';
import { EuiDataGridColumn } from '@elastic/eui';
import type { ColumnHeaderOptions } from '@kbn/timelines-plugin/common';
import { i18n } from '@kbn/i18n';

/**
* columns implements a subset of `EuiDataGrid`'s `EuiDataGridColumn` interface,
* plus additional TGrid column properties
*/
export const getColumns = (
{
showRuleName,
}: {
showRuleName?: boolean;
} = { showRuleName: false }
): Array<
Pick<EuiDataGridColumn, 'display' | 'displayAsText' | 'id' | 'initialWidth'> & ColumnHeaderOptions
> => {
const ruleNameColumn: Array<
Pick<EuiDataGridColumn, 'display' | 'displayAsText' | 'id' | 'initialWidth'> &
ColumnHeaderOptions
> = showRuleName
): EuiDataGridColumn[] => {
const ruleNameColumn: EuiDataGridColumn[] = showRuleName
? [
{
columnHeaderType: 'not-filtered',
displayAsText: i18n.translate(
'xpack.observability.alertsTGrid.ruleNameColumnDescription',
{
Expand All @@ -59,15 +43,13 @@ export const getColumns = (

return [
{
columnHeaderType: 'not-filtered',
displayAsText: i18n.translate('xpack.observability.alertsTGrid.statusColumnDescription', {
defaultMessage: 'Alert Status',
}),
id: ALERT_STATUS,
initialWidth: 120,
},
{
columnHeaderType: 'not-filtered',
displayAsText: i18n.translate('xpack.observability.alertsTGrid.triggeredColumnDescription', {
defaultMessage: 'Triggered',
}),
Expand All @@ -76,7 +58,6 @@ export const getColumns = (
schema: 'datetime',
},
{
columnHeaderType: 'not-filtered',
displayAsText: i18n.translate('xpack.observability.alertsTGrid.durationColumnDescription', {
defaultMessage: 'Duration',
}),
Expand All @@ -85,15 +66,13 @@ export const getColumns = (
},
...ruleNameColumn,
{
columnHeaderType: 'not-filtered',
displayAsText: i18n.translate('xpack.observability.alertsTGrid.sourceColumnDescription', {
defaultMessage: 'Group',
}),
id: ALERT_INSTANCE_ID,
initialWidth: 100,
},
{
columnHeaderType: 'not-filtered',
displayAsText: i18n.translate(
'xpack.observability.alertsTGrid.observedValueColumnDescription',
{
Expand All @@ -104,28 +83,24 @@ export const getColumns = (
initialWidth: 100,
},
{
columnHeaderType: 'not-filtered',
displayAsText: i18n.translate('xpack.observability.alertsTGrid.thresholdColumnDescription', {
defaultMessage: 'Threshold',
}),
id: ALERT_EVALUATION_THRESHOLD,
initialWidth: 100,
},
{
columnHeaderType: 'not-filtered',
displayAsText: i18n.translate('xpack.observability.alertsTGrid.tagsColumnDescription', {
defaultMessage: 'Tags',
}),
id: TAGS,
initialWidth: 150,
},
{
columnHeaderType: 'not-filtered',
displayAsText: i18n.translate('xpack.observability.alertsTGrid.reasonColumnDescription', {
defaultMessage: 'Reason',
}),
id: ALERT_REASON,
linkField: '*',
},
];
};
Loading

0 comments on commit c91614d

Please sign in to comment.