Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into task/olm-3094-move-…
Browse files Browse the repository at this point in the history
…host-isolation-exceptions-to-artifact-list-page-componet
  • Loading branch information
paul-tavares committed Apr 18, 2022
2 parents eb307c2 + 0fdccf7 commit 2d5864c
Show file tree
Hide file tree
Showing 31 changed files with 121 additions and 111 deletions.
4 changes: 2 additions & 2 deletions docs/management/connectors/action-types/webhook.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Webhook connectors have the following configuration properties.

Name:: The name of the connector. The name is used to identify a connector in the management UI connector listing, or in the connector list when configuring an action.
URL:: The request URL. If you are using the <<action-settings, `xpack.actions.allowedHosts`>> setting, make sure the hostname is added to the allowed hosts.
Method:: HTTP request method, either `POST`(default) or `PUT`.
Method:: HTTP request method, either `post`(default) or `put`.
Headers:: A set of key-value pairs sent as headers with the request
Require authentication:: If true, a username and password for login type authentication must be provided.
Username:: Username for HTTP basic authentication.
Expand All @@ -38,7 +38,7 @@ Use the <<action-settings, Action configuration settings>> to customize connecto
actionTypeId: .webhook
config:
url: https://test.host
method: POST
method: post
headers:
testheader: testvalue
secrets:
Expand Down
14 changes: 8 additions & 6 deletions docs/settings/alert-action-settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -198,24 +198,26 @@ For example, `20m`, `24h`, `7d`. Default: `1m`.
`xpack.alerting.rules.minimumScheduleInterval.enforce`::
Specifies the behavior when a new or changed rule has a schedule interval less than the value defined in `xpack.alerting.rules.minimumScheduleInterval.value`. If `false`, rules with schedules less than the interval will be created but warnings will be logged. If `true`, rules with schedules less than the interval cannot be created. Default: `false`.

`xpack.alerting.rules.execution.actions.max`::
`xpack.alerting.rules.run.actions.max`::
Specifies the maximum number of actions that a rule can trigger each time detection checks run.

`xpack.alerting.rules.execution.timeout`::
`xpack.alerting.rules.run.timeout`::
Specifies the default timeout for tasks associated with all types of rules. The time is formatted as:
+
`<count>[ms,s,m,h,d,w,M,Y]`
+
For example, `20m`, `24h`, `7d`, `1w`. Default: `5m`.

`xpack.alerting.rules.execution.ruleTypeOverrides`::
Overrides the configs under `xpack.alerting.rules.execution` for the rule type with the given ID. List the rule identifier and its settings in an array of objects.
`xpack.alerting.rules.run.ruleTypeOverrides`::
Overrides the configs under `xpack.alerting.rules.run` for the rule type with the given ID. List the rule identifier and its settings in an array of objects.
+
--
For example:
```
xpack.alerting.rules.execution:
xpack.alerting.rules.run:
timeout: '5m'
ruleTypeOverrides:
- id: '.index-threshold'
timeout: '15m'
```
```
--
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ and in the <<rule-details,details page>>:
[role="screenshot"]
image::images/rule-details-timeout-error.png[Rule details page with timeout error]

If you want your rules to run longer, update the `xpack.alerting.rules.execution.timeout` configuration in your <<alert-settings>>. You can also target a specific rule type by using `xpack.alerting.rules.execution.ruleTypeOverrides`.
If you want your rules to run longer, update the `xpack.alerting.rules.run.timeout` configuration in your <<alert-settings>>. You can also target a specific rule type by using `xpack.alerting.rules.run.ruleTypeOverrides`.

Rules that consistently run longer than their <<create-edit-rules, check interval>> may produce unexpected results. If the average run duration, visible on the <<rule-details,details page>>, is greater than the check interval, consider increasing the check interval.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ $ curl -X GET api/task_manager/_health
--------------------------------------------------
// KIBANA

Monitoring the `_health` endpoint of each {kib} instance in the cluster is the recommended method of ensuring confidence in mission critical services such as Alerting and Actions.
Monitoring the `_health` endpoint of each {kib} instance in the cluster is the recommended method of ensuring confidence in mission critical services such as Alerting, Actions, and Reporting.

[float]
[[task-manager-configuring-health-monitoring]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ A recommended strategy is to follow these steps:
3. If the throughput is insufficient, and {kib} instances exhibit low resource usage, incrementally scale vertically while <<kibana-page,monitoring>> the impact of these changes.
4. If the throughput is insufficient, and {kib} instances are exhibiting high resource usage, incrementally scale horizontally by provisioning new {kib} instances and reassess.

Task Manager, like the rest of the Elastic Stack, is designed to scale horizontally. Take advantage of this ability to ensure mission critical services, such as Alerting and Reporting, always have the capacity they need.
Task Manager, like the rest of the Elastic Stack, is designed to scale horizontally. Take advantage of this ability to ensure mission critical services, such as Alerting, Actions, and Reporting, always have the capacity they need.

Scaling horizontally requires a higher degree of coordination between {kib} instances. One way Task Manager coordinates with other instances is by delaying its polling schedule to avoid conflicts with other instances.
By using <<task-manager-health-monitoring, health monitoring>> to evaluate the <<task-manager-health-evaluate-the-runtime,date of the `last_polling_delay`>> across a deployment, you can estimate the frequency at which Task Manager resets its delay mechanism.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<titleabbrev>Troubleshooting</titleabbrev>
++++

Task Manager is used by a wide range of services in {kib}, such as <<alerting-production-considerations, Alerting>>, Reporting, and Telemetry.
Task Manager is used by a wide range of services in {kib}, such as <<alerting-production-considerations, Alerting>>, Actions, Reporting, and Telemetry.
Unexpected behavior in these services might be a downstream issue originating in Task Manager.

This page describes how to resolve common problems you might encounter with Task Manager.
Expand Down
5 changes: 4 additions & 1 deletion src/plugins/vis_types/timeseries/public/metrics_type.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ describe('metricsVisDefinition', () => {
async getDefault() {
return indexPattern1;
},
async find(title: string) {
async find(title: string, size: number) {
if (size !== 1) {
throw new Error('trying to fetch too many data views');
}
if (title === 'pattern1') return [indexPattern1];
if (title === 'pattern2') return [indexPattern2];
return [];
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/vis_types/timeseries/public/metrics_type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ async function resolveIndexPattern(
) {
if (!indexPatternValue) return;
if (isStringTypeIndexPattern(indexPatternValue)) {
return await indexPatterns.find(indexPatternValue);
return await indexPatterns.find(indexPatternValue, 1);
}

if (indexPatternValue.id) {
Expand Down
10 changes: 5 additions & 5 deletions x-pack/plugins/alerting/server/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ describe('config validation', () => {
},
"maxEphemeralActionsPerAlert": 10,
"rules": Object {
"execution": Object {
"actions": Object {
"max": 100000,
},
},
"minimumScheduleInterval": Object {
"enforce": false,
"value": "1m",
},
"run": Object {
"actions": Object {
"max": 100000,
},
},
},
}
`);
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/alerting/server/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const rulesSchema = schema.object({
}),
enforce: schema.boolean({ defaultValue: false }), // if enforce is false, only warnings will be shown
}),
execution: schema.object({
run: schema.object({
timeout: schema.maybe(schema.string({ validate: validateDurationSchema })),
actions: schema.object({
max: schema.number({ defaultValue: 100000 }),
Expand Down
10 changes: 3 additions & 7 deletions x-pack/plugins/alerting/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,8 @@ export const config: PluginConfigDescriptor<AlertsConfigType> = {
'xpack.alerting.invalidateApiKeysTask.removalDelay',
{ level: 'warning' }
),
renameFromRoot(
'xpack.alerting.defaultRuleTaskTimeout',
'xpack.alerting.rules.execution.timeout',
{
level: 'warning',
}
),
renameFromRoot('xpack.alerting.defaultRuleTaskTimeout', 'xpack.alerting.rules.run.timeout', {
level: 'warning',
}),
],
};
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ const config = {
value: '2m',
enforce: false,
},
execution: {
run: {
timeout: '1m',
actions: { max: 1000 },
},
} as RulesConfig;

const configWithRuleType = {
...config,
execution: {
...config.execution,
run: {
...config.run,
ruleTypeOverrides: [
{
id: ruleTypeId,
Expand All @@ -35,7 +35,7 @@ const configWithRuleType = {

const configWithoutTimeout = {
...config,
execution: {
run: {
actions: { max: 1000 },
},
};
Expand Down
7 changes: 2 additions & 5 deletions x-pack/plugins/alerting/server/lib/get_rule_task_timeout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const getRuleTaskTimeout = ({
ruleTaskTimeout?: string;
ruleTypeId: string;
}): string => {
const ruleTypeConfig = config.execution.ruleTypeOverrides?.find(
const ruleTypeConfig = config.run.ruleTypeOverrides?.find(
(ruleType) => ruleTypeId === ruleType.id
);

Expand All @@ -27,9 +27,6 @@ export const getRuleTaskTimeout = ({
// if not, ruleTaskTimeout is applied that is passed from the rule type registering plugin
// if none of above is set, DEFAULT_EXECUTION_TIMEOUT is applied
return (
ruleTypeConfig?.timeout ||
config.execution.timeout ||
ruleTaskTimeout ||
DEFAULT_EXECUTION_TIMEOUT
ruleTypeConfig?.timeout || config.run.timeout || ruleTaskTimeout || DEFAULT_EXECUTION_TIMEOUT
);
};
10 changes: 5 additions & 5 deletions x-pack/plugins/alerting/server/lib/get_rules_config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ const config = {
value: '2m',
enforce: false,
},
execution: {
run: {
timeout: '1m',
actions: { max: 1000 },
},
} as RulesConfig;

const configWithRuleType = {
...config,
execution: {
...config.execution,
run: {
...config.run,
ruleTypeOverrides: [
{
id: ruleTypeId,
Expand All @@ -36,7 +36,7 @@ const configWithRuleType = {
describe('get rules config', () => {
test('returns the rule type specific config and keeps the default values that are not overwritten', () => {
expect(getExecutionConfigForRuleType({ config: configWithRuleType, ruleTypeId })).toEqual({
execution: {
run: {
id: ruleTypeId,
timeout: '1m',
actions: { max: 20 },
Expand All @@ -46,7 +46,7 @@ describe('get rules config', () => {

test('returns the default config when there is no rule type specific config', () => {
expect(getExecutionConfigForRuleType({ config, ruleTypeId })).toEqual({
execution: config.execution,
run: config.run,
});
});
});
6 changes: 3 additions & 3 deletions x-pack/plugins/alerting/server/lib/get_rules_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ export const getExecutionConfigForRuleType = ({
config: RulesConfig;
ruleTypeId: string;
}): RuleTypeConfig => {
const ruleTypeExecutionConfig = config.execution.ruleTypeOverrides?.find(
const ruleTypeExecutionConfig = config.run.ruleTypeOverrides?.find(
(ruleType) => ruleType.id === ruleTypeId
);

return {
execution: {
...omit(config.execution, 'ruleTypeOverrides'),
run: {
...omit(config.run, 'ruleTypeOverrides'),
...ruleTypeExecutionConfig,
},
};
Expand Down
12 changes: 6 additions & 6 deletions x-pack/plugins/alerting/server/plugin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const generateAlertingConfig = (): AlertingConfig => ({
cancelAlertsOnRuleTimeout: true,
rules: {
minimumScheduleInterval: { value: '1m', enforce: false },
execution: {
run: {
actions: {
max: 1000,
},
Expand All @@ -51,7 +51,7 @@ const sampleRuleType: RuleType<never, never, never, never, never, 'default'> = {
defaultActionGroupId: 'default',
producer: 'test',
config: {
execution: {
run: {
actions: {
max: 1000,
},
Expand Down Expand Up @@ -127,7 +127,7 @@ describe('Alerting Plugin', () => {
...generateAlertingConfig(),
rules: {
minimumScheduleInterval: { value: '1m', enforce: false },
execution: {
run: {
actions: {
max: 123,
},
Expand All @@ -142,7 +142,7 @@ describe('Alerting Plugin', () => {
setupContract.registerType(ruleType);

expect(ruleType.config).toEqual({
execution: {
run: {
actions: { max: 123 },
},
});
Expand All @@ -153,7 +153,7 @@ describe('Alerting Plugin', () => {
...generateAlertingConfig(),
rules: {
minimumScheduleInterval: { value: '1m', enforce: false },
execution: {
run: {
actions: { max: 123 },
ruleTypeOverrides: [{ id: sampleRuleType.id, timeout: '1d' }],
},
Expand All @@ -167,7 +167,7 @@ describe('Alerting Plugin', () => {
setupContract.registerType(ruleType);

expect(ruleType.config).toEqual({
execution: {
run: {
id: sampleRuleType.id,
actions: {
max: 123,
Expand Down
Loading

0 comments on commit 2d5864c

Please sign in to comment.