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

[Metrics UI] Alerting for metrics explorer and inventory #58779

Merged
merged 46 commits into from
Mar 23, 2020
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
4f5b456
Add flyout with expressions
phillipb Feb 25, 2020
6560cb1
Merge branch 'master' of https://github.com/elastic/kibana into metri…
phillipb Feb 25, 2020
22801ad
Merge branch 'master' of https://github.com/elastic/kibana into metri…
phillipb Feb 27, 2020
f0d8b61
Integrate frontend with backend
phillipb Feb 27, 2020
7adff95
Merge branch 'master' of https://github.com/elastic/kibana into metri…
phillipb Mar 2, 2020
b796ada
Extended AlertContextValue with metadata optional property
YulNaumenko Mar 5, 2020
a67cec8
Merge commit 'refs/pull/59391/head' of https://github.com/elastic/kib…
phillipb Mar 5, 2020
8c62cf9
Progress
phillipb Mar 9, 2020
a4f5934
Merge branch 'master' of https://github.com/elastic/kibana into metri…
phillipb Mar 9, 2020
68fd03b
Pre-fill criteria with current page filters
phillipb Mar 9, 2020
6d5a49c
Better validation. Naming for clarity
phillipb Mar 10, 2020
f8837a1
Merge branch 'master' of https://github.com/elastic/kibana into metri…
phillipb Mar 10, 2020
e621432
Fix types for flyout
phillipb Mar 10, 2020
7956d6d
Respect the groupby property in metric explorer
phillipb Mar 11, 2020
af3335c
Fix lint errors
phillipb Mar 11, 2020
f93bec3
Merge branch 'master' of https://github.com/elastic/kibana into metri…
phillipb Mar 11, 2020
7dc0df9
Fix text, add toast notifications
phillipb Mar 12, 2020
2a8b1fb
Fix tests. Make sure update handles predefined expressions
phillipb Mar 16, 2020
6390892
Merge branch 'master' into metrics-alerting
elasticmachine Mar 16, 2020
542d766
Dynamically load source from alert flyout
phillipb Mar 16, 2020
ce2a19c
Merge branch 'metrics-alerting' of github.com:phillipb/kibana into me…
phillipb Mar 16, 2020
e3f3669
Remove unused import
phillipb Mar 16, 2020
552a9bd
Simplify and add group by functionality
phillipb Mar 17, 2020
4c8fa98
Merge branch 'master' of https://github.com/elastic/kibana into metri…
phillipb Mar 17, 2020
d6fe2c1
Remove unecessary useEffect
phillipb Mar 17, 2020
6c5eb6c
disable exhastive deps
phillipb Mar 17, 2020
f8dcd08
Remove unecessary useEffect
phillipb Mar 17, 2020
00a3d34
merge
Mar 17, 2020
0d694c4
change language
Mar 17, 2020
f75d157
Implement design feedback
phillipb Mar 17, 2020
8befaaa
Add alert dropdown to the header and snapshot screen
phillipb Mar 17, 2020
f810254
Remove icon
phillipb Mar 17, 2020
ba0588f
Remove unused props. Code cleanup
phillipb Mar 17, 2020
7cb2e02
Remove unused values
phillipb Mar 18, 2020
be35ac2
Merge branch 'master' of https://github.com/elastic/kibana into metri…
phillipb Mar 18, 2020
5b0b238
Fix formatted message id
phillipb Mar 18, 2020
15d02fa
Merge branch 'master' of https://github.com/elastic/kibana into metri…
phillipb Mar 18, 2020
eab78ca
Merge branch 'master' of https://github.com/elastic/kibana into metri…
phillipb Mar 18, 2020
99c81e2
Remove create alert option for now.
phillipb Mar 18, 2020
70abcc0
Fix type issue
phillipb Mar 18, 2020
1909307
Merge branch 'master' into metrics-alerting
elasticmachine Mar 19, 2020
8c69617
Add rate, card and count as aggs
phillipb Mar 19, 2020
32eac0a
Merge branch 'metrics-alerting' of github.com:phillipb/kibana into me…
phillipb Mar 19, 2020
38c3472
Merge branch 'master' of https://github.com/elastic/kibana into metri…
phillipb Mar 19, 2020
8b17d04
Merge branch 'master' of https://github.com/elastic/kibana into metri…
phillipb Mar 23, 2020
68b8a27
Fix types
phillipb Mar 23, 2020
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
3 changes: 2 additions & 1 deletion x-pack/plugins/infra/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"data",
"dataEnhanced",
"metrics",
"alerting"
"alerting",
"triggers_actions_ui"
],
"server": true,
"ui": true,
Expand Down
36 changes: 21 additions & 15 deletions x-pack/plugins/infra/public/apps/start_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import { CoreStart, AppMountParameters } from 'kibana/public';

// TODO use theme provided from parentApp when kibana supports it
import { EuiErrorBoundary } from '@elastic/eui';
import { EuiThemeProvider } from '../../../observability/public';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { EuiThemeProvider } from '../../../observability/public/typings/eui_styled_components';
import { InfraFrontendLibs } from '../lib/lib';
import { createStore } from '../store';
import { ApolloClientContext } from '../utils/apollo_context';
Expand All @@ -26,6 +27,8 @@ import {
KibanaContextProvider,
} from '../../../../../src/plugins/kibana_react/public';
import { AppRouter } from '../routers';
import { TriggersAndActionsUIPublicPluginSetup } from '../../../triggers_actions_ui/public';
import { TriggersActionsProvider } from '../utils/triggers_actions_context';
import '../index.scss';

export const CONTAINER_CLASSNAME = 'infra-container-element';
Expand All @@ -35,7 +38,8 @@ export async function startApp(
core: CoreStart,
plugins: object,
params: AppMountParameters,
Router: AppRouter
Router: AppRouter,
triggersActionsUI: TriggersAndActionsUIPublicPluginSetup
) {
const { element, appBasePath } = params;
const history = createBrowserHistory({ basename: appBasePath });
Expand All @@ -51,19 +55,21 @@ export async function startApp(
return (
<core.i18n.Context>
<EuiErrorBoundary>
<ReduxStoreProvider store={store}>
<ReduxStateContextProvider>
<ApolloProvider client={libs.apolloClient}>
<ApolloClientContext.Provider value={libs.apolloClient}>
<EuiThemeProvider darkMode={darkMode}>
<HistoryContext.Provider value={history}>
<Router history={history} />
</HistoryContext.Provider>
</EuiThemeProvider>
</ApolloClientContext.Provider>
</ApolloProvider>
</ReduxStateContextProvider>
</ReduxStoreProvider>
<TriggersActionsProvider triggersActionsUI={triggersActionsUI}>
<ReduxStoreProvider store={store}>
<ReduxStateContextProvider>
<ApolloProvider client={libs.apolloClient}>
<ApolloClientContext.Provider value={libs.apolloClient}>
<EuiThemeProvider darkMode={darkMode}>
<HistoryContext.Provider value={history}>
<Router history={history} />
</HistoryContext.Provider>
</EuiThemeProvider>
</ApolloClientContext.Provider>
</ApolloProvider>
</ReduxStateContextProvider>
</ReduxStoreProvider>
</TriggersActionsProvider>
</EuiErrorBoundary>
</core.i18n.Context>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* 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, { useContext } from 'react';
import { IIndexPattern } from 'src/plugins/data/public';
import { AlertsContextProvider, AlertAdd } from '../../../../../triggers_actions_ui/public';
import { TriggerActionsContext } from '../../../utils/triggers_actions_context';
import { useKibana } from '../../../../../../../src/plugins/kibana_react/public';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { METRIC_THRESHOLD_ALERT_TYPE_ID } from '../../../../server/lib/alerting/metric_threshold/types';
import { SourceConfiguration } from '../../../utils/source_configuration';
import { MetricsExplorerOptions } from '../../../containers/metrics_explorer/use_metrics_explorer_options';
import { MetricsExplorerSeries } from '../../../../common/http_api/metrics_explorer';

interface Props {
visible?: boolean;
options: MetricsExplorerOptions;
derivedIndexPattern: IIndexPattern;
series: MetricsExplorerSeries;
source?: SourceConfiguration;
setVisible: React.Dispatch<React.SetStateAction<boolean>>;
}

export const AlertFlyout = (props: Props) => {
const { triggersActionsUI } = useContext(TriggerActionsContext);
const { services } = useKibana();

return (
<>
{triggersActionsUI && (
<AlertsContextProvider
value={{
metadata: {
source: props.source,
derivedIndexPattern: props.derivedIndexPattern,
currentOptions: props.options,
series: props.series,
},
http: services.http,
actionTypeRegistry: triggersActionsUI.actionTypeRegistry,
alertTypeRegistry: triggersActionsUI.alertTypeRegistry,
}}
>
<AlertAdd
addFlyoutVisible={props.visible!}
setAddFlyoutVisibility={props.setVisible}
alertTypeId={METRIC_THRESHOLD_ALERT_TYPE_ID}
canChangeTrigger={false}
consumer={'metrics'}
/>
</AlertsContextProvider>
)}
</>
);
};
Loading