Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ML] Anomaly Explorer Rare/Population Charts #23423

Merged
merged 38 commits into from
Oct 5, 2018
Merged
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
f6fe839
[ML] Explorer charts container supports different chart types. Dummy …
walterra Sep 4, 2018
47cdce6
[ML] Initial working rare chart.
walterra Sep 4, 2018
12998c2
[ML] Working categorical event distribution chart
walterra Sep 4, 2018
9ef4b6b
[ML] Initial population distribution chart.
walterra Sep 4, 2018
23c53ca
[ML] Fixes rare chart styles. Implements dedicated split and filter f…
walterra Sep 17, 2018
a498ad3
[ML] Make sure rare chart shows selected entity.
walterra Sep 21, 2018
0cad955
[ML] Introduces sampling to rare context data. Limits rare chart to 3…
walterra Sep 22, 2018
df6aa4e
[ML] Use EUI flex grid instead of some bootstrap classes.
walterra Sep 24, 2018
89d0068
[ML] Fixes rebase regressions.
walterra Sep 28, 2018
829016e
[ML] Use EuiFlexGroup for Explorer Charts header.
walterra Oct 3, 2018
21df55b
[ML] Data transformation fixes for rare/population chart.
walterra Oct 3, 2018
de2a311
[ML] Consolidate chart type selection.
walterra Oct 3, 2018
832e21b
[ML] Support for chart type feature flags.
walterra Oct 3, 2018
fa02dff
[ML] Fix left margin for population chart.
walterra Oct 3, 2018
f4667fd
[ML] Fixes data transformation when population chart is disabled.
walterra Oct 3, 2018
3d7839e
[ML] Fixes scheduled event markers for population chart.
walterra Oct 3, 2018
651bc48
[ML] Unify chartdata filtering for markers and scheduled events.
walterra Oct 3, 2018
0625fcd
[ML] Chart info tooltips include a descriptive text for rare and popu…
walterra Oct 3, 2018
6f3895a
[ML] Fixes tests to reflect new structure.
walterra Oct 3, 2018
9d01070
[ML] Rename to distribution chart.
walterra Oct 3, 2018
db14c21
[ML] Add missing key attribute.
walterra Oct 3, 2018
378e99f
[ML] Include a check if there are any records.
walterra Oct 4, 2018
cb21e70
Merge remote-tracking branch 'upstream/master' into ml-explorer-rare-…
walterra Oct 4, 2018
3e4e37e
[ML] Add another check if record isn't undefined.
walterra Oct 4, 2018
9537d87
[ML] Fixes chart header flex layout overflows.
walterra Oct 4, 2018
0ac6237
[ML] Tweaks the chart info tooltip layout.
walterra Oct 4, 2018
45b38a4
[ML] Update jest snapshots.
walterra Oct 4, 2018
84d85a9
[ML] Show rare chart only if no over field is used in the detector fo…
walterra Oct 4, 2018
2f75c7f
[ML] Fixes expanding time span.
walterra Oct 4, 2018
a1acf52
[ML] Say 'rarer' instead of 'more rare'.
walterra Oct 4, 2018
e16f71b
[ML] Remove commented code.
walterra Oct 4, 2018
5f5ae7a
[ML] More strict check for marker.byFieldName.
walterra Oct 4, 2018
4e2b015
[ML] Show typical value in tooltips for anomalies with over but no by…
walterra Oct 4, 2018
2684e1f
[ML] consider numberOfCauses === 1.
walterra Oct 4, 2018
2f798a7
[ML] Fix rare chart tooltip info.
walterra Oct 4, 2018
001f328
[ML] Move entity value just below date above other info.
walterra Oct 5, 2018
901c1e3
[ML] Simplify JSX for entityFieldBadges.
walterra Oct 5, 2018
23cfe6f
[ML] Updated snapshots. Review feedback.
walterra Oct 5, 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
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Object {
"entityFields": Array [
Object {
"fieldName": "airline",
"fieldType": "partition",
"fieldValue": "JAL",
},
],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`ExplorerChartTooltip Render tooltip based on infoTooltip data. 1`] = `
<div
className="ml-explorer-chart-info-tooltip"
>
<TooltipDefinitionList
toolTipData={
Array [
Object {
"description": "mock-job-id",
"title": "job ID",
},
Object {
"description": "15m",
"title": "aggregation interval",
},
Object {
"description": "avg responsetime",
"title": "chart function",
},
Object {
"description": "JAL",
"title": "airline",
},
]
}
/>
</div>
`;

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

exports[`explorerChartsContainerService call anomalyChangeListener with actual series config 1`] = `
Object {
"layoutCellsPerChart": 12,
"seriesToPlot": Array [],
"timeFieldName": "timestamp",
"tooManyBuckets": false,
Expand All @@ -11,7 +10,7 @@ Object {

exports[`explorerChartsContainerService call anomalyChangeListener with actual series config 2`] = `
Object {
"layoutCellsPerChart": 12,
"chartsPerRow": 1,
"seriesToPlot": Array [
Object {
"bucketSpanSeconds": 900,
Expand Down Expand Up @@ -40,6 +39,7 @@ Object {
"entityFields": Array [
Object {
"fieldName": "airline",
"fieldType": "partition",
"fieldValue": "AAL",
},
],
Expand Down Expand Up @@ -71,7 +71,7 @@ Object {

exports[`explorerChartsContainerService call anomalyChangeListener with actual series config 3`] = `
Object {
"layoutCellsPerChart": 12,
"chartsPerRow": 1,
"seriesToPlot": Array [
Object {
"bucketSpanSeconds": 900,
Expand Down Expand Up @@ -582,6 +582,7 @@ Object {
"entityFields": Array [
Object {
"fieldName": "airline",
"fieldType": "partition",
"fieldValue": "AAL",
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@ exports[`ExplorerChartLabelBadge Render the chart label in one line. 1`] = `
}
}
/>

</React.Fragment>

<span
className="ml-explorer-chart-info-icon"
>
<EuiIconTip
aria-label="Info"
className="ml-explorer-chart-eui-icon-tip"
content={
<ExplorerChartTooltip
<ExplorerChartInfoTooltip
aggregationInterval="1h"
chartFunction="sum nginx.access.body_sent.bytes"
entityFields={
Expand Down Expand Up @@ -77,8 +77,9 @@ exports[`ExplorerChartLabelBadge Render the chart label in two lines. 1`] = `
>
<EuiIconTip
aria-label="Info"
className="ml-explorer-chart-eui-icon-tip"
content={
<ExplorerChartTooltip
<ExplorerChartInfoTooltip
aggregationInterval="1h"
chartFunction="sum nginx.access.body_sent.bytes"
entityFields={
Expand All @@ -98,8 +99,8 @@ exports[`ExplorerChartLabelBadge Render the chart label in two lines. 1`] = `
/>
</span>
</span>
<div
className="ml-explorer-chart-label-fields"
<span
className="ml-explorer-chart-label-badges"
>
<React.Fragment
key="nginx.access.remote_ip 72.57.0.53"
Expand All @@ -113,8 +114,7 @@ exports[`ExplorerChartLabelBadge Render the chart label in two lines. 1`] = `
}
}
/>

</React.Fragment>
</div>
</span>
</React.Fragment>
`;
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ exports[`ExplorerChartLabelBadge Render entity label badge. 1`] = `
className="ml-explorer-chart-label-badge"
>
<EuiBadge
className="ml-reset-font-weight"
color="hollow"
iconSide="left"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
} from '@elastic/eui';

import { ExplorerChartLabelBadge } from './explorer_chart_label_badge';
import { ExplorerChartTooltip } from '../../explorer_chart_tooltip';
import { ExplorerChartInfoTooltip } from '../../explorer_chart_info_tooltip';

export function ExplorerChartLabel({ detectorLabel, entityFields, infoTooltip, wrapLabel = false }) {
// Depending on whether we wrap the entityField badges to a new line, we render this differently:
Expand All @@ -35,15 +35,16 @@ export function ExplorerChartLabel({ detectorLabel, entityFields, infoTooltip, w
const entityFieldBadges = entityFields.map((entity) => {
return (
walterra marked this conversation as resolved.
Show resolved Hide resolved
<React.Fragment key={`${entity.fieldName} ${entity.fieldValue}`}>
<ExplorerChartLabelBadge entity={entity} />&nbsp;
<ExplorerChartLabelBadge entity={entity} />
</React.Fragment>
);
});

const infoIcon = (
<span className="ml-explorer-chart-info-icon">
<EuiIconTip
content={<ExplorerChartTooltip {...infoTooltip} />}
className="ml-explorer-chart-eui-icon-tip"
content={<ExplorerChartInfoTooltip {...infoTooltip} />}
position="top"
size="s"
/>
Expand All @@ -62,7 +63,7 @@ export function ExplorerChartLabel({ detectorLabel, entityFields, infoTooltip, w
)}
</span>
{wrapLabel && (
<div className="ml-explorer-chart-label-fields">{entityFieldBadges}</div>
<span className="ml-explorer-chart-label-badges">{entityFieldBadges}</span>
)}
</React.Fragment>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
export function ExplorerChartLabelBadge({ entity }) {
return (
<span className="ml-explorer-chart-label-badge">
<EuiBadge color="hollow">
<EuiBadge color="hollow" className="ml-reset-font-weight">
{entity.fieldName} <strong>{entity.fieldValue}</strong>
</EuiBadge>
</span>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,33 +1,9 @@
.ml-explorer-chart-label {
font-weight: normal;
/* account 80px for the "View" link and potential alert icon */
max-width: calc(~"100% - 80px");
overflow: hidden;
.ml-explorer-chart-eui-icon-tip {
max-width: none;
}

.ml-explorer-chart-label-detector {
vertical-align: middle;
/* account 100px for the "View" link and info icon */
max-width: calc(~"100% - 100px");
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
display: inline-block;
}

.ml-explorer-chart-info-icon {
margin: 0;
vertical-align: middle;
display: inline-block;
}

/* only used when the field badges get wrapped to a new line */
.ml-explorer-chart-label-fields {
width: 100%;
/* use a fixed height to avoid layout issues when
only some charts don't have entity fields */
height: 22px;
overflow: hidden;
white-space: nowrap;
line-height: 0;
.ml-explorer-chart-label-badges {
margin-top: 3px;
/* let this overflow but not interfere with the flex layout */
width: 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
Used in the Explorer Chart label badge to display an entity's
field_name as `normal` and field_value as `strong`.
*/
.ml-explorer-chart-label-badge {
.ml-reset-font-weight {
font-weight: normal;
vertical-align: middle;
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,16 @@ export function buildConfig(record) {
if (_.has(record, 'partition_field_name')) {
config.entityFields.push({
fieldName: record.partition_field_name,
fieldValue: record.partition_field_value
fieldValue: record.partition_field_value,
fieldType: 'partition'
});
}

if (_.has(record, 'over_field_name')) {
config.entityFields.push({
fieldName: record.over_field_name,
fieldValue: record.over_field_value
fieldValue: record.over_field_value,
fieldType: 'over'
});
}

Expand All @@ -68,7 +70,8 @@ export function buildConfig(record) {
if (_.has(record, 'by_field_name') && !(_.has(record, 'over_field_name'))) {
config.entityFields.push({
fieldName: record.by_field_name,
fieldValue: record.by_field_value
fieldValue: record.by_field_value,
fieldType: 'by'
});
}

Expand Down
Loading