Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
578d2f8
[ML] Adds a brush selection tool to single series viewer.
walterra Aug 30, 2018
6d24078
[ML] Annotation Prototype.
walterra Nov 14, 2018
5341e91
[ML] Adds a showAnnotations toggle button to the Single Metric Viewer.
walterra Nov 19, 2018
d73d780
Merge branch 'ml-single-series-annotations' into ml-annotations
walterra Nov 19, 2018
0601c1c
[ML] Fix tooltips. Transpose mock data to use annotations format.
walterra Nov 19, 2018
9513495
[ML] Very prototypish annotation creation.
walterra Nov 20, 2018
10a2ee3
Merge remote-tracking branch 'upstream/master' into ml-annotations
walterra Nov 20, 2018
9d3f723
Merge remote-tracking branch 'upstream/master' into ml-annotations
walterra Nov 21, 2018
6cf1fa9
[ML] Updated annotation brush styling.
walterra Nov 21, 2018
e260824
[ML] Annotating triggers flyout.
walterra Nov 21, 2018
1151d0e
[ML] Saving an annotation works in place.
walterra Nov 21, 2018
2825cb1
[ML] Fresh annotation styles.
walterra Nov 21, 2018
542d45a
Merge remote-tracking branch 'upstream/master' into ml-annotations
walterra Nov 21, 2018
ea01346
[ML] Support for edit/delete. Design tweaks.
walterra Nov 21, 2018
3f82e89
[ML] Remove dev stub data.
walterra Nov 22, 2018
ffff6d1
[ML] Introduces TypeScript interfaces for annotations.
walterra Nov 22, 2018
542397e
[ML] Migrates new components to tsx.
walterra Nov 22, 2018
5c4e5b8
[ML] Introduces feature flag constants.
walterra Nov 23, 2018
4593c47
[ML] Creates components folder for Time Series Viewer.
walterra Nov 23, 2018
df9cd02
Merge remote-tracking branch 'upstream/master' into ml-annotations
walterra Nov 23, 2018
a774fdd
[ML] SCSS fix.
walterra Nov 23, 2018
7dfe450
[ML] Move time series chart to components folder.
walterra Nov 23, 2018
322e25a
[ML] Moving annotateBrush to its own file.
walterra Nov 23, 2018
73bec4a
[ML] Move renderAnnotations to its own function/file.
walterra Nov 23, 2018
7f5af26
[ML] Introduces a feature flag for annotations.
walterra Nov 23, 2018
6eca6b8
[ML] Fixed bugs with editing/deleting annotations and correct UI upda…
walterra Nov 23, 2018
31a6f1c
[ML] Fixes fetching only annotations relevant to the current selection.
walterra Nov 26, 2018
6709dc2
[ML] make feature_flags a ts file.
walterra Nov 26, 2018
416fcdc
[ML] Display annotations in jobs list.
walterra Nov 26, 2018
5f34e4e
[ML] Move getAnnotations() to its own service mlAnnotationService.
walterra Nov 26, 2018
498ebf5
[ML] Fixes annotation drill-down from jobs list to time series viewer.
walterra Nov 26, 2018
81b97e9
[ML] Fixes test mock.
walterra Nov 26, 2018
31c52ce
[ML] Move getAnnotations() to kibana API endpoint.
walterra Nov 27, 2018
3c03d21
[ML] Support annotations table in singel series viewer (hidden for now).
walterra Nov 27, 2018
0623cbc
Merge remote-tracking branch 'upstream/master' into ml-annotations
walterra Nov 27, 2018
28ca31b
Merge remote-tracking branch 'upstream/master' into ml-annotations
walterra Dec 5, 2018
62cdd8a
[ML] Fixes endpoint refactoring. Adds check to auto-create annotation…
walterra Dec 5, 2018
a291154
[ML] migrates timeseries_chart/annotation to TypeScript.
walterra Dec 6, 2018
66464aa
[ML] Introduces MlJob TS interface.
walterra Dec 6, 2018
12f107b
[ML] Adds created/modified/username fields to annotations.
walterra Dec 7, 2018
afcd069
[ML] Adds annotations table to single metric viewer.
walterra Dec 7, 2018
9e1afe7
[ML] Annotation labels in charts changed to number badges.
walterra Dec 7, 2018
c97daba
[ML] Implements annotation highlighting in time series charts on tabl…
walterra Dec 7, 2018
6742b6d
[ML] Fix hiding the annotations table.
walterra Dec 7, 2018
4269696
[ML] Adds more columns with metadata to the annotations table.
walterra Dec 7, 2018
b2709b3
Merge remote-tracking branch 'upstream/master' into ml-annotations
walterra Dec 7, 2018
baf4d8f
[ML] Prototypish Annotatons integration in Anomaly Explorer.
walterra Dec 7, 2018
d6ca1ce
[ML] Annotations Anomaly Explorer Integration.
walterra Dec 10, 2018
014516e
Merge remote-tracking branch 'upstream/master' into ml-annotations
walterra Dec 10, 2018
0566416
[ML] Adds comment to include annotation index and alias creation.
walterra Dec 10, 2018
18109eb
[ML] Adds format to annotations index mapping date fields.
walterra Dec 10, 2018
842a181
[ML] Change annotations fetch code to expect correct mapping for job_…
walterra Dec 10, 2018
629eebf
[ML] disable brushing (creation of annotations) when annotations aren…
walterra Dec 10, 2018
2f9ab40
[ML] work in progress: improvements to annotations overlap removal.
walterra Dec 11, 2018
231299e
[ML] Fixes a merge regression with the timeseries_chart tests.
walterra Dec 11, 2018
3d1b97d
Merge remote-tracking branch 'upstream/master' into ml-annotations
walterra Dec 11, 2018
166a7cf
[ML] Use separate read/write aliases for annotations.
walterra Dec 11, 2018
a985d52
[ML] TypeScript fixes.
walterra Dec 11, 2018
2278c27
[ML] Use an enum to define annotation types.
walterra Dec 11, 2018
4d65b16
[ML] Fixes startup behavior and annotations feature availability.
walterra Dec 11, 2018
82ecc09
[ML] Get rid of CSS overrides, use compressed table instead.
walterra Dec 11, 2018
3688ce9
[ML] Add a comment to the MlJob interface.
walterra Dec 11, 2018
5b984e3
[ML] Anomaly Table and Annotations Table share DEFAULT_QUERY_SIZE=500…
walterra Dec 11, 2018
1a793e3
[ML] Adds a heading comment to the annotations table component.
walterra Dec 11, 2018
759eaaf
[ML] Uses a renderDate() function to do some code deplucation.
walterra Dec 11, 2018
2c172cb
[ML] Remove deprecated comment.
walterra Dec 11, 2018
e054ef4
[ML] Remove the prototypish annotations from the overall swimlane.
walterra Dec 11, 2018
0ff14da
[ML] Adds clarifying comments to SCSS.
walterra Dec 11, 2018
caf24d8
[ML] Use constants instead of hard-coded values.
walterra Dec 11, 2018
d71598b
[ML] Restructring to cleanup timeseries_chart.js
walterra Dec 11, 2018
859d088
[ML] Disable the Annotations Table in Anomaly Explorer for now.
walterra Dec 11, 2018
cc2175c
Merge remote-tracking branch 'upstream/master' into ml-annotations
walterra Dec 12, 2018
453f8fc
[ML] Fixes timeseries_chart test mock for chrome/ui.
walterra Dec 12, 2018
27658cd
[ML] Delete wrongly copied comment.
walterra Dec 12, 2018
5bdfdbe
[ML] Remove fixed widths for table columns, use eui-textOverflowWrap …
walterra Dec 12, 2018
f48a612
[ML] Rename mlAnomaliesTableService to mlTableService.
walterra Dec 12, 2018
a478c81
[ML] Fix wrongly copied comment text.
walterra Dec 12, 2018
903b999
[ML] Migrates annotations brush SCSS to BEM/variables.
walterra Dec 13, 2018
fb52ccc
[ML] Various minor review feedback fixes.
walterra Dec 13, 2018
e251767
[ML] Avoid binding this in render function.
walterra Dec 13, 2018
c5a4a11
[ML] Use separate constants for annotations and anomaly table query s…
walterra Dec 13, 2018
211629f
[ML] Remove # heading from annotations table.
walterra Dec 13, 2018
04f13b6
[ML] Changing log severity from error to info.
walterra Dec 13, 2018
a171183
[ML] Replacing some hard-coded CSS with variables.
walterra Dec 14, 2018
97d47cf
Merge remote-tracking branch 'upstream/master' into ml-annotations
walterra Dec 14, 2018
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
10 changes: 10 additions & 0 deletions x-pack/plugins/ml/common/constants/annotations.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

export enum ANNOTATION_TYPE {
ANNOTATION = 'annotation',
COMMENT = 'comment',
}
14 changes: 14 additions & 0 deletions x-pack/plugins/ml/common/constants/feature_flags.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

// This flag is used on the server side as the default setting.
// Plugin initialization does some additional integrity checks and tests if the necessary
// indices and aliases exist. Based on that the final setting will be available
// as an injectedVar on the client side and can be accessed like:
//
// import chrome from 'ui/chrome';
// const mlAnnotationsEnabled = chrome.getInjected('mlAnnotationsEnabled', false);
export const FEATURE_ANNOTATIONS_ENABLED = true;
12 changes: 12 additions & 0 deletions x-pack/plugins/ml/common/constants/index_patterns.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

export const ML_ANNOTATIONS_INDEX_ALIAS_READ = '.ml-annotations-read';
export const ML_ANNOTATIONS_INDEX_ALIAS_WRITE = '.ml-annotations-write';
export const ML_ANNOTATIONS_INDEX_PATTERN = '.ml-annotations-6';

export const ML_RESULTS_INDEX_PATTERN = '.ml-anomalies-*';
export const ML_NOTIFICATION_INDEX_PATTERN = '.ml-notifications';
8 changes: 8 additions & 0 deletions x-pack/plugins/ml/common/constants/search.ts
Original file line number Diff line number Diff line change
@@ -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;
* you may not use this file except in compliance with the Elastic License.
*/

export const ANNOTATIONS_TABLE_DEFAULT_QUERY_SIZE = 500;
export const ANOMALIES_TABLE_DEFAULT_QUERY_SIZE = 500;
94 changes: 94 additions & 0 deletions x-pack/plugins/ml/common/types/annotations.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

// The Annotation interface is based on annotation documents stored in the
// `.ml-annotations-6` index, accessed via the `.ml-annotations-[read|write]` aliases.

// Annotation document mapping:
// PUT .ml-annotations-6
// {
// "mappings": {
// "annotation": {
// "properties": {
// "annotation": {
// "type": "text"
// },
// "create_time": {
// "type": "date",
// "format": "epoch_millis"
// },
// "create_username": {
// "type": "keyword"
// },
// "timestamp": {
// "type": "date",
// "format": "epoch_millis"
// },
// "end_timestamp": {
// "type": "date",
// "format": "epoch_millis"
// },
// "job_id": {
// "type": "keyword"
// },
// "modified_time": {
// "type": "date",
// "format": "epoch_millis"
// },
// "modified_username": {
// "type": "keyword"
// },
// "type": {
// "type": "keyword"
// }
// }
// }
// }
// }

// Alias
// POST /_aliases
// {
// "actions" : [
// { "add" : { "index" : ".ml-annotations-6", "alias" : ".ml-annotations-read" } },
// { "add" : { "index" : ".ml-annotations-6", "alias" : ".ml-annotations-write" } }
// ]
// }

import { ANNOTATION_TYPE } from '../constants/annotations';

export interface Annotation {
_id?: string;
create_time?: number;
create_username?: string;
modified_time?: number;
modified_username?: string;
key?: string;

timestamp: number;
end_timestamp?: number;
annotation: string;
job_id: string;
type: ANNOTATION_TYPE.ANNOTATION | ANNOTATION_TYPE.COMMENT;
}

export function isAnnotation(arg: any): arg is Annotation {
return (
arg.timestamp !== undefined &&
typeof arg.annotation === 'string' &&
typeof arg.job_id === 'string' &&
(arg.type === ANNOTATION_TYPE.ANNOTATION || arg.type === ANNOTATION_TYPE.COMMENT)
);
}

export interface Annotations extends Array<Annotation> {}

export function isAnnotations(arg: any): arg is Annotations {
if (Array.isArray(arg) === false) {
return false;
}
return arg.every((d: Annotation) => isAnnotation(d));
}
9 changes: 9 additions & 0 deletions x-pack/plugins/ml/common/types/common.ts
Original file line number Diff line number Diff line change
@@ -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;
* you may not use this file except in compliance with the Elastic License.
*/

export interface Dictionary<TValue> {
[id: string]: TValue;
}
53 changes: 53 additions & 0 deletions x-pack/plugins/ml/common/types/jobs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

// TS TODO: This is not yet a fully fledged representation of the job data structure,
// but it fulfills some basic TypeScript related needs.
export interface MlJob {
analysis_config: {
bucket_span: string;
detectors: object[];
influencers: string[];
};
analysis_limits: {
categorization_examples_limit: number;
model_memory_limit: string;
};
create_time: number;
custom_settings: object;
data_counts: object;
data_description: {
time_field: string;
time_format: string;
};
datafeed_config: object;
description: string;
established_model_memory: number;
finished_time: number;
job_id: string;
job_type: string;
job_version: string;
model_plot_config: object;
model_size_stats: object;
model_snapshot_id: string;
model_snapshot_min_version: string;
model_snapshot_retention_days: number;
results_index_name: string;
state: string;
}

export function isMlJob(arg: any): arg is MlJob {
return typeof arg.job_id === 'string';
}

export interface MlJobs extends Array<MlJob> {}

export function isMlJobs(arg: any): arg is MlJobs {
if (Array.isArray(arg) === false) {
return false;
}
return arg.every((d: MlJob) => isMlJob(d));
}
9 changes: 7 additions & 2 deletions x-pack/plugins/ml/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
import { resolve } from 'path';
import Boom from 'boom';
import { checkLicense } from './server/lib/check_license';
import { isAnnotationsFeatureAvailable } from './server/lib/check_annotations';
import { mirrorPluginStatus } from '../../server/lib/mirror_plugin_status';
import { annotationRoutes } from './server/routes/annotations';
import { jobRoutes } from './server/routes/anomaly_detectors';
import { dataFeedRoutes } from './server/routes/datafeeds';
import { indicesRoutes } from './server/routes/indices';
Expand Down Expand Up @@ -52,8 +54,7 @@ export const ml = (kibana) => {
},
},


init: function (server) {
init: async function (server) {
const thisPlugin = this;
const xpackMainPlugin = server.plugins.xpack_main;
mirrorPluginStatus(xpackMainPlugin, thisPlugin);
Expand All @@ -77,14 +78,18 @@ export const ml = (kibana) => {
]
};

const mlAnnotationsEnabled = await isAnnotationsFeatureAvailable(server);

server.injectUiAppVars('ml', () => {
const config = server.config();
return {
kbnIndex: config.get('kibana.index'),
esServerUrl: config.get('elasticsearch.url'),
mlAnnotationsEnabled,
};
});

annotationRoutes(server, commonRouteConfig);
jobRoutes(server, commonRouteConfig);
dataFeedRoutes(server, commonRouteConfig);
indicesRoutes(server, commonRouteConfig);
Expand Down
Loading