[Log Explorer] Convert log explorer profile into standalone app (#164493)

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Marco Antonio Ghiani <marcoantonio.ghiani01@gmail.com>
This commit is contained in:
Felix Stürmer 2023-08-31 14:18:44 +02:00 committed by GitHub
parent 5a30e4d5cc
commit ad59308b24
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
161 changed files with 1494 additions and 747 deletions

View file

@ -279,7 +279,6 @@ enabled:
- x-pack/test/functional/apps/data_views/config.ts
- x-pack/test/functional/apps/dev_tools/config.ts
- x-pack/test/functional/apps/discover/config.ts
- x-pack/test/functional/apps/discover_log_explorer/config.ts
- x-pack/test/functional/apps/graph/config.ts
- x-pack/test/functional/apps/grok_debugger/config.ts
- x-pack/test/functional/apps/home/config.ts
@ -313,6 +312,7 @@ enabled:
- x-pack/test/functional/apps/ml/short_tests/config.ts
- x-pack/test/functional/apps/ml/stack_management_jobs/config.ts
- x-pack/test/functional/apps/monitoring/config.ts
- x-pack/test/functional/apps/observability_log_explorer/config.ts
- x-pack/test/functional/apps/remote_clusters/config.ts
- x-pack/test/functional/apps/reporting_management/config.ts
- x-pack/test/functional/apps/rollup_job/config.ts

View file

@ -26,7 +26,7 @@ const STORYBOOKS = [
'dashboard_enhanced',
'dashboard',
'data',
'discover_log_explorer',
'log_explorer',
'embeddable',
'expression_error',
'expression_image',

3
.github/CODEOWNERS vendored
View file

@ -329,7 +329,6 @@ packages/kbn-dev-utils @elastic/kibana-operations
examples/developer_examples @elastic/appex-sharedux
examples/discover_customization_examples @elastic/kibana-data-discovery
x-pack/plugins/discover_enhanced @elastic/kibana-data-discovery
x-pack/plugins/discover_log_explorer @elastic/infra-monitoring-ui
src/plugins/discover @elastic/kibana-data-discovery
packages/kbn-discover-utils @elastic/kibana-data-discovery
packages/kbn-doc-links @elastic/docs
@ -472,6 +471,7 @@ packages/kbn-lint-ts-projects-cli @elastic/kibana-operations
x-pack/plugins/lists @elastic/security-detection-engine
examples/locator_examples @elastic/kibana-app-services
examples/locator_explorer @elastic/kibana-app-services
x-pack/plugins/log_explorer @elastic/infra-monitoring-ui
packages/kbn-logging @elastic/kibana-core
packages/kbn-logging-mocks @elastic/kibana-core
x-pack/plugins/logs_shared @elastic/infra-monitoring-ui
@ -524,6 +524,7 @@ packages/kbn-object-versioning @elastic/appex-sharedux
x-pack/plugins/observability_ai_assistant @elastic/obs-ai-assistant
x-pack/packages/observability/alert_details @elastic/actionable-observability
x-pack/test/cases_api_integration/common/plugins/observability @elastic/response-ops
x-pack/plugins/observability_log_explorer @elastic/infra-monitoring-ui
x-pack/plugins/observability_onboarding @elastic/apm-ui
x-pack/plugins/observability @elastic/actionable-observability
x-pack/plugins/observability_shared @elastic/observability-ui

View file

@ -10,7 +10,6 @@ xpack.serverless.observability.enabled: true
## Configure plugins
xpack.infra.logs.app_target: discover
xpack.discoverLogExplorer.featureFlags.deepLinkVisible: true
## Set the home route
uiSettings.overrides.defaultRoute: /app/observability/landing

View file

@ -520,10 +520,6 @@ Plugin server-side only. Plugin has three main functions:
|Contains the enhancements to the OSS discover app.
|{kib-repo}blob/{branch}/x-pack/plugins/discover_log_explorer/README.md[discoverLogExplorer]
|This plugin registers a log-explorer profile using the Discover customization framework, offering several affordances specifically designed for log consumption.
|{kib-repo}blob/{branch}/x-pack/plugins/ecs_data_quality_dashboard/README.md[ecsDataQualityDashboard]
|This plugin implements (server) APIs used to render the content of the Data Quality dashboard.
@ -632,6 +628,10 @@ the infrastructure monitoring use-case within Kibana.
using the CURL scripts in the scripts folder.
|{kib-repo}blob/{branch}/x-pack/plugins/log_explorer/README.md[logExplorer]
|This plugin provides a LogExplorer component using the Discover customization framework, offering several affordances specifically designed for log consumption.
|{kib-repo}blob/{branch}/x-pack/plugins/logs_shared/README.md[logsShared]
|Exposes the shared components and APIs to access and visualize logs.
@ -669,6 +669,10 @@ Elastic.
|This document gives an overview of the features of the Observability AI Assistant at the time of writing, and how to use them. At a high level, the Observability AI Assistant offers contextual insights, and a chat functionality that we enrich with function calling, allowing the LLM to hook into the user's data. We also allow the LLM to store things it considers new information as embeddings into Elasticsearch, and query this knowledge base when it decides it needs more information, using ELSER.
|{kib-repo}blob/{branch}/x-pack/plugins/observability_log_explorer/README.md[observabilityLogExplorer]
|This plugin provides an app based on the LogExplorer component from the log_explorer plugin, but adds observability-specific affordances.
|{kib-repo}blob/{branch}/x-pack/plugins/observability_onboarding/README.md[observabilityOnboarding]
|This plugin provides an onboarding framework for observability solutions: Logs and APM.

View file

@ -374,7 +374,6 @@
"@kbn/developer-examples-plugin": "link:examples/developer_examples",
"@kbn/discover-customization-examples-plugin": "link:examples/discover_customization_examples",
"@kbn/discover-enhanced-plugin": "link:x-pack/plugins/discover_enhanced",
"@kbn/discover-log-explorer-plugin": "link:x-pack/plugins/discover_log_explorer",
"@kbn/discover-plugin": "link:src/plugins/discover",
"@kbn/discover-utils": "link:packages/kbn-discover-utils",
"@kbn/doc-links": "link:packages/kbn-doc-links",
@ -494,6 +493,7 @@
"@kbn/lists-plugin": "link:x-pack/plugins/lists",
"@kbn/locator-examples-plugin": "link:examples/locator_examples",
"@kbn/locator-explorer-plugin": "link:examples/locator_explorer",
"@kbn/log-explorer-plugin": "link:x-pack/plugins/log_explorer",
"@kbn/logging": "link:packages/kbn-logging",
"@kbn/logging-mocks": "link:packages/kbn-logging-mocks",
"@kbn/logs-shared-plugin": "link:x-pack/plugins/logs_shared",
@ -543,6 +543,7 @@
"@kbn/observability-ai-assistant-plugin": "link:x-pack/plugins/observability_ai_assistant",
"@kbn/observability-alert-details": "link:x-pack/packages/observability/alert_details",
"@kbn/observability-fixtures-plugin": "link:x-pack/test/cases_api_integration/common/plugins/observability",
"@kbn/observability-log-explorer-plugin": "link:x-pack/plugins/observability_log_explorer",
"@kbn/observability-onboarding-plugin": "link:x-pack/plugins/observability_onboarding",
"@kbn/observability-plugin": "link:x-pack/plugins/observability",
"@kbn/observability-shared-plugin": "link:x-pack/plugins/observability_shared",

View file

@ -8,6 +8,8 @@
export const LOGS_APP_ID = 'logs';
export const OBSERVABILITY_LOG_EXPLORER = 'observability-log-explorer';
export const OBSERVABILITY_OVERVIEW_APP_ID = 'observability-overview';
export const METRICS_APP_ID = 'metrics';

View file

@ -5,10 +5,10 @@
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { DISCOVER_APP_ID } from '@kbn/deeplinks-analytics';
import {
LOGS_APP_ID,
OBSERVABILITY_LOG_EXPLORER,
OBSERVABILITY_OVERVIEW_APP_ID,
METRICS_APP_ID,
APM_APP_ID,
@ -16,6 +16,7 @@ import {
} from './constants';
type LogsApp = typeof LOGS_APP_ID;
type ObservabilityLogExplorerApp = typeof OBSERVABILITY_LOG_EXPLORER;
type ObservabilityOverviewApp = typeof OBSERVABILITY_OVERVIEW_APP_ID;
type MetricsApp = typeof METRICS_APP_ID;
type ApmApp = typeof APM_APP_ID;
@ -23,13 +24,12 @@ type ObservabilityOnboardingApp = typeof OBSERVABILITY_ONBOARDING_APP_ID;
export type AppId =
| LogsApp
| ObservabilityLogExplorerApp
| ObservabilityOverviewApp
| ObservabilityOnboardingApp
| ApmApp
| MetricsApp;
export type DiscoverLogExplorerId = `${typeof DISCOVER_APP_ID}:log-explorer`;
export type LogsLinkId = 'log-categories' | 'settings' | 'anomalies' | 'stream';
export type ObservabilityOverviewLinkId =
@ -55,7 +55,6 @@ export type LinkId = LogsLinkId | ObservabilityOverviewLinkId | MetricsLinkId |
export type DeepLinkId =
| AppId
| DiscoverLogExplorerId
| `${LogsApp}:${LogsLinkId}`
| `${ObservabilityOverviewApp}:${ObservabilityOverviewLinkId}`
| `${MetricsApp}:${MetricsLinkId}`

View file

@ -16,6 +16,5 @@
"target/**/*"
],
"kbn_references": [
"@kbn/deeplinks-analytics",
]
}

View file

@ -28,7 +28,7 @@ pageLoadAssetSize:
dashboard: 82025
dashboardEnhanced: 65646
data: 454087
dataViewEditor: 13000
dataViewEditor: 28082
dataViewFieldEditor: 27000
dataViewManagement: 5000
dataViews: 47000
@ -36,7 +36,6 @@ pageLoadAssetSize:
devTools: 38637
discover: 99999
discoverEnhanced: 42730
discoverLogExplorer: 39045
embeddable: 87309
embeddableEnhanced: 22107
enterpriseSearch: 50858
@ -87,6 +86,7 @@ pageLoadAssetSize:
licenseManagement: 41817
licensing: 29004
lists: 22900
logExplorer: 39045
logsShared: 281060
logstash: 53548
management: 46112
@ -99,6 +99,7 @@ pageLoadAssetSize:
noDataPage: 5000
observability: 115443
observabilityAIAssistant: 25000
observabilityLogExplorer: 23686
observabilityOnboarding: 19573
observabilityShared: 52256
osquery: 107090

View file

@ -27,7 +27,7 @@ export const storybookAliases = {
dashboard: 'src/plugins/dashboard/.storybook',
data: 'src/plugins/data/.storybook',
discover: 'src/plugins/discover/.storybook',
discover_log_explorer: 'x-pack/plugins/discover_log_explorer/.storybook',
log_explorer: 'x-pack/plugins/log_explorer/.storybook',
embeddable: 'src/plugins/embeddable/.storybook',
es_ui_shared: 'src/plugins/es_ui_shared/.storybook',
expression_error: 'src/plugins/expression_error/.storybook',

View file

@ -154,6 +154,7 @@ export const applicationUsageSchema = {
maps: commonSchema,
ml: commonSchema,
monitoring: commonSchema,
'observability-log-explorer': commonSchema,
'observability-overview': commonSchema,
observabilityOnboarding: commonSchema,
observabilityAIAssistant: commonSchema,

View file

@ -4587,6 +4587,137 @@
}
}
},
"observability-log-explorer": {
"properties": {
"appId": {
"type": "keyword",
"_meta": {
"description": "The application being tracked"
}
},
"viewId": {
"type": "keyword",
"_meta": {
"description": "Always `main`"
}
},
"clicks_total": {
"type": "long",
"_meta": {
"description": "General number of clicks in the application since we started counting them"
}
},
"clicks_7_days": {
"type": "long",
"_meta": {
"description": "General number of clicks in the application over the last 7 days"
}
},
"clicks_30_days": {
"type": "long",
"_meta": {
"description": "General number of clicks in the application over the last 30 days"
}
},
"clicks_90_days": {
"type": "long",
"_meta": {
"description": "General number of clicks in the application over the last 90 days"
}
},
"minutes_on_screen_total": {
"type": "float",
"_meta": {
"description": "Minutes the application is active and on-screen since we started counting them."
}
},
"minutes_on_screen_7_days": {
"type": "float",
"_meta": {
"description": "Minutes the application is active and on-screen over the last 7 days"
}
},
"minutes_on_screen_30_days": {
"type": "float",
"_meta": {
"description": "Minutes the application is active and on-screen over the last 30 days"
}
},
"minutes_on_screen_90_days": {
"type": "float",
"_meta": {
"description": "Minutes the application is active and on-screen over the last 90 days"
}
},
"views": {
"type": "array",
"items": {
"properties": {
"appId": {
"type": "keyword",
"_meta": {
"description": "The application being tracked"
}
},
"viewId": {
"type": "keyword",
"_meta": {
"description": "The application view being tracked"
}
},
"clicks_total": {
"type": "long",
"_meta": {
"description": "General number of clicks in the application sub view since we started counting them"
}
},
"clicks_7_days": {
"type": "long",
"_meta": {
"description": "General number of clicks in the active application sub view over the last 7 days"
}
},
"clicks_30_days": {
"type": "long",
"_meta": {
"description": "General number of clicks in the active application sub view over the last 30 days"
}
},
"clicks_90_days": {
"type": "long",
"_meta": {
"description": "General number of clicks in the active application sub view over the last 90 days"
}
},
"minutes_on_screen_total": {
"type": "float",
"_meta": {
"description": "Minutes the application sub view is active and on-screen since we started counting them."
}
},
"minutes_on_screen_7_days": {
"type": "float",
"_meta": {
"description": "Minutes the application is active and on-screen active application sub view over the last 7 days"
}
},
"minutes_on_screen_30_days": {
"type": "float",
"_meta": {
"description": "Minutes the application is active and on-screen active application sub view over the last 30 days"
}
},
"minutes_on_screen_90_days": {
"type": "float",
"_meta": {
"description": "Minutes the application is active and on-screen active application sub view over the last 90 days"
}
}
}
}
}
}
},
"observability-overview": {
"properties": {
"appId": {

View file

@ -293,10 +293,7 @@ export default function ({ getService }: PluginFunctionalProviderContext) {
'xpack.observability.unsafe.alertDetails.observability.enabled (boolean)',
'xpack.observability.unsafe.thresholdRule.enabled (boolean)',
'xpack.observability_onboarding.ui.enabled (boolean)',
/**
* xpack.discoverLogExplorer.featureFlags is conditional and will never resolve if used in non-serverless environment
*/
'xpack.discoverLogExplorer.featureFlags.deepLinkVisible (any)',
'xpack.observabilityLogExplorer.navigation.showAppLink (any)', // conditional, is actually a boolean
];
// We don't assert that actualExposedConfigKeys and expectedExposedConfigKeys are equal, because test failure messages with large
// arrays are hard to grok. Instead, we take the difference between the two arrays and assert them separately, that way it's

View file

@ -652,8 +652,6 @@
"@kbn/discover-customization-examples-plugin/*": ["examples/discover_customization_examples/*"],
"@kbn/discover-enhanced-plugin": ["x-pack/plugins/discover_enhanced"],
"@kbn/discover-enhanced-plugin/*": ["x-pack/plugins/discover_enhanced/*"],
"@kbn/discover-log-explorer-plugin": ["x-pack/plugins/discover_log_explorer"],
"@kbn/discover-log-explorer-plugin/*": ["x-pack/plugins/discover_log_explorer/*"],
"@kbn/discover-plugin": ["src/plugins/discover"],
"@kbn/discover-plugin/*": ["src/plugins/discover/*"],
"@kbn/discover-utils": ["packages/kbn-discover-utils"],
@ -938,6 +936,8 @@
"@kbn/locator-examples-plugin/*": ["examples/locator_examples/*"],
"@kbn/locator-explorer-plugin": ["examples/locator_explorer"],
"@kbn/locator-explorer-plugin/*": ["examples/locator_explorer/*"],
"@kbn/log-explorer-plugin": ["x-pack/plugins/log_explorer"],
"@kbn/log-explorer-plugin/*": ["x-pack/plugins/log_explorer/*"],
"@kbn/logging": ["packages/kbn-logging"],
"@kbn/logging/*": ["packages/kbn-logging/*"],
"@kbn/logging-mocks": ["packages/kbn-logging-mocks"],
@ -1042,6 +1042,8 @@
"@kbn/observability-alert-details/*": ["x-pack/packages/observability/alert_details/*"],
"@kbn/observability-fixtures-plugin": ["x-pack/test/cases_api_integration/common/plugins/observability"],
"@kbn/observability-fixtures-plugin/*": ["x-pack/test/cases_api_integration/common/plugins/observability/*"],
"@kbn/observability-log-explorer-plugin": ["x-pack/plugins/observability_log_explorer"],
"@kbn/observability-log-explorer-plugin/*": ["x-pack/plugins/observability_log_explorer/*"],
"@kbn/observability-onboarding-plugin": ["x-pack/plugins/observability_onboarding"],
"@kbn/observability-onboarding-plugin/*": ["x-pack/plugins/observability_onboarding/*"],
"@kbn/observability-plugin": ["x-pack/plugins/observability"],

View file

@ -21,7 +21,6 @@
"xpack.customBranding": "plugins/custom_branding",
"xpack.dashboard": "plugins/dashboard_enhanced",
"xpack.discover": "plugins/discover_enhanced",
"xpack.discoverLogExplorer": "plugins/discover_log_explorer",
"xpack.crossClusterReplication": "plugins/cross_cluster_replication",
"xpack.elasticAssistant": "packages/kbn-elastic-assistant",
"xpack.ecsDataQualityDashboard": "plugins/ecs_data_quality_dashboard",
@ -39,6 +38,7 @@
"xpack.idxMgmt": "plugins/index_management",
"xpack.indexLifecycleMgmt": "plugins/index_lifecycle_management",
"xpack.infra": "plugins/infra",
"xpack.logExplorer": "plugins/log_explorer",
"xpack.logsShared": "plugins/logs_shared",
"xpack.fleet": "plugins/fleet",
"xpack.ingestPipelines": "plugins/ingest_pipelines",
@ -61,6 +61,7 @@
],
"xpack.monitoring": ["plugins/monitoring"],
"xpack.observability": "plugins/observability",
"xpack.observabilityLogExplorer": "plugins/observability_log_explorer",
"xpack.observabilityShared": "plugins/observability_shared",
"xpack.observability_onboarding": "plugins/observability_onboarding",
"xpack.observabilityAiAssistant": "plugins/observability_ai_assistant",

View file

@ -1,8 +0,0 @@
# Discover Log Explorer
This plugin registers a `log-explorer` profile using the Discover customization framework, offering several affordances specifically designed for log consumption.
The plugin enhances the capabilities of Discover in the following ways:
- **Dataset selector**: this customization on the Discover page replaces the DataViews picker with a Logs dataset selector built ad-hoc to provide a better experience when navigating throught all the available datasets.

View file

@ -1,53 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { fold } from 'fp-ts/lib/Either';
import { identity } from 'fp-ts/lib/function';
import { pipe } from 'fp-ts/lib/pipeable';
import { Context, Errors, IntersectionType, Type, UnionType, ValidationError } from 'io-ts';
type ErrorFactory = (message: string) => Error;
const getErrorPath = ([first, ...rest]: Context): string[] => {
if (typeof first === 'undefined') {
return [];
} else if (first.type instanceof IntersectionType) {
const [, ...next] = rest;
return getErrorPath(next);
} else if (first.type instanceof UnionType) {
const [, ...next] = rest;
return [first.key, ...getErrorPath(next)];
}
return [first.key, ...getErrorPath(rest)];
};
const getErrorType = ({ context }: ValidationError) =>
context[context.length - 1]?.type?.name ?? 'unknown';
const formatError = (error: ValidationError) =>
error.message ??
`in ${getErrorPath(error.context).join('/')}: ${JSON.stringify(
error.value
)} does not match expected type ${getErrorType(error)}`;
export const formatErrors = (errors: ValidationError[]) =>
`Failed to validate: \n${errors.map((error) => ` ${formatError(error)}`).join('\n')}`;
export const createPlainError = (message: string) => new Error(message);
export const throwErrors = (createError: ErrorFactory) => (errors: Errors) => {
throw createError(formatErrors(errors));
};
export const decodeOrThrow =
<DecodedValue, EncodedValue, InputValue>(
runtimeType: Type<DecodedValue, EncodedValue, InputValue>,
createError: ErrorFactory = createPlainError
) =>
(inputValue: InputValue) =>
pipe(runtimeType.decode(inputValue), fold(throwErrors(createError), identity));

View file

@ -1,15 +0,0 @@
{
"type": "plugin",
"id": "@kbn/discover-log-explorer-plugin",
"owner": "@elastic/infra-monitoring-ui",
"description": "This plugin exposes and registers Logs+ features.",
"plugin": {
"id": "discoverLogExplorer",
"server": true,
"browser": true,
"configPath": ["xpack", "discoverLogExplorer"],
"requiredPlugins": ["data", "dataViews", "discover", "fleet", "kibanaReact", "kibanaUtils", "controls", "embeddable"],
"optionalPlugins": [],
"requiredBundles": []
}
}

View file

@ -1,21 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { AppDeepLink, AppNavLinkStatus, DEFAULT_APP_CATEGORIES } from '@kbn/core/public';
import { i18n } from '@kbn/i18n';
import { LOG_EXPLORER_PROFILE_ID } from '../common/constants';
export const getLogExplorerDeepLink = ({ isVisible }: { isVisible: boolean }): AppDeepLink => ({
id: LOG_EXPLORER_PROFILE_ID,
title: i18n.translate('xpack.discoverLogExplorer.deepLink', {
defaultMessage: 'Logs Explorer',
}),
path: `#/p/${LOG_EXPLORER_PROFILE_ID}`,
category: DEFAULT_APP_CATEGORIES.observability,
euiIconType: 'logoObservability',
navLinkStatus: isVisible ? AppNavLinkStatus.visible : AppNavLinkStatus.default,
});

View file

@ -1,38 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { CoreStart, Plugin, PluginInitializerContext } from '@kbn/core/public';
import { LOG_EXPLORER_PROFILE_ID } from '../common/constants';
import { DiscoverLogExplorerConfig } from '../common/plugin_config';
import { createLogExplorerProfileCustomizations } from './customizations/log_explorer_profile';
import { getLogExplorerDeepLink } from './deep_links';
import {
DiscoverLogExplorerPluginSetup,
DiscoverLogExplorerPluginStart,
DiscoverLogExplorerStartDeps,
} from './types';
export class DiscoverLogExplorerPlugin
implements Plugin<DiscoverLogExplorerPluginSetup, DiscoverLogExplorerPluginStart>
{
private config: DiscoverLogExplorerConfig;
constructor(context: PluginInitializerContext<DiscoverLogExplorerConfig>) {
this.config = context.config.get();
}
public setup() {}
public start(core: CoreStart, plugins: DiscoverLogExplorerStartDeps) {
const { discover, data } = plugins;
discover.registerCustomizationProfile(LOG_EXPLORER_PROFILE_ID, {
customize: createLogExplorerProfileCustomizations({ core, data }),
deepLinks: [getLogExplorerDeepLink({ isVisible: this.config.featureFlags.deepLinkVisible })],
});
}
}

View file

@ -1,16 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { DataPublicPluginStart } from '@kbn/data-plugin/public';
import { DiscoverStart } from '@kbn/discover-plugin/public';
export type DiscoverLogExplorerPluginSetup = void;
export type DiscoverLogExplorerPluginStart = void;
export interface DiscoverLogExplorerStartDeps {
data: DataPublicPluginStart;
discover: DiscoverStart;
}

View file

@ -1,31 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { schema, offeringBasedSchema } from '@kbn/config-schema';
import { PluginConfigDescriptor } from '@kbn/core/server';
import { DiscoverLogExplorerConfig } from '../common/plugin_config';
export const configSchema = schema.object({
featureFlags: schema.object({
deepLinkVisible: offeringBasedSchema({
serverless: schema.boolean(),
options: {
defaultValue: false,
},
}),
}),
});
export const config: PluginConfigDescriptor<DiscoverLogExplorerConfig> = {
schema: configSchema,
exposeToBrowser: {
featureFlags: {
deepLinkVisible: true,
},
},
};

View file

@ -130,6 +130,12 @@ export class Plugin implements InfraClientPluginClass {
label: 'Logs',
sortKey: 200,
entries: [
{
label: 'Explorer',
app: 'observability-log-explorer',
path: '/',
isBetaFeature: true,
},
{ label: 'Stream', app: 'logs', path: '/stream' },
{ label: 'Anomalies', app: 'logs', path: '/anomalies' },
{ label: 'Categories', app: 'logs', path: '/log-categories' },

View file

@ -0,0 +1,8 @@
# Log Explorer
This plugin provides a `LogExplorer` component using the Discover customization framework, offering several affordances specifically designed for log consumption.
The plugin enhances the capabilities of Discover in the following ways:
- **Dataset selector**: this customization replaces the DataViews picker with a Logs dataset selector built ad-hoc to provide a better experience when navigating throught all the available datasets.

View file

@ -0,0 +1,9 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface LogExplorerConfig {}

View file

@ -0,0 +1,8 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
export { createPlainError, decodeOrThrow, formatErrors, throwErrors } from '@kbn/io-ts-utils';

View file

@ -8,10 +8,8 @@
module.exports = {
preset: '@kbn/test',
rootDir: '../../..',
roots: ['<rootDir>/x-pack/plugins/discover_log_explorer'],
coverageDirectory: '<rootDir>/target/kibana-coverage/jest/x-pack/plugins/discover_log_explorer',
roots: ['<rootDir>/x-pack/plugins/log_explorer'],
coverageDirectory: '<rootDir>/target/kibana-coverage/jest/x-pack/plugins/log_explorer',
coverageReporters: ['text', 'html'],
collectCoverageFrom: [
'<rootDir>/x-pack/plugins/discover_log_explorer/{common,public}/**/*.{ts,tsx}',
],
collectCoverageFrom: ['<rootDir>/x-pack/plugins/log_explorer/{common,public}/**/*.{ts,tsx}'],
};

View file

@ -0,0 +1,27 @@
{
"type": "plugin",
"id": "@kbn/log-explorer-plugin",
"owner": "@elastic/infra-monitoring-ui",
"description": "This plugin provides a LogExplorer component using the Discover customization framework, offering several affordances specifically designed for log consumption.",
"plugin": {
"id": "logExplorer",
"server": true,
"browser": true,
"configPath": [
"xpack",
"logExplorer"
],
"requiredPlugins": [
"data",
"dataViews",
"discover",
"fleet",
"kibanaReact",
"kibanaUtils",
"controls",
"embeddable"
],
"optionalPlugins": [],
"requiredBundles": []
}
}

View file

@ -16,59 +16,53 @@ export const DATA_VIEW_POPOVER_CONTENT_WIDTH = 300;
export const contextMenuStyles = { maxHeight: 440 };
export const selectDatasetLabel = i18n.translate(
'xpack.discoverLogExplorer.datasetSelector.selectDataset',
'xpack.logExplorer.datasetSelector.selectDataset',
{ defaultMessage: 'Select dataset' }
);
export const integrationsLabel = i18n.translate(
'xpack.discoverLogExplorer.datasetSelector.integrations',
{ defaultMessage: 'Integrations' }
);
export const integrationsLabel = i18n.translate('xpack.logExplorer.datasetSelector.integrations', {
defaultMessage: 'Integrations',
});
export const uncategorizedLabel = i18n.translate(
'xpack.discoverLogExplorer.datasetSelector.uncategorized',
'xpack.logExplorer.datasetSelector.uncategorized',
{ defaultMessage: 'Uncategorized' }
);
export const sortOrdersLabel = i18n.translate(
'xpack.discoverLogExplorer.datasetSelector.sortOrders',
{ defaultMessage: 'Sort directions' }
);
export const sortOrdersLabel = i18n.translate('xpack.logExplorer.datasetSelector.sortOrders', {
defaultMessage: 'Sort directions',
});
export const noDatasetsLabel = i18n.translate(
'xpack.discoverLogExplorer.datasetSelector.noDatasets',
{ defaultMessage: 'No data streams found' }
);
export const noDatasetsLabel = i18n.translate('xpack.logExplorer.datasetSelector.noDatasets', {
defaultMessage: 'No data streams found',
});
export const noDatasetsDescriptionLabel = i18n.translate(
'xpack.discoverLogExplorer.datasetSelector.noDatasetsDescription',
'xpack.logExplorer.datasetSelector.noDatasetsDescription',
{
defaultMessage: 'No datasets or search results found.',
}
);
export const noIntegrationsLabel = i18n.translate(
'xpack.discoverLogExplorer.datasetSelector.noIntegrations',
'xpack.logExplorer.datasetSelector.noIntegrations',
{ defaultMessage: 'No integrations found' }
);
export const noIntegrationsDescriptionLabel = i18n.translate(
'xpack.discoverLogExplorer.datasetSelector.noIntegrationsDescription',
'xpack.logExplorer.datasetSelector.noIntegrationsDescription',
{
defaultMessage: 'No integrations or search results found.',
}
);
export const errorLabel = i18n.translate('xpack.discoverLogExplorer.datasetSelector.error', {
export const errorLabel = i18n.translate('xpack.logExplorer.datasetSelector.error', {
defaultMessage: 'error',
});
export const noDataRetryLabel = i18n.translate(
'xpack.discoverLogExplorer.datasetSelector.noDataRetry',
{
defaultMessage: 'Retry',
}
);
export const noDataRetryLabel = i18n.translate('xpack.logExplorer.datasetSelector.noDataRetry', {
defaultMessage: 'Retry',
});
export const sortOptions = [
{

View file

@ -22,7 +22,7 @@ import {
const meta: Meta<typeof DatasetSelector> = {
component: DatasetSelector,
title: 'discover_log_explorer/DatasetSelector',
title: 'log_explorer/DatasetSelector',
decorators: [(wrappedStory) => <I18nProvider>{wrappedStory()}</I18nProvider>],
argTypes: {
datasetsError: {

View file

@ -52,7 +52,7 @@ export const DatasetsList = ({
titleSize="s"
body={
<FormattedMessage
id="xpack.discoverLogExplorer.datasetSelector.noDatasetsError"
id="xpack.logExplorer.datasetSelector.noDatasetsError"
defaultMessage="An {error} occurred while getting your data streams. Please retry."
values={{
error: (

View file

@ -42,7 +42,7 @@ export const IntegrationsListStatus = ({
titleSize="s"
body={
<FormattedMessage
id="xpack.discoverLogExplorer.datasetSelector.noIntegrationsError"
id="xpack.logExplorer.datasetSelector.noIntegrationsError"
defaultMessage="An {error} occurred while getting your integrations. Please retry."
values={{
error: (

View file

@ -0,0 +1,8 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
export * from './log_explorer';

View file

@ -0,0 +1,62 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { ScopedHistory } from '@kbn/core-application-browser';
import { DataPublicPluginStart, ISearchStart, ISessionService } from '@kbn/data-plugin/public';
import { DiscoverStart } from '@kbn/discover-plugin/public';
import React from 'react';
import {
createLogExplorerProfileCustomizations,
CreateLogExplorerProfileCustomizationsDeps,
} from '../../customizations/log_explorer_profile';
import { createPropertyGetProxy } from '../../utils/proxies';
export interface CreateLogExplorerArgs extends CreateLogExplorerProfileCustomizationsDeps {
discover: DiscoverStart;
}
export interface LogExplorerProps {
scopedHistory: ScopedHistory;
}
export const createLogExplorer = ({
core,
data,
discover: { DiscoverContainer },
}: CreateLogExplorerArgs) => {
const logExplorerCustomizations = [createLogExplorerProfileCustomizations({ core, data })];
const overrideServices = {
data: createDataServiceProxy(data),
};
return ({ scopedHistory }: LogExplorerProps) => {
return (
<DiscoverContainer
customizationCallbacks={logExplorerCustomizations}
overrideServices={overrideServices}
scopedHistory={scopedHistory}
/>
);
};
};
/**
* Create proxy for the data service, in which session service enablement calls
* are no-ops.
*/
const createDataServiceProxy = (data: DataPublicPluginStart) => {
return createPropertyGetProxy(data, {
search: (searchService: ISearchStart) =>
createPropertyGetProxy(searchService, {
session: (sessionService: ISessionService) =>
createPropertyGetProxy(sessionService, {
enableStorage: () => () => {},
}),
}),
});
};

View file

@ -45,16 +45,6 @@ const ControlGroupContainer = euiStyled.div`
.controlGroup {
min-height: unset;
}
.euiFormLabel {
padding-top: 0;
padding-bottom: 0;
line-height: 32px !important;
}
.euiFormControlLayout {
height: 32px;
}
`;
// eslint-disable-next-line import/no-default-export

View file

@ -14,7 +14,7 @@ import { dynamic } from '../utils/dynamic';
const LazyCustomDatasetSelector = dynamic(() => import('./custom_dataset_selector'));
const LazyCustomDatasetFilters = dynamic(() => import('./custom_dataset_filters'));
interface CreateLogExplorerProfileCustomizationsDeps {
export interface CreateLogExplorerProfileCustomizationsDeps {
core: CoreStart;
data: DataPublicPluginStart;
}

View file

@ -0,0 +1,15 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import type { PluginInitializerContext } from '@kbn/core/public';
import type { LogExplorerConfig } from '../common/plugin_config';
import { LogExplorerPlugin } from './plugin';
export type { LogExplorerPluginSetup, LogExplorerPluginStart } from './types';
export function plugin(context: PluginInitializerContext<LogExplorerConfig>) {
return new LogExplorerPlugin(context);
}

View file

@ -0,0 +1,35 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { CoreSetup, CoreStart, Plugin, PluginInitializerContext } from '@kbn/core/public';
import { createLogExplorer } from './components/log_explorer';
import {
LogExplorerPluginSetup,
LogExplorerPluginStart,
LogExplorerSetupDeps,
LogExplorerStartDeps,
} from './types';
export class LogExplorerPlugin implements Plugin<LogExplorerPluginSetup, LogExplorerPluginStart> {
constructor(context: PluginInitializerContext) {}
public setup(core: CoreSetup, plugins: LogExplorerSetupDeps) {}
public start(core: CoreStart, plugins: LogExplorerStartDeps) {
const { data, discover } = plugins;
const LogExplorer = createLogExplorer({
core,
data,
discover,
});
return {
LogExplorer,
};
}
}

View file

@ -11,23 +11,21 @@ import { i18n } from '@kbn/i18n';
export const createDatasetSelectionRestoreFailedNotifier = (toasts: IToasts) => () =>
toasts.addWarning({
title: i18n.translate(
'xpack.discoverLogExplorer.datasetSelection.restoreDatasetSelectionFailedToastTitle',
'xpack.logExplorer.datasetSelection.restoreDatasetSelectionFailedToastTitle',
{ defaultMessage: "We couldn't restore your datasets selection." }
),
text: i18n.translate(
'xpack.discoverLogExplorer.datasetSelection.restoreDatasetSelectionFailedToastMessage',
'xpack.logExplorer.datasetSelection.restoreDatasetSelectionFailedToastMessage',
{ defaultMessage: 'We switched to "All log datasets" as the default selection.' }
),
});
export const createCreateDataViewFailedNotifier = (toasts: IToasts) => () =>
toasts.addWarning({
title: i18n.translate(
'xpack.discoverLogExplorer.datasetSelection.createDataViewFailedToastTitle',
{ defaultMessage: "We couldn't create a data view for your selection." }
),
text: i18n.translate(
'xpack.discoverLogExplorer.datasetSelection.createDataViewFailedToastMessage',
{ defaultMessage: 'We switched to "All log datasets" as the default selection.' }
),
title: i18n.translate('xpack.logExplorer.datasetSelection.createDataViewFailedToastTitle', {
defaultMessage: "We couldn't create a data view for your selection.",
}),
text: i18n.translate('xpack.logExplorer.datasetSelection.createDataViewFailedToastMessage', {
defaultMessage: 'We switched to "All log datasets" as the default selection.',
}),
});

View file

@ -0,0 +1,23 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import type { DataPublicPluginStart } from '@kbn/data-plugin/public';
import type { DiscoverStart } from '@kbn/discover-plugin/public';
import type { ComponentType } from 'react';
import type { LogExplorerProps } from './components/log_explorer';
export type LogExplorerPluginSetup = void;
export interface LogExplorerPluginStart {
LogExplorer: ComponentType<LogExplorerProps>;
}
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface LogExplorerSetupDeps {}
export interface LogExplorerStartDeps {
data: DataPublicPluginStart;
discover: DiscoverStart;
}

Some files were not shown because too many files have changed in this diff Show more