-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Logs UI] Reorganise log rate anomaly table (#69516)
* Remove top level chart Remove top level anomalies chart * Refactor table columns to accomodate new formatting * Tyical vs actual stats in expanded row * Format message based on actual vs typical * Start fleshing out log rate examples endpoint and lib methods * Use the real document ID for expanded rows so React doesn't re-render content * Add all data fetching resources for log entry rate examples * Move log entry example and severity indicator components to a shared location * Render examples for log rate * Add severity indicator * Styling tweaks * Move horizontal button popover menu to a shared components so log rate table can use it * Revert "Move horizontal button popover menu to a shared components so log rate table can use it" This reverts commit f80db59. * Add "view in stream" and "view in anomaly explorer" links * Hook links into the new context menu component * Add log column headers and add styling tweaks etc * Fix translations * Tweak comments * Chart tweaks * Update x-pack/plugins/infra/public/pages/logs/log_entry_rate/sections/anomalies/expanded_row.tsx Co-authored-by: Felix Stürmer <[email protected]> * PR amendments - Pass href to context menu items - Fix start and end times used for example logs - Use "fewer" rather than "less" * Update x-pack/plugins/infra/public/pages/logs/log_entry_rate/sections/anomalies/table.tsx Co-authored-by: Felix Stürmer <[email protected]> * Update x-pack/plugins/infra/public/pages/logs/log_entry_rate/sections/anomalies/log_entry_example.tsx Co-authored-by: Felix Stürmer <[email protected]> * Update x-pack/plugins/infra/public/pages/logs/log_entry_rate/sections/anomalies/log_entry_example.tsx Co-authored-by: Felix Stürmer <[email protected]> * Update x-pack/plugins/infra/public/pages/logs/log_entry_rate/sections/anomalies/table.tsx Co-authored-by: Felix Stürmer <[email protected]> * Update x-pack/plugins/infra/server/routes/log_analysis/results/log_entry_rate_examples.ts Co-authored-by: Felix Stürmer <[email protected]> * Update x-pack/plugins/infra/server/routes/log_analysis/results/log_entry_rate_examples.ts Co-authored-by: Felix Stürmer <[email protected]> * Update x-pack/plugins/infra/server/routes/log_analysis/results/log_entry_rate_examples.ts Co-authored-by: Felix Stürmer <[email protected]> * Update x-pack/plugins/infra/server/routes/log_analysis/results/log_entry_rate_examples.ts Co-authored-by: Felix Stürmer <[email protected]> * PR amendments - Fix typechecking - Add an empty log example column header to account for the context menu - Add anomaly start time to rows Co-authored-by: Felix Stürmer <[email protected]>
- Loading branch information
1 parent
97ca7bf
commit 7ec48fd
Showing
28 changed files
with
1,177 additions
and
257 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
x-pack/plugins/infra/common/http_api/log_analysis/results/log_entry_rate_examples.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
import * as rt from 'io-ts'; | ||
|
||
import { | ||
badRequestErrorRT, | ||
forbiddenErrorRT, | ||
timeRangeRT, | ||
routeTimingMetadataRT, | ||
} from '../../shared'; | ||
|
||
export const LOG_ANALYSIS_GET_LOG_ENTRY_RATE_EXAMPLES_PATH = | ||
'/api/infra/log_analysis/results/log_entry_rate_examples'; | ||
|
||
/** | ||
* request | ||
*/ | ||
|
||
export const getLogEntryRateExamplesRequestPayloadRT = rt.type({ | ||
data: rt.type({ | ||
// the dataset to fetch the log rate examples from | ||
dataset: rt.string, | ||
// the number of examples to fetch | ||
exampleCount: rt.number, | ||
// the id of the source configuration | ||
sourceId: rt.string, | ||
// the time range to fetch the log rate examples from | ||
timeRange: timeRangeRT, | ||
}), | ||
}); | ||
|
||
export type GetLogEntryRateExamplesRequestPayload = rt.TypeOf< | ||
typeof getLogEntryRateExamplesRequestPayloadRT | ||
>; | ||
|
||
/** | ||
* response | ||
*/ | ||
|
||
const logEntryRateExampleRT = rt.type({ | ||
id: rt.string, | ||
dataset: rt.string, | ||
message: rt.string, | ||
timestamp: rt.number, | ||
tiebreaker: rt.number, | ||
}); | ||
|
||
export type LogEntryRateExample = rt.TypeOf<typeof logEntryRateExampleRT>; | ||
|
||
export const getLogEntryRateExamplesSuccessReponsePayloadRT = rt.intersection([ | ||
rt.type({ | ||
data: rt.type({ | ||
examples: rt.array(logEntryRateExampleRT), | ||
}), | ||
}), | ||
rt.partial({ | ||
timing: routeTimingMetadataRT, | ||
}), | ||
]); | ||
|
||
export type GetLogEntryRateExamplesSuccessReponsePayload = rt.TypeOf< | ||
typeof getLogEntryRateExamplesSuccessReponsePayloadRT | ||
>; | ||
|
||
export const getLogEntryRateExamplesResponsePayloadRT = rt.union([ | ||
getLogEntryRateExamplesSuccessReponsePayloadRT, | ||
badRequestErrorRT, | ||
forbiddenErrorRT, | ||
]); | ||
|
||
export type GetLogEntryRateExamplesResponsePayload = rt.TypeOf< | ||
typeof getLogEntryRateExamplesResponsePayloadRT | ||
>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
x-pack/plugins/infra/public/components/logging/log_entry_examples/log_entry_examples.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
import React from 'react'; | ||
|
||
import { euiStyled } from '../../../../../observability/public'; | ||
import { LogEntryExampleMessagesEmptyIndicator } from './log_entry_examples_empty_indicator'; | ||
import { LogEntryExampleMessagesFailureIndicator } from './log_entry_examples_failure_indicator'; | ||
import { LogEntryExampleMessagesLoadingIndicator } from './log_entry_examples_loading_indicator'; | ||
|
||
interface Props { | ||
isLoading: boolean; | ||
hasFailedLoading: boolean; | ||
hasResults: boolean; | ||
exampleCount: number; | ||
onReload: () => void; | ||
} | ||
export const LogEntryExampleMessages: React.FunctionComponent<Props> = ({ | ||
isLoading, | ||
hasFailedLoading, | ||
exampleCount, | ||
hasResults, | ||
onReload, | ||
children, | ||
}) => { | ||
return ( | ||
<Wrapper> | ||
{isLoading ? ( | ||
<LogEntryExampleMessagesLoadingIndicator exampleCount={exampleCount} /> | ||
) : hasFailedLoading ? ( | ||
<LogEntryExampleMessagesFailureIndicator onRetry={onReload} /> | ||
) : !hasResults ? ( | ||
<LogEntryExampleMessagesEmptyIndicator onReload={onReload} /> | ||
) : ( | ||
children | ||
)} | ||
</Wrapper> | ||
); | ||
}; | ||
|
||
const Wrapper = euiStyled.div` | ||
align-items: stretch; | ||
flex-direction: column; | ||
flex: 1 0 0%; | ||
overflow: hidden; | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.