-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[Logs and Metrics UI] Initial setup for registering observability overview data fetchers #69999
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
Changes from all commits
a59fbef
98e205f
ef9bcc6
29cf062
8abdf6c
3cac145
d14e518
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,7 +12,7 @@ import { | |
| KibanaContextProvider, | ||
| } from '../../../../../src/plugins/kibana_react/public'; | ||
| import { TriggersActionsProvider } from '../utils/triggers_actions_context'; | ||
| import { ClientPluginDeps } from '../types'; | ||
|
||
| import { InfraClientStartDeps } from '../types'; | ||
| import { TriggersAndActionsUIPublicPluginStart } from '../../../triggers_actions_ui/public'; | ||
| import { ApolloClientContext } from '../utils/apollo_context'; | ||
| import { EuiThemeProvider } from '../../../observability/public'; | ||
|
|
@@ -37,7 +37,7 @@ export const CommonInfraProviders: React.FC<{ | |
|
|
||
| export const CoreProviders: React.FC<{ | ||
| core: CoreStart; | ||
| plugins: ClientPluginDeps; | ||
| plugins: InfraClientStartDeps; | ||
| }> = ({ children, core, plugins }) => { | ||
| return ( | ||
| <KibanaContextProvider services={{ ...core, ...plugins }}> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,14 +5,19 @@ | |
| */ | ||
|
|
||
| import { PluginInitializer, PluginInitializerContext } from 'kibana/public'; | ||
| import { ClientSetup, ClientStart, Plugin } from './plugin'; | ||
| import { ClientPluginsSetup, ClientPluginsStart } from './types'; | ||
| import { Plugin } from './plugin'; | ||
| import { | ||
| InfraClientSetupExports, | ||
| InfraClientStartExports, | ||
| InfraClientSetupDeps, | ||
| InfraClientStartDeps, | ||
| } from './types'; | ||
|
||
|
|
||
| export const plugin: PluginInitializer< | ||
| ClientSetup, | ||
| ClientStart, | ||
| ClientPluginsSetup, | ||
| ClientPluginsStart | ||
| InfraClientSetupExports, | ||
| InfraClientStartExports, | ||
| InfraClientSetupDeps, | ||
| InfraClientStartDeps | ||
| > = (context: PluginInitializerContext) => { | ||
| return new Plugin(context); | ||
| }; | ||
|
|
||
| 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']) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @cauemarcondes I understand this function is a requirement for the dashboard. Is it a hard requirement? I can imagine that the reason to have it is to not perform a potentially expensive query to fetch the data if there's no data to fetch. if that's the case, how expensive would it be to call the data fetching function when there's no data at all, versus calling two functions every time?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @afgomez, the idea behind the We could, of course, call the Also |
||
| 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? | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i think for the sake of simplicity observability plugin should handle the relative part while generating link. |
||
| 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 | ||
jasonrhodes marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| 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 }, | ||
| ], | ||
| }, | ||
| }, | ||
| }; | ||
| }; | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is here because I missed exporting it when I updated the UsageCollection plugin start contract here: #69836