Skip to content

Commit

Permalink
[ML] [AIOps] Log Rate Analysis: Show top N results when no docs in ba…
Browse files Browse the repository at this point in the history
…seline or deviation. (#171924)

This PR adds a fallback analysis when either the baseline or deviation
time range contains no documents. Instead of trying to fetch significant
items (which would return no results), this will just fetch the top
terms/categories for the time range that has some documents.
  • Loading branch information
walterra committed Nov 29, 2023
1 parent 0796976 commit bbf95b0
Show file tree
Hide file tree
Showing 43 changed files with 2,967 additions and 480 deletions.
142 changes: 142 additions & 0 deletions x-pack/plugins/aiops/common/__mocks__/artificial_logs/top_terms.ts
@@ -0,0 +1,142 @@
/*
* 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 { SignificantItem } from '@kbn/ml-agg-utils';

// Named topTerms since all these items are of type `keyword`.
export const topTerms: SignificantItem[] = [
{
bg_count: 0,
doc_count: 5102,
fieldName: 'version',
fieldValue: 'v1.0.0',
key: 'version:v1.0.0',
normalizedScore: 0,
pValue: 1,
score: 0,
total_bg_count: 0,
total_doc_count: 0,
type: 'keyword',
},
{
bg_count: 0,
doc_count: 2272,
fieldName: 'response_code',
fieldValue: '500',
key: 'response_code:500',
normalizedScore: 0,
pValue: 1,
score: 0,
total_bg_count: 0,
total_doc_count: 0,
type: 'keyword',
},
{
bg_count: 0,
doc_count: 2197,
fieldName: 'url',
fieldValue: 'home.php',
key: 'url:home.php',
normalizedScore: 0,
pValue: 1,
score: 0,
total_bg_count: 0,
total_doc_count: 0,
type: 'keyword',
},
{
bg_count: 0,
doc_count: 1981,
fieldName: 'user',
fieldValue: 'Peter',
key: 'user:Peter',
normalizedScore: 0,
pValue: 1,
score: 0,
total_bg_count: 0,
total_doc_count: 0,
type: 'keyword',
},
{
bg_count: 0,
doc_count: 1773,
fieldName: 'user',
fieldValue: 'Paul',
key: 'user:Paul',
normalizedScore: 0,
pValue: 1,
score: 0,
total_bg_count: 0,
total_doc_count: 0,
type: 'keyword',
},
{
bg_count: 0,
doc_count: 1574,
fieldName: 'url',
fieldValue: 'login.php',
key: 'url:login.php',
normalizedScore: 0,
pValue: 1,
score: 0,
total_bg_count: 0,
total_doc_count: 0,
type: 'keyword',
},
{
bg_count: 0,
doc_count: 1569,
fieldName: 'response_code',
fieldValue: '404',
key: 'response_code:404',
normalizedScore: 0,
pValue: 1,
score: 0,
total_bg_count: 0,
total_doc_count: 0,
type: 'keyword',
},
{
bg_count: 0,
doc_count: 1348,
fieldName: 'user',
fieldValue: 'Mary',
key: 'user:Mary',
normalizedScore: 0,
pValue: 1,
score: 0,
total_bg_count: 0,
total_doc_count: 0,
type: 'keyword',
},
{
bg_count: 0,
doc_count: 1331,
fieldName: 'url',
fieldValue: 'user.php',
key: 'url:user.php',
normalizedScore: 0,
pValue: 1,
score: 0,
total_bg_count: 0,
total_doc_count: 0,
type: 'keyword',
},
{
bg_count: 0,
doc_count: 1261,
fieldName: 'response_code',
fieldValue: '200',
key: 'response_code:200',
normalizedScore: 0,
pValue: 1,
score: 0,
total_bg_count: 0,
total_doc_count: 0,
type: 'keyword',
},
];

0 comments on commit bbf95b0

Please sign in to comment.