Skip to content

Commit

Permalink
[Logs UI] Access ML via the programmatic plugin API (#68905)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
weltenwort authored Jun 25, 2020
1 parent ac3a1a3 commit 44d60c5
Show file tree
Hide file tree
Showing 20 changed files with 773 additions and 834 deletions.
3 changes: 3 additions & 0 deletions x-pack/plugins/infra/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
"alerts",
"triggers_actions_ui"
],
"optionalPlugins": [
"ml"
],
"server": true,
"ui": true,
"configPath": ["xpack", "infra"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { SearchResponse, GenericParams } from 'elasticsearch';
import { GenericParams, SearchResponse } from 'elasticsearch';
import { Lifecycle } from 'hapi';
import { UsageCollectionSetup } from 'src/plugins/usage_collection/server';
import { RouteMethod, RouteConfig } from '../../../../../../../src/core/server';
import { PluginSetupContract as FeaturesPluginSetup } from '../../../../../../plugins/features/server';
import { SpacesPluginSetup } from '../../../../../../plugins/spaces/server';
import { RouteConfig, RouteMethod } from '../../../../../../../src/core/server';
import { HomeServerPluginSetup } from '../../../../../../../src/plugins/home/server';
import { VisTypeTimeseriesSetup } from '../../../../../../../src/plugins/vis_type_timeseries/server';
import { APMPluginSetup } from '../../../../../../plugins/apm/server';
import { HomeServerPluginSetup } from '../../../../../../../src/plugins/home/server';
import { PluginSetupContract as FeaturesPluginSetup } from '../../../../../../plugins/features/server';
import { SpacesPluginSetup } from '../../../../../../plugins/spaces/server';
import { PluginSetupContract as AlertingPluginContract } from '../../../../../alerts/server';
import { MlPluginSetup } from '../../../../../ml/server';

// NP_TODO: Compose real types from plugins we depend on, no "any"
export interface InfraServerPluginDeps {
home: HomeServerPluginSetup;
spaces: SpacesPluginSetup;
Expand All @@ -24,6 +24,7 @@ export interface InfraServerPluginDeps {
features: FeaturesPluginSetup;
apm: APMPluginSetup;
alerts: AlertingPluginContract;
ml?: MlPluginSetup;
}

export interface CallWithRequestParams extends GenericParams {
Expand Down
59 changes: 0 additions & 59 deletions x-pack/plugins/infra/server/lib/compose/kibana.ts

This file was deleted.

3 changes: 0 additions & 3 deletions x-pack/plugins/infra/server/lib/infra_types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { InfraSourceConfiguration } from '../../common/graphql/types';
import { InfraFieldsDomain } from './domains/fields_domain';
import { InfraLogEntriesDomain } from './domains/log_entries_domain';
import { InfraMetricsDomain } from './domains/metrics_domain';
import { LogEntryCategoriesAnalysis, LogEntryRateAnalysis } from './log_analysis';
import { InfraSnapshot } from './snapshot';
import { InfraSources } from './sources';
import { InfraSourceStatus } from './source_status';
Expand All @@ -31,8 +30,6 @@ export interface InfraDomainLibs {
export interface InfraBackendLibs extends InfraDomainLibs {
configuration: InfraConfig;
framework: KibanaFramework;
logEntryCategoriesAnalysis: LogEntryCategoriesAnalysis;
logEntryRateAnalysis: LogEntryRateAnalysis;
snapshot: InfraSnapshot;
sources: InfraSources;
sourceStatus: InfraSourceStatus;
Expand Down
Loading

0 comments on commit 44d60c5

Please sign in to comment.