-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Logs and Metrics UI] Initial setup for registering observability ove…
…rview data fetchers (#69999) * Switches mount callbacks to only use start deps Fixes #58014 * Sets up skeleton logs data fetchers for overview * Fixes type hacks for logs fetcher * Prevent kibana from crashing on initial load * Fixes types and linting errors * Fixes some linting import/export issues Co-authored-by: Alejandro Fernández Gómez <[email protected]>
- Loading branch information
1 parent
2118439
commit bb7bc78
Showing
16 changed files
with
201 additions
and
90 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
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
93 changes: 93 additions & 0 deletions
93
x-pack/plugins/infra/public/utils/logs_overview_fetchers.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,93 @@ | ||
/* | ||
* 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 { InfraClientCoreSetup } from '../types'; | ||
import { LogsFetchDataResponse } from '../../../observability/public'; | ||
|
||
export function getLogsHasDataFetcher(getStartServices: InfraClientCoreSetup['getStartServices']) { | ||
return async () => { | ||
// if you need the data plugin, this is how you get it | ||
// const [, startPlugins] = await getStartServices(); | ||
// const { data } = startPlugins; | ||
|
||
// if you need a core dep, we need to pass in more than just getStartServices | ||
|
||
// perform query | ||
return true; | ||
}; | ||
} | ||
|
||
export function getLogsOverviewDataFetcher( | ||
getStartServices: InfraClientCoreSetup['getStartServices'] | ||
) { | ||
return async (): Promise<LogsFetchDataResponse> => { | ||
// if you need the data plugin, this is how you get it | ||
// const [, startPlugins] = await getStartServices(); | ||
// const { data } = startPlugins; | ||
|
||
// if you need a core dep, we need to pass in more than just getStartServices | ||
|
||
// perform query | ||
return { | ||
title: 'Log rate', | ||
appLink: 'TBD', // TODO: what format should this be in, relative I assume? | ||
stats: { | ||
nginx: { | ||
type: 'number', | ||
label: 'nginx', | ||
value: 345341, | ||
}, | ||
'elasticsearch.audit': { | ||
type: 'number', | ||
label: 'elasticsearch.audit', | ||
value: 164929, | ||
}, | ||
'haproxy.log': { | ||
type: 'number', | ||
label: 'haproxy.log', | ||
value: 51101, | ||
}, | ||
}, | ||
// Note: My understanding is that these series coordinates will be | ||
// combined into objects that look like: | ||
// { x: timestamp, y: value, g: label (e.g. nginx) } | ||
// so they fit the stacked bar chart API | ||
// https://elastic.github.io/elastic-charts/?path=/story/bar-chart--stacked-with-axis-and-legend | ||
series: { | ||
nginx: { | ||
label: 'nginx', | ||
coordinates: [ | ||
{ x: 1593000000000, y: 10014 }, | ||
{ x: 1593000900000, y: 12827 }, | ||
{ x: 1593001800000, y: 2946 }, | ||
{ x: 1593002700000, y: 14298 }, | ||
{ x: 1593003600000, y: 4096 }, | ||
], | ||
}, | ||
'elasticsearch.audit': { | ||
label: 'elasticsearch.audit', | ||
coordinates: [ | ||
{ x: 1593000000000, y: 5676 }, | ||
{ x: 1593000900000, y: 6783 }, | ||
{ x: 1593001800000, y: 2394 }, | ||
{ x: 1593002700000, y: 4554 }, | ||
{ x: 1593003600000, y: 5659 }, | ||
], | ||
}, | ||
'haproxy.log': { | ||
label: 'haproxy.log', | ||
coordinates: [ | ||
{ x: 1593000000000, y: 9085 }, | ||
{ x: 1593000900000, y: 9002 }, | ||
{ x: 1593001800000, y: 3940 }, | ||
{ x: 1593002700000, y: 5451 }, | ||
{ x: 1593003600000, y: 9133 }, | ||
], | ||
}, | ||
}, | ||
}; | ||
}; | ||
} |
Oops, something went wrong.