Skip to content

Commit 44d60c5

Browse files
authored
[Logs UI] Access ML via the programmatic plugin API (#68905)
This modifies the routes related to log rate and category analysis to use the new programmatic APIs provided by the `ml` plugin to access the results index and job info. Because that access is facilitated via the request context, the log analysis lib was converted from classes to plain functions. At the same time the routes have been updated to use the most recent validation and error handling patterns.
1 parent ac3a1a3 commit 44d60c5

20 files changed

Lines changed: 773 additions & 834 deletions

x-pack/plugins/infra/kibana.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
"alerts",
1414
"triggers_actions_ui"
1515
],
16+
"optionalPlugins": [
17+
"ml"
18+
],
1619
"server": true,
1720
"ui": true,
1821
"configPath": ["xpack", "infra"]

x-pack/plugins/infra/server/lib/adapters/framework/adapter_types.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@
44
* you may not use this file except in compliance with the Elastic License.
55
*/
66

7-
import { SearchResponse, GenericParams } from 'elasticsearch';
7+
import { GenericParams, SearchResponse } from 'elasticsearch';
88
import { Lifecycle } from 'hapi';
99
import { UsageCollectionSetup } from 'src/plugins/usage_collection/server';
10-
import { RouteMethod, RouteConfig } from '../../../../../../../src/core/server';
11-
import { PluginSetupContract as FeaturesPluginSetup } from '../../../../../../plugins/features/server';
12-
import { SpacesPluginSetup } from '../../../../../../plugins/spaces/server';
10+
import { RouteConfig, RouteMethod } from '../../../../../../../src/core/server';
11+
import { HomeServerPluginSetup } from '../../../../../../../src/plugins/home/server';
1312
import { VisTypeTimeseriesSetup } from '../../../../../../../src/plugins/vis_type_timeseries/server';
1413
import { APMPluginSetup } from '../../../../../../plugins/apm/server';
15-
import { HomeServerPluginSetup } from '../../../../../../../src/plugins/home/server';
14+
import { PluginSetupContract as FeaturesPluginSetup } from '../../../../../../plugins/features/server';
15+
import { SpacesPluginSetup } from '../../../../../../plugins/spaces/server';
1616
import { PluginSetupContract as AlertingPluginContract } from '../../../../../alerts/server';
17+
import { MlPluginSetup } from '../../../../../ml/server';
1718

18-
// NP_TODO: Compose real types from plugins we depend on, no "any"
1919
export interface InfraServerPluginDeps {
2020
home: HomeServerPluginSetup;
2121
spaces: SpacesPluginSetup;
@@ -24,6 +24,7 @@ export interface InfraServerPluginDeps {
2424
features: FeaturesPluginSetup;
2525
apm: APMPluginSetup;
2626
alerts: AlertingPluginContract;
27+
ml?: MlPluginSetup;
2728
}
2829

2930
export interface CallWithRequestParams extends GenericParams {

x-pack/plugins/infra/server/lib/compose/kibana.ts

Lines changed: 0 additions & 59 deletions
This file was deleted.

x-pack/plugins/infra/server/lib/infra_types.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { InfraSourceConfiguration } from '../../common/graphql/types';
88
import { InfraFieldsDomain } from './domains/fields_domain';
99
import { InfraLogEntriesDomain } from './domains/log_entries_domain';
1010
import { InfraMetricsDomain } from './domains/metrics_domain';
11-
import { LogEntryCategoriesAnalysis, LogEntryRateAnalysis } from './log_analysis';
1211
import { InfraSnapshot } from './snapshot';
1312
import { InfraSources } from './sources';
1413
import { InfraSourceStatus } from './source_status';
@@ -31,8 +30,6 @@ export interface InfraDomainLibs {
3130
export interface InfraBackendLibs extends InfraDomainLibs {
3231
configuration: InfraConfig;
3332
framework: KibanaFramework;
34-
logEntryCategoriesAnalysis: LogEntryCategoriesAnalysis;
35-
logEntryRateAnalysis: LogEntryRateAnalysis;
3633
snapshot: InfraSnapshot;
3734
sources: InfraSources;
3835
sourceStatus: InfraSourceStatus;

0 commit comments

Comments
 (0)