Skip to content

Commit 4182f02

Browse files
Merge branch 'master' into moving-file-data-visualizer-UI-to-file-upload-plugin
2 parents 56e73f5 + dfaf3ac commit 4182f02

File tree

59 files changed

+9812
-1304
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+9812
-1304
lines changed

docs/developer/plugin-list.asciidoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,10 @@ Elastic.
485485
|Welcome to the Kibana rollup plugin! This plugin provides Kibana support for Elasticsearch's rollup feature. Please refer to the Elasticsearch documentation to understand rollup indices and how to create rollup jobs.
486486
487487
488+
|{kib-repo}blob/{branch}/x-pack/plugins/rule_registry/README.md[ruleRegistry]
489+
|The rule registry plugin aims to make it easy for rule type producers to have their rules produce the data that they need to build rich experiences on top of a unified experience, without the risk of mapping conflicts.
490+
491+
488492
|{kib-repo}blob/{branch}/x-pack/plugins/runtime_fields/README.md[runtimeFields]
489493
|Welcome to the home of the runtime field editor and everything related to runtime fields!
490494

typings/elasticsearch/search.d.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,16 @@ export type AggregateOf<
370370
missing: {
371371
doc_count: number;
372372
} & SubAggregateOf<TAggregationContainer, TDocument>;
373+
multi_terms: {
374+
doc_count_error_upper_bound: number;
375+
sum_other_doc_count: number;
376+
buckets: Array<
377+
{
378+
doc_count: number;
379+
key: string[];
380+
} & SubAggregateOf<TAggregationContainer, TDocument>
381+
>;
382+
};
373383
nested: {
374384
doc_count: number;
375385
} & SubAggregateOf<TAggregationContainer, TDocument>;

x-pack/plugins/apm/common/environment_filter_values.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,13 @@ const environmentLabels: Record<string, string> = {
2222
};
2323

2424
export const ENVIRONMENT_ALL = {
25+
esFieldValue: undefined,
2526
value: ENVIRONMENT_ALL_VALUE,
2627
text: environmentLabels[ENVIRONMENT_ALL_VALUE],
2728
};
2829

2930
export const ENVIRONMENT_NOT_DEFINED = {
31+
esFieldValue: undefined,
3032
value: ENVIRONMENT_NOT_DEFINED_VALUE,
3133
text: environmentLabels[ENVIRONMENT_NOT_DEFINED_VALUE],
3234
};
@@ -35,6 +37,22 @@ export function getEnvironmentLabel(environment: string) {
3537
return environmentLabels[environment] || environment;
3638
}
3739

40+
export function parseEnvironmentUrlParam(environment: string) {
41+
if (environment === ENVIRONMENT_ALL_VALUE) {
42+
return ENVIRONMENT_ALL;
43+
}
44+
45+
if (environment === ENVIRONMENT_NOT_DEFINED_VALUE) {
46+
return ENVIRONMENT_NOT_DEFINED;
47+
}
48+
49+
return {
50+
esFieldValue: environment,
51+
value: environment,
52+
text: environment,
53+
};
54+
}
55+
3856
// returns the environment url param that should be used
3957
// based on the requested environment. If the requested
4058
// environment is different from the URL parameter, we'll

x-pack/plugins/apm/kibana.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"licensing",
1010
"triggersActionsUi",
1111
"embeddable",
12-
"infra"
12+
"infra",
13+
"observability"
1314
],
1415
"optionalPlugins": [
1516
"spaces",
@@ -18,7 +19,6 @@
1819
"taskManager",
1920
"actions",
2021
"alerting",
21-
"observability",
2222
"security",
2323
"ml",
2424
"home",

x-pack/plugins/apm/scripts/optimize-tsconfig/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"include": [
33
"./x-pack/plugins/apm/**/*",
44
"./x-pack/plugins/observability/**/*",
5+
"./x-pack/plugins/rule_registry/**/*",
56
"./typings/**/*"
67
],
78
"exclude": [

x-pack/plugins/apm/server/lib/alerts/action_variables.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,28 @@ export const apmActionVariables = {
1313
'xpack.apm.alerts.action_variables.serviceName',
1414
{ defaultMessage: 'The service the alert is created for' }
1515
),
16-
name: 'serviceName',
16+
name: 'serviceName' as const,
1717
},
1818
transactionType: {
1919
description: i18n.translate(
2020
'xpack.apm.alerts.action_variables.transactionType',
2121
{ defaultMessage: 'The transaction type the alert is created for' }
2222
),
23-
name: 'transactionType',
23+
name: 'transactionType' as const,
2424
},
2525
environment: {
2626
description: i18n.translate(
2727
'xpack.apm.alerts.action_variables.environment',
2828
{ defaultMessage: 'The transaction type the alert is created for' }
2929
),
30-
name: 'environment',
30+
name: 'environment' as const,
3131
},
3232
threshold: {
3333
description: i18n.translate('xpack.apm.alerts.action_variables.threshold', {
3434
defaultMessage:
3535
'Any trigger value above this value will cause the alert to fire',
3636
}),
37-
name: 'threshold',
37+
name: 'threshold' as const,
3838
},
3939
triggerValue: {
4040
description: i18n.translate(
@@ -44,7 +44,7 @@ export const apmActionVariables = {
4444
'The value that breached the threshold and triggered the alert',
4545
}
4646
),
47-
name: 'triggerValue',
47+
name: 'triggerValue' as const,
4848
},
4949
interval: {
5050
description: i18n.translate(
@@ -54,6 +54,6 @@ export const apmActionVariables = {
5454
'The length and unit of the time period where the alert conditions were met',
5555
}
5656
),
57-
name: 'interval',
57+
name: 'interval' as const,
5858
},
5959
};

x-pack/plugins/apm/server/lib/alerts/alerting_es_client.ts

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,24 @@
55
* 2.0.
66
*/
77

8-
import { ApiResponse } from '@elastic/elasticsearch';
9-
import { ThresholdMetActionGroupId } from '../../../common/alert_types';
108
import {
119
ESSearchRequest,
1210
ESSearchResponse,
1311
} from '../../../../../../typings/elasticsearch';
14-
import {
15-
AlertInstanceContext,
16-
AlertInstanceState,
17-
AlertServices,
18-
} from '../../../../alerting/server';
12+
import { AlertServices } from '../../../../alerting/server';
1913

20-
export function alertingEsClient<TParams extends ESSearchRequest>(
21-
services: AlertServices<
22-
AlertInstanceState,
23-
AlertInstanceContext,
24-
ThresholdMetActionGroupId
25-
>,
14+
export async function alertingEsClient<TParams extends ESSearchRequest>(
15+
scopedClusterClient: AlertServices<
16+
never,
17+
never,
18+
never
19+
>['scopedClusterClient'],
2620
params: TParams
27-
): Promise<ApiResponse<ESSearchResponse<unknown, TParams>>> {
28-
return (services.scopedClusterClient.asCurrentUser.search({
21+
): Promise<ESSearchResponse<unknown, TParams>> {
22+
const response = await scopedClusterClient.asCurrentUser.search({
2923
...params,
3024
ignore_unavailable: true,
31-
}) as unknown) as Promise<ApiResponse<ESSearchResponse<unknown, TParams>>>;
25+
});
26+
27+
return (response.body as unknown) as ESSearchResponse<unknown, TParams>;
3228
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License
4+
* 2.0; you may not use this file except in compliance with the Elastic License
5+
* 2.0.
6+
*/
7+
8+
import { createLifecycleRuleTypeFactory } from '../../../../rule_registry/server';
9+
import { APMRuleRegistry } from '../../plugin';
10+
11+
export const createAPMLifecycleRuleType = createLifecycleRuleTypeFactory<APMRuleRegistry>();

x-pack/plugins/apm/server/lib/alerts/register_apm_alerts.ts

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,38 +6,25 @@
66
*/
77

88
import { Observable } from 'rxjs';
9-
import { AlertingPlugin } from '../../../../alerting/server';
10-
import { ActionsPlugin } from '../../../../actions/server';
9+
import { Logger } from 'kibana/server';
1110
import { registerTransactionDurationAlertType } from './register_transaction_duration_alert_type';
1211
import { registerTransactionDurationAnomalyAlertType } from './register_transaction_duration_anomaly_alert_type';
1312
import { registerErrorCountAlertType } from './register_error_count_alert_type';
1413
import { APMConfig } from '../..';
1514
import { MlPluginSetup } from '../../../../ml/server';
1615
import { registerTransactionErrorRateAlertType } from './register_transaction_error_rate_alert_type';
16+
import { APMRuleRegistry } from '../../plugin';
1717

18-
interface Params {
19-
alerting: AlertingPlugin['setup'];
20-
actions: ActionsPlugin['setup'];
18+
export interface RegisterRuleDependencies {
19+
registry: APMRuleRegistry;
2120
ml?: MlPluginSetup;
2221
config$: Observable<APMConfig>;
22+
logger: Logger;
2323
}
2424

25-
export function registerApmAlerts(params: Params) {
26-
registerTransactionDurationAlertType({
27-
alerting: params.alerting,
28-
config$: params.config$,
29-
});
30-
registerTransactionDurationAnomalyAlertType({
31-
alerting: params.alerting,
32-
ml: params.ml,
33-
config$: params.config$,
34-
});
35-
registerErrorCountAlertType({
36-
alerting: params.alerting,
37-
config$: params.config$,
38-
});
39-
registerTransactionErrorRateAlertType({
40-
alerting: params.alerting,
41-
config$: params.config$,
42-
});
25+
export function registerApmAlerts(dependencies: RegisterRuleDependencies) {
26+
registerTransactionDurationAlertType(dependencies);
27+
registerTransactionDurationAnomalyAlertType(dependencies);
28+
registerErrorCountAlertType(dependencies);
29+
registerTransactionErrorRateAlertType(dependencies);
4330
}

0 commit comments

Comments
 (0)