Skip to content

Commit 1a15294

Browse files
author
Aaron Caldwell
committed
Merge remote-tracking branch 'upstream/master' into np-migrate-region-maps
2 parents 76d2a74 + a907c9b commit 1a15294

File tree

23 files changed

+578
-80
lines changed

23 files changed

+578
-80
lines changed

x-pack/plugins/infra/server/lib/alerting/metric_threshold/metric_threshold_executor.ts

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,19 @@ const getCurrentValueFromAggregations = (
5151

5252
const getParsedFilterQuery: (
5353
filterQuery: string | undefined
54-
) => Record<string, any> = filterQuery => {
54+
) => Record<string, any> | Array<Record<string, any>> = filterQuery => {
5555
if (!filterQuery) return {};
5656
try {
5757
return JSON.parse(filterQuery).bool;
5858
} catch (e) {
59-
return {
60-
query_string: {
61-
query: filterQuery,
62-
analyze_wildcard: true,
59+
return [
60+
{
61+
query_string: {
62+
query: filterQuery,
63+
analyze_wildcard: true,
64+
},
6365
},
64-
};
66+
];
6567
}
6668
};
6769

@@ -159,8 +161,12 @@ export const getElasticsearchMetricQuery = (
159161
return {
160162
query: {
161163
bool: {
162-
filter: [...rangeFilters, ...metricFieldFilters],
163-
...parsedFilterQuery,
164+
filter: [
165+
...rangeFilters,
166+
...metricFieldFilters,
167+
...(Array.isArray(parsedFilterQuery) ? parsedFilterQuery : []),
168+
],
169+
...(!Array.isArray(parsedFilterQuery) ? parsedFilterQuery : {}),
164170
},
165171
},
166172
size: 0,
@@ -233,6 +239,7 @@ const getMetric: (
233239
body: searchBody,
234240
index,
235241
});
242+
236243
return { '*': getCurrentValueFromAggregations(result.aggregations, aggType) };
237244
} catch (e) {
238245
return { '*': undefined }; // Trigger an Error state

x-pack/plugins/ingest_manager/common/constants/agent_config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export const DEFAULT_AGENT_CONFIG = {
1414
status: AgentConfigStatus.Active,
1515
datasources: [],
1616
is_default: true,
17+
monitoring_enabled: ['logs', 'metrics'] as Array<'logs' | 'metrics'>,
1718
};
1819

1920
export const DEFAULT_AGENT_CONFIGS_PACKAGES = [DefaultPackages.system];

x-pack/plugins/ingest_manager/common/types/models/agent_config.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export interface NewAgentConfig {
2323
namespace?: string;
2424
description?: string;
2525
is_default?: boolean;
26+
monitoring_enabled?: Array<'logs' | 'metrics'>;
2627
}
2728

2829
export interface AgentConfig extends NewAgentConfig, SavedObjectAttributes {
@@ -60,4 +61,12 @@ export interface FullAgentConfig {
6061
};
6162
datasources: FullAgentConfigDatasource[];
6263
revision?: number;
64+
settings?: {
65+
monitoring: {
66+
use_output?: string;
67+
enabled: boolean;
68+
metrics: boolean;
69+
logs: boolean;
70+
};
71+
};
6372
}
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
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+
* you may not use this file except in compliance with the Elastic License.
5+
*/
6+
import React from 'react';
7+
import {
8+
EuiButtonEmpty,
9+
EuiFlyout,
10+
EuiFlyoutBody,
11+
EuiFlyoutHeader,
12+
EuiFlyoutFooter,
13+
EuiLink,
14+
EuiText,
15+
EuiTitle,
16+
} from '@elastic/eui';
17+
import { FormattedMessage } from '@kbn/i18n/react';
18+
19+
interface Props {
20+
onClose: () => void;
21+
}
22+
23+
export const AlphaFlyout: React.FunctionComponent<Props> = ({ onClose }) => {
24+
return (
25+
<EuiFlyout onClose={onClose} size="m" maxWidth={640}>
26+
<EuiFlyoutHeader hasBorder aria-labelledby="AlphaMessagingFlyoutTitle">
27+
<EuiTitle size="m">
28+
<h2 id="AlphaMessagingFlyoutTitle">
29+
<FormattedMessage
30+
id="xpack.ingestManager.alphaMessaging.flyoutTitle"
31+
defaultMessage="About this release"
32+
/>
33+
</h2>
34+
</EuiTitle>
35+
</EuiFlyoutHeader>
36+
<EuiFlyoutBody>
37+
<EuiText size="m">
38+
<p>
39+
<FormattedMessage
40+
id="xpack.ingestManager.alphaMessaging.introText"
41+
defaultMessage="This release is experimental and is not subject to the support SLA. It is designed for users to test and offer feedback about Ingest
42+
Manager and the new Elastic Agent. It is not intended for use in production environments since certain features may change or go away in a future release."
43+
/>
44+
</p>
45+
<FormattedMessage
46+
id="xpack.ingestManager.alphaMessaging.feedbackText"
47+
defaultMessage="We encourage you to read our {docsLink} or to ask questions and send feedback in our {forumLink}."
48+
values={{
49+
docsLink: (
50+
<EuiLink href="https://ela.st/ingest-manager-docs" external target="_blank">
51+
<FormattedMessage
52+
id="xpack.ingestManager.alphaMessaging.docsLink"
53+
defaultMessage="documentation"
54+
/>
55+
</EuiLink>
56+
),
57+
forumLink: (
58+
<EuiLink href="https://ela.st/ingest-manager-forum" external target="_blank">
59+
<FormattedMessage
60+
id="xpack.ingestManager.alphaMessaging.forumLink"
61+
defaultMessage="Discuss forum"
62+
/>
63+
</EuiLink>
64+
),
65+
}}
66+
/>
67+
<p />
68+
69+
<p>
70+
<FormattedMessage
71+
id="xpack.ingestManager.alphaMessaging.warningText"
72+
defaultMessage="{note}: you should not store important data with Ingest Manager
73+
since you will have limited visibility to it in a future release. This version uses an
74+
indexing strategy that will be deprecated in a future release and there is no migration
75+
path. Also, licensing for certain features is under consideration and may change in the future. As a result, you may lose access to certain features based on your license
76+
tier."
77+
values={{
78+
note: (
79+
<strong>
80+
<FormattedMessage
81+
id="xpack.ingestManager.alphaMessaging.warningNote"
82+
defaultMessage="Note"
83+
/>
84+
</strong>
85+
),
86+
}}
87+
/>
88+
</p>
89+
</EuiText>
90+
</EuiFlyoutBody>
91+
<EuiFlyoutFooter>
92+
<EuiButtonEmpty iconType="cross" onClick={onClose} flush="left">
93+
<FormattedMessage
94+
id="xpack.ingestManager.alphaMessging.closeFlyoutLabel"
95+
defaultMessage="Close"
96+
/>
97+
</EuiButtonEmpty>
98+
</EuiFlyoutFooter>
99+
</EuiFlyout>
100+
);
101+
};

x-pack/plugins/ingest_manager/public/applications/ingest_manager/components/alpha_messaging.tsx

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,45 @@
33
* or more contributor license agreements. Licensed under the Elastic License;
44
* you may not use this file except in compliance with the Elastic License.
55
*/
6-
import React from 'react';
6+
import React, { useState } from 'react';
77
import styled from 'styled-components';
88
import { FormattedMessage } from '@kbn/i18n/react';
9-
import { EuiText } from '@elastic/eui';
9+
import { EuiText, EuiLink } from '@elastic/eui';
10+
import { AlphaFlyout } from './alpha_flyout';
1011

1112
const Message = styled(EuiText).attrs(props => ({
1213
color: 'subdued',
1314
textAlign: 'center',
15+
size: 's',
1416
}))`
1517
padding: ${props => props.theme.eui.paddingSizes.m};
1618
`;
1719

18-
export const AlphaMessaging: React.FC<{}> = () => (
19-
<Message>
20-
<p>
21-
<small>
22-
<strong>
20+
export const AlphaMessaging: React.FC<{}> = () => {
21+
const [isAlphaFlyoutOpen, setIsAlphaFlyoutOpen] = useState<boolean>(false);
22+
23+
return (
24+
<>
25+
<Message>
26+
<p>
27+
<strong>
28+
<FormattedMessage
29+
id="xpack.ingestManager.alphaMessageTitle"
30+
defaultMessage="Experimental"
31+
/>
32+
</strong>
33+
{' – '}
2334
<FormattedMessage
24-
id="xpack.ingestManager.alphaMessageTitle"
25-
defaultMessage="Alpha release"
26-
/>
27-
</strong>
28-
{' – '}
29-
<FormattedMessage
30-
id="xpack.ingestManager.alphaMessageDescription"
31-
defaultMessage="Ingest Manager is under active development and is not
35+
id="xpack.ingestManager.alphaMessageDescription"
36+
defaultMessage="Ingest Manager is under active development and is not
3237
intended for production purposes."
33-
/>
34-
</small>
35-
</p>
36-
</Message>
37-
);
38+
/>{' '}
39+
<EuiLink color="subdued" onClick={() => setIsAlphaFlyoutOpen(true)}>
40+
View more details.
41+
</EuiLink>
42+
</p>
43+
</Message>
44+
{isAlphaFlyoutOpen && <AlphaFlyout onClose={() => setIsAlphaFlyoutOpen(false)} />}
45+
</>
46+
);
47+
};

x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_config/components/config_form.tsx

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
EuiText,
1919
EuiComboBox,
2020
EuiIconTip,
21+
EuiCheckboxGroup,
2122
} from '@elastic/eui';
2223
import { FormattedMessage } from '@kbn/i18n/react';
2324
import { i18n } from '@kbn/i18n';
@@ -30,7 +31,7 @@ interface ValidationResults {
3031

3132
const StyledEuiAccordion = styled(EuiAccordion)`
3233
.ingest-active-button {
33-
color: ${props => props.theme.eui.euiColorPrimary}};
34+
color: ${props => props.theme.eui.euiColorPrimary};
3435
}
3536
`;
3637

@@ -244,6 +245,68 @@ export const AgentConfigForm: React.FunctionComponent<Props> = ({
244245
)}
245246
</EuiFlexItem>
246247
</EuiFlexGroup>
248+
<EuiSpacer size="m" />
249+
<EuiFlexGroup>
250+
<EuiFlexItem>
251+
<EuiText>
252+
<h4>
253+
<FormattedMessage
254+
id="xpack.ingestManager.agentConfigForm.monitoringLabel"
255+
defaultMessage="Agent monitoring"
256+
/>
257+
</h4>
258+
</EuiText>
259+
<EuiSpacer size="m" />
260+
<EuiText size="s">
261+
<FormattedMessage
262+
id="xpack.ingestManager.agentConfigForm.monitoringDescription"
263+
defaultMessage="Collect data about your agents for debugging and tracking performance."
264+
/>
265+
</EuiText>
266+
</EuiFlexItem>
267+
<EuiFlexItem>
268+
<EuiCheckboxGroup
269+
options={[
270+
{
271+
id: 'logs',
272+
label: i18n.translate(
273+
'xpack.ingestManager.agentConfigForm.monitoringLogsFieldLabel',
274+
{ defaultMessage: 'Collect agent logs' }
275+
),
276+
},
277+
{
278+
id: 'metrics',
279+
label: i18n.translate(
280+
'xpack.ingestManager.agentConfigForm.monitoringMetricsFieldLabel',
281+
{ defaultMessage: 'Collect agent metrics' }
282+
),
283+
},
284+
]}
285+
idToSelectedMap={(agentConfig.monitoring_enabled || []).reduce(
286+
(acc: { logs: boolean; metrics: boolean }, key) => {
287+
acc[key] = true;
288+
return acc;
289+
},
290+
{ logs: false, metrics: false }
291+
)}
292+
onChange={id => {
293+
if (id !== 'logs' && id !== 'metrics') {
294+
return;
295+
}
296+
297+
const hasLogs =
298+
agentConfig.monitoring_enabled && agentConfig.monitoring_enabled.indexOf(id) >= 0;
299+
300+
const previousValues = agentConfig.monitoring_enabled || [];
301+
updateAgentConfig({
302+
monitoring_enabled: hasLogs
303+
? previousValues.filter(type => type !== id)
304+
: [...previousValues, id],
305+
});
306+
}}
307+
/>
308+
</EuiFlexItem>
309+
</EuiFlexGroup>
247310
</StyledEuiAccordion>
248311
</EuiForm>
249312
);

x-pack/plugins/ingest_manager/public/applications/ingest_manager/sections/agent_config/list_page/components/create_config.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export const CreateAgentConfigFlyout: React.FunctionComponent<Props> = ({ onClos
3434
description: '',
3535
namespace: '',
3636
is_default: undefined,
37+
monitoring_enabled: ['logs', 'metrics'],
3738
});
3839
const [isLoading, setIsLoading] = useState<boolean>(false);
3940
const [withSysMonitoring, setWithSysMonitoring] = useState<boolean>(true);

0 commit comments

Comments
 (0)