-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Monitoring] Thread pool rejections alert #79433
Merged
igoristic
merged 20 commits into
elastic:master
from
igoristic:threadpool_rejection_alert
Oct 30, 2020
+1,149
−395
Merged
Changes from 15 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
e976a69
Thread pool rejections first draft
igoristic db3a723
Merge branch 'master' of https://github.com/elastic/kibana into threa…
igoristic fea1ee8
Merge branch 'master' of https://github.com/elastic/kibana into threa…
igoristic 71aa34d
Merge branch 'master' of https://github.com/elastic/kibana into threa…
igoristic 1a0156d
Merge branch 'master' of https://github.com/elastic/kibana into threa…
igoristic 6908f61
Merge branch 'master' of https://github.com/elastic/kibana into threa…
igoristic a666da5
Split search and write rejections to seperate alerts
igoristic cafa0da
Merge branch 'master' of https://github.com/elastic/kibana into threa…
igoristic 17b4134
Code review feedback
igoristic acb2162
Merge branch 'master' into threadpool_rejection_alert
kibanamachine eeb6b35
Merge branch 'master' into threadpool_rejection_alert
kibanamachine 36f80f0
Merge branch 'master' of https://github.com/elastic/kibana into threa…
igoristic ffd436d
Merge branch 'master' of https://github.com/elastic/kibana into threa…
igoristic 22c8a6d
Optimized page loading and bundle size
igoristic 69aae85
Increased monitoring bundle limit
igoristic ddcd9d2
Merge branch 'master' of https://github.com/elastic/kibana into threa…
igoristic 617cb32
Merge branch 'master' of https://github.com/elastic/kibana into threa…
igoristic 066a5f4
Removed server app import into the frontend
igoristic 7d2a33d
Fixed tests and bundle size
igoristic a8772dd
Merge branch 'master' of https://github.com/elastic/kibana into threa…
igoristic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
36 changes: 36 additions & 0 deletions
36
x-pack/plugins/monitoring/public/alerts/flyout_expressions/alert_param_number.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,36 @@ | ||
/* | ||
* 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, { useState } from 'react'; | ||
import { EuiFormRow, EuiFieldNumber } from '@elastic/eui'; | ||
|
||
interface Props { | ||
name: string; | ||
value: number; | ||
label: string; | ||
errors: string[]; | ||
setAlertParams: (property: string, value: number) => void; | ||
} | ||
export const AlertParamNumber: React.FC<Props> = (props: Props) => { | ||
const { name, label, setAlertParams, errors } = props; | ||
const [value, setValue] = useState(props.value); | ||
return ( | ||
<EuiFormRow label={label} error={errors} isInvalid={errors?.length > 0}> | ||
<EuiFieldNumber | ||
compressed | ||
value={value} | ||
onChange={(e) => { | ||
let newValue = Number(e.target.value); | ||
if (isNaN(newValue)) { | ||
newValue = 0; | ||
} | ||
setValue(newValue); | ||
setAlertParams(name, newValue); | ||
}} | ||
/> | ||
</EuiFormRow> | ||
); | ||
}; |
60 changes: 60 additions & 0 deletions
60
x-pack/plugins/monitoring/public/alerts/thread_pool_rejections_alert/index.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,60 @@ | ||
/* | ||
* 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 { i18n } from '@kbn/i18n'; | ||
import { EuiSpacer } from '@elastic/eui'; | ||
import { Expression, Props } from '../components/duration/expression'; | ||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths | ||
import { AlertTypeModel } from '../../../../triggers_actions_ui/public/types'; | ||
import { CommonAlertParamDetails } from '../../../common/types'; | ||
|
||
interface ThreadPoolTypes { | ||
[key: string]: unknown; | ||
} | ||
|
||
interface ThreadPoolRejectionAlertClass { | ||
TYPE: string; | ||
LABEL: string; | ||
PARAM_DETAILS: CommonAlertParamDetails; | ||
} | ||
|
||
export function createThreadPoolRejectionsAlertType( | ||
threadPoolAlertClass: ThreadPoolRejectionAlertClass | ||
): AlertTypeModel { | ||
return { | ||
id: threadPoolAlertClass.TYPE, | ||
name: threadPoolAlertClass.LABEL, | ||
iconClass: 'bell', | ||
alertParamsExpression: (props: Props) => ( | ||
<> | ||
<EuiSpacer /> | ||
<Expression {...props} paramDetails={threadPoolAlertClass.PARAM_DETAILS} /> | ||
</> | ||
), | ||
validate: (inputValues: ThreadPoolTypes) => { | ||
const errors: { [key: string]: string[] } = {}; | ||
const value = inputValues.threshold as number; | ||
if (value < 0) { | ||
const errStr = i18n.translate('xpack.monitoring.alerts.validation.lessThanZero', { | ||
defaultMessage: 'This value can not be less than zero', | ||
}); | ||
errors.threshold = [errStr]; | ||
} | ||
|
||
if (!inputValues.duration) { | ||
const errStr = i18n.translate('xpack.monitoring.alerts.validation.duration', { | ||
defaultMessage: 'A valid duration is required.', | ||
}); | ||
errors.duration = [errStr]; | ||
} | ||
|
||
return { errors }; | ||
}, | ||
defaultActionMessage: '{{context.internalFullMessage}}', | ||
requiresAppContext: true, | ||
}; | ||
} |
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 |
---|---|---|
|
@@ -81,9 +81,9 @@ | |
* | ||
* @param {[type]} prov [description] | ||
*/ | ||
import _ from 'lodash'; | ||
import { partial, uniqueId, isObject } from 'lodash'; | ||
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. FYI, this has no impact on the size of the bundles since we always load and share a single, complete, lodash instance. |
||
|
||
const nextId = _.partial(_.uniqueId, 'privateProvider#'); | ||
const nextId = partial(uniqueId, 'privateProvider#'); | ||
|
||
function name(fn) { | ||
return fn.name || fn.toString().split('\n').shift(); | ||
|
@@ -141,7 +141,7 @@ export function PrivateProvider() { | |
|
||
const context = {}; | ||
let instance = $injector.invoke(prov, context, locals); | ||
if (!_.isObject(instance)) instance = context; | ||
if (!isObject(instance)) instance = context; | ||
|
||
privPath.pop(); | ||
return instance; | ||
|
@@ -155,7 +155,7 @@ export function PrivateProvider() { | |
|
||
if ($delegateId != null && $delegateProv != null) { | ||
instance = instantiate(prov, { | ||
$decorate: _.partial(get, $delegateId, $delegateProv), | ||
$decorate: partial(get, $delegateId, $delegateProv), | ||
}); | ||
} else { | ||
instance = instantiate(prov); | ||
|
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Our unofficial goal is to ultimately limit all page load asset sizes to 200kb in the next year or so, as teams continue to work reducing the size of their bundles. Is anyone from the monitoring team working to reduce the page load asset size of this bundle? a 20kb increase feels reasonable for now, but I'd like to ask that someone from the monitoring team take a look at the
x-pack/plugins/monitoring/target/public/stats.json
in one of the many webpack analyzers or visualizers after runningnode scripts/build_kibana_platform_plugins --focus monitoring --profile
?When I run it I see that the server code is being bundles in the page load bundle, which seems like the best way to fix the limit issue, rather than raising the limit.
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 awesome! Thank you @spalger 🙇