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

[Uptime] [Synthetics Integration] add new advanced options #112454

Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
a9557d8
refactor common fields
dominiqueclarke Sep 16, 2021
1ed6bcb
add ignore_https_errors and journey filters options
dominiqueclarke Sep 16, 2021
6990707
Merge branch 'master' into feature/109732-synthetics-integration-new-…
kibanamachine Sep 20, 2021
c5bae16
Merge branch 'master' into feature/109732-synthetics-integration-new-…
kibanamachine Sep 21, 2021
8be094f
Merge branch 'master' into feature/109732-synthetics-integration-new-…
kibanamachine Sep 27, 2021
3bbae82
Merge branch 'master' of github.com:elastic/kibana into feature/10973…
dominiqueclarke Sep 30, 2021
cc1b3c4
adjust formatters and normalizers
dominiqueclarke Sep 30, 2021
4172924
Merge branch 'master' into feature/109732-synthetics-integration-new-…
kibanamachine Oct 4, 2021
a6063e9
Merge branch 'master' into feature/109732-synthetics-integration-new-…
kibanamachine Oct 6, 2021
73bda4e
adjust content and hide fields when zip url is not defined
dominiqueclarke Oct 7, 2021
07254e1
Merge branch 'feature/109732-synthetics-integration-new-advanced-opti…
dominiqueclarke Oct 7, 2021
a9c660d
adjust content again
dominiqueclarke Oct 7, 2021
e258540
Merge branch 'master' into feature/109732-synthetics-integration-new-…
kibanamachine Oct 11, 2021
2bc472f
update tests
dominiqueclarke Oct 11, 2021
44f2f94
Merge branch 'feature/109732-synthetics-integration-new-advanced-opti…
dominiqueclarke Oct 11, 2021
3b437ba
Merge branch 'master' into feature/109732-synthetics-integration-new-…
kibanamachine Oct 11, 2021
234a3b4
adjust tests
dominiqueclarke Oct 11, 2021
8359b80
Merge branch 'feature/109732-synthetics-integration-new-advanced-opti…
dominiqueclarke Oct 11, 2021
ab9ee88
adjust tests
dominiqueclarke Oct 11, 2021
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
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import { FormattedMessage } from '@kbn/i18n/react';
import {
EuiAccordion,
EuiSelect,
EuiFieldText,
EuiCheckbox,
EuiFormRow,
EuiDescribedFormGroup,
EuiSpacer,
Expand Down Expand Up @@ -39,6 +41,73 @@ export const BrowserAdvancedFields = () => {
data-test-subj="syntheticsBrowserAdvancedFieldsAccordion"
>
<EuiSpacer size="m" />
<EuiDescribedFormGroup
title={
<h4>
<FormattedMessage
id="xpack.uptime.createPackagePolicy.stepConfigure.browserAdvancedSettings.filtering.title"
defaultMessage="Synthetics agent filtering"
/>
</h4>
}
description={
<FormattedMessage
id="xpack.uptime.createPackagePolicy.stepConfigure.browserAdvancedSettings.filtering.description"
defaultMessage="Filter tests using match or tags options."
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should clarify somewhere that this is for when you're running a suite of tests vs using the recorder of inline. I was a bit confused. I also think perhaps we should look at a different word than filter. Something about "Selective Tests" "Use this option to apply these monitor settings to a subset of the tests in your suite". (or something along those lines)

As I understand this, you're not really filtering per-se, you more choosing a subset to apply an action to (in this case, the monitor frequency, name etc that you set above) WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@drewpost That makes sense. I can hide these settings when inline or recorder is selected.

I think the statement about "not really filtering" is generally correct, though it will filter in the sense that only that subset will be run. Maybe add an additional sentence: "Only the configured subset will be run by this monitor."

/>
}
>
<EuiSpacer size="s" />
<EuiFormRow
label={
<FormattedMessage
id="xpack.uptime.createPackagePolicy.stepConfigure.browserAdvancedSettings.journeyFiltersMatch.label"
defaultMessage="Filter match"
/>
}
labelAppend={<OptionalLabel />}
helpText={
<FormattedMessage
id="xpack.uptime.createPackagePolicy.stepConfigure.browserAdvancedSettings.journeyFiltersMatch.helpText"
defaultMessage="Run only journeys with a name or tags that matches the provided glob."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
defaultMessage="Run only journeys with a name or tags that matches the provided glob."
defaultMessage="Run only journeys with a name or tag that matches the provided glob."

Think this is cleaner copy.

/>
}
>
<EuiFieldText
value={fields[ConfigKeys.JOURNEY_FILTERS_MATCH]}
onChange={(event) =>
handleInputChange({
value: event.target.value,
configKey: ConfigKeys.JOURNEY_FILTERS_MATCH,
})
}
data-test-subj="syntheticsBrowserJourneyFiltersMatch"
/>
</EuiFormRow>
<EuiFormRow
label={
<FormattedMessage
id="xpack.uptime.createPackagePolicy.stepConfigure.browserAdvancedSettings.journeyFiltersTags.label"
defaultMessage="Filter tags"
/>
}
labelAppend={<OptionalLabel />}
helpText={
<FormattedMessage
id="xpack.uptime.createPackagePolicy.stepConfigure.browserAdvancedSettings.journeyFiltersTags.helpText"
defaultMessage="Run only journeys with the given tag(s), or globs."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
defaultMessage="Run only journeys with the given tag(s), or globs."
defaultMessage="Run only journeys with the given tags, or globs."

Think we can skip this since globs is plural.

/>
}
>
<ComboBox
selectedOptions={fields[ConfigKeys.JOURNEY_FILTERS_TAGS]}
onChange={(value) =>
handleInputChange({ value, configKey: ConfigKeys.JOURNEY_FILTERS_TAGS })
}
data-test-subj="syntheticsBrowserJourneyFiltersTags"
/>
</EuiFormRow>
</EuiDescribedFormGroup>
<EuiDescribedFormGroup
title={
<h4>
Expand All @@ -56,6 +125,34 @@ export const BrowserAdvancedFields = () => {
}
>
<EuiSpacer size="s" />
<EuiFormRow
helpText={
<>
<FormattedMessage
id="xpack.uptime.createPackagePolicy.stepConfigure.browserAdvancedSettings.ignoreHttpsErrors.helpText"
defaultMessage="Set this option to true to disable TLS/SSL validation in the synthetics browser. This is useful for testing sites that use self-signed certs."
/>
</>
}
data-test-subj="syntheticsBrowserIgnoreHttpsErrors"
>
<EuiCheckbox
id="syntheticsBrowserIgnoreHttpsErrorsCheckbox"
checked={fields[ConfigKeys.IGNORE_HTTPS_ERRORS]}
label={
<FormattedMessage
id="xpack.uptime.createPackagePolicy.stepConfigure.browserAdvancedSettings.ignoreHttpsErrors.label"
defaultMessage="Ignore HTTPS errors"
/>
}
onChange={(event) =>
handleInputChange({
value: event.target.checked,
configKey: ConfigKeys.IGNORE_HTTPS_ERRORS,
})
}
/>
</EuiFormRow>
<EuiFormRow
label={
<FormattedMessage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,10 @@ export const browserFormatters: BrowserFormatMap = {
[ConfigKeys.SCREENSHOTS]: null,
[ConfigKeys.SYNTHETICS_ARGS]: (fields) =>
arrayToJsonFormatter(fields[ConfigKeys.SYNTHETICS_ARGS]),
[ConfigKeys.JOURNEY_FILTERS_MATCH]: (fields) =>
stringToJsonFormatter(fields[ConfigKeys.JOURNEY_FILTERS_MATCH]),
[ConfigKeys.JOURNEY_FILTERS_TAGS]: (fields) =>
arrayToJsonFormatter(fields[ConfigKeys.JOURNEY_FILTERS_TAGS]),
[ConfigKeys.IGNORE_HTTPS_ERRORS]: null,
...commonFormatters,
};
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,12 @@ export const browserNormalizers: BrowserNormalizerMap = {
[ConfigKeys.PARAMS]: getBrowserNormalizer(ConfigKeys.PARAMS),
[ConfigKeys.SCREENSHOTS]: getBrowserNormalizer(ConfigKeys.SCREENSHOTS),
[ConfigKeys.SYNTHETICS_ARGS]: getBrowserJsonToJavascriptNormalizer(ConfigKeys.SYNTHETICS_ARGS),
[ConfigKeys.JOURNEY_FILTERS_MATCH]: getBrowserJsonToJavascriptNormalizer(
ConfigKeys.JOURNEY_FILTERS_MATCH
),
[ConfigKeys.JOURNEY_FILTERS_TAGS]: getBrowserJsonToJavascriptNormalizer(
ConfigKeys.JOURNEY_FILTERS_TAGS
),
[ConfigKeys.IGNORE_HTTPS_ERRORS]: getBrowserNormalizer(ConfigKeys.IGNORE_HTTPS_ERRORS),
...commonNormalizers,
};
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@

import React, { memo, useMemo, useCallback } from 'react';
import { FormattedMessage } from '@kbn/i18n/react';
import { EuiFormRow, EuiFieldText, EuiFieldNumber } from '@elastic/eui';
import { EuiFormRow } from '@elastic/eui';
import { ConfigKeys, Validation } from '../types';
import { useBrowserSimpleFieldsContext } from '../contexts';
import { ComboBox } from '../combo_box';
import { OptionalLabel } from '../optional_label';
import { ScheduleField } from '../schedule_field';
import { SourceField } from './source_field';
import { CommonFields } from '../common/common_fields';

interface Props {
validate: Validation;
Expand Down Expand Up @@ -91,93 +90,7 @@ export const BrowserSimpleFields = memo<Props>(({ validate }) => {
)}
/>
</EuiFormRow>
<EuiFormRow
label={
<FormattedMessage
id="xpack.uptime.createPackagePolicy.stepConfigure.monitorIntegrationSettingsSection.APMServiceName.label"
defaultMessage="APM service name"
/>
}
labelAppend={<OptionalLabel />}
helpText={
<FormattedMessage
id="xpack.uptime.createPackagePolicy.stepConfigure.monitorIntegrationSettingsSection.APMServiceName.helpText"
defaultMessage="APM service name for this monitor. Corresponds to the service.name ECS field. Set this when monitoring an app that is also using APM to enable integrations between Uptime and APM data in Kibana."
/>
}
>
<EuiFieldText
value={fields[ConfigKeys.APM_SERVICE_NAME]}
onChange={(event) =>
handleInputChange({
value: event.target.value,
configKey: ConfigKeys.APM_SERVICE_NAME,
})
}
data-test-subj="syntheticsAPMServiceName"
/>
</EuiFormRow>
<EuiFormRow
label={
<FormattedMessage
id="xpack.uptime.createPackagePolicy.stepConfigure.monitorIntegrationSettingsSection.timeout.label"
defaultMessage="Timeout in seconds"
/>
}
isInvalid={!!validate[ConfigKeys.TIMEOUT]?.(fields)}
error={
parseInt(fields[ConfigKeys.TIMEOUT], 10) < 0 ? (
<FormattedMessage
id="xpack.uptime.createPackagePolicy.stepConfigure.monitorIntegrationSettingsSection.timeout.moreThanZeroError"
defaultMessage="Timeout must be greater than or equal to 0"
/>
) : (
<FormattedMessage
id="xpack.uptime.createPackagePolicy.stepConfigure.monitorIntegrationSettingsSection.timeout.lessThanIntervalError"
defaultMessage="Timeout must be less than the monitor interval"
/>
)
}
helpText={
<FormattedMessage
id="xpack.uptime.createPackagePolicy.stepConfigure.monitorIntegrationSettingsSection.timeout.helpText"
defaultMessage="The total time allowed for testing the connection and exchanging data."
/>
}
>
<EuiFieldNumber
min={0}
value={fields[ConfigKeys.TIMEOUT]}
onChange={(event) =>
handleInputChange({
value: event.target.value,
configKey: ConfigKeys.TIMEOUT,
})
}
step={'any'}
/>
</EuiFormRow>
<EuiFormRow
label={
<FormattedMessage
id="xpack.uptime.createPackagePolicy.stepConfigure.monitorIntegrationSettingsSection.tags.label"
defaultMessage="Tags"
/>
}
labelAppend={<OptionalLabel />}
helpText={
<FormattedMessage
id="xpack.uptime.createPackagePolicy.stepConfigure.monitorIntegrationSettingsSection.tags.helpText"
defaultMessage="A list of tags that will be sent with the monitor event. Press enter to add a new tag. Displayed in Uptime and enables searching by tag."
/>
}
>
<ComboBox
selectedOptions={fields[ConfigKeys.TAGS]}
onChange={(value) => handleInputChange({ value, configKey: ConfigKeys.TAGS })}
data-test-subj="syntheticsTags"
/>
</EuiFormRow>
<CommonFields fields={fields} onChange={handleInputChange} validate={validate} />
</>
);
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import React from 'react';
import { FormattedMessage } from '@kbn/i18n/react';
import { EuiFormRow, EuiFieldText, EuiFieldNumber } from '@elastic/eui';
import { ConfigKeys, Validation, ICommonFields } from '../types';
import { ComboBox } from '../combo_box';
import { OptionalLabel } from '../optional_label';

interface Props {
validate: Validation;
fields: ICommonFields;
onChange: ({ value, configKey }: { value: string | string[]; configKey: ConfigKeys }) => void;
}

export function CommonFields({ fields, onChange, validate }: Props) {
return (
<>
<EuiFormRow
label={
<FormattedMessage
id="xpack.uptime.createPackagePolicy.stepConfigure.monitorIntegrationSettingsSection.APMServiceName.label"
defaultMessage="APM service name"
/>
}
labelAppend={<OptionalLabel />}
helpText={
<FormattedMessage
id="xpack.uptime.createPackagePolicy.stepConfigure.monitorIntegrationSettingsSection.APMServiceName.helpText"
defaultMessage="APM service name for this monitor. Corresponds to the service.name ECS field. Set this when monitoring an app that is also using APM to enable integrations between Uptime and APM data in Kibana."
/>
}
>
<EuiFieldText
value={fields[ConfigKeys.APM_SERVICE_NAME]}
onChange={(event) =>
onChange({
value: event.target.value,
configKey: ConfigKeys.APM_SERVICE_NAME,
})
}
data-test-subj="syntheticsAPMServiceName"
/>
</EuiFormRow>
<EuiFormRow
label={
<FormattedMessage
id="xpack.uptime.createPackagePolicy.stepConfigure.monitorIntegrationSettingsSection.timeout.label"
defaultMessage="Timeout in seconds"
/>
}
isInvalid={!!validate[ConfigKeys.TIMEOUT]?.(fields)}
error={
parseInt(fields[ConfigKeys.TIMEOUT], 10) < 0 ? (
<FormattedMessage
id="xpack.uptime.createPackagePolicy.stepConfigure.monitorIntegrationSettingsSection.timeout.moreThanZeroError"
defaultMessage="Timeout must be greater than or equal to 0"
/>
) : (
<FormattedMessage
id="xpack.uptime.createPackagePolicy.stepConfigure.monitorIntegrationSettingsSection.timeout.lessThanIntervalError"
defaultMessage="Timeout must be less than the monitor interval"
/>
)
}
helpText={
<FormattedMessage
id="xpack.uptime.createPackagePolicy.stepConfigure.monitorIntegrationSettingsSection.timeout.helpText"
defaultMessage="The total time allowed for testing the connection and exchanging data."
/>
}
>
<EuiFieldNumber
min={0}
value={fields[ConfigKeys.TIMEOUT]}
onChange={(event) =>
onChange({
value: event.target.value,
configKey: ConfigKeys.TIMEOUT,
})
}
step={'any'}
/>
</EuiFormRow>
<EuiFormRow
label={
<FormattedMessage
id="xpack.uptime.createPackagePolicy.stepConfigure.monitorIntegrationSettingsSection.tags.label"
defaultMessage="Tags"
/>
}
labelAppend={<OptionalLabel />}
helpText={
<FormattedMessage
id="xpack.uptime.createPackagePolicy.stepConfigure.monitorIntegrationSettingsSection.tags.helpText"
defaultMessage="A list of tags that will be sent with the monitor event. Press enter to add a new tag. Displayed in Uptime and enables searching by tag."
/>
}
>
<ComboBox
selectedOptions={fields[ConfigKeys.TAGS]}
onChange={(value) => onChange({ value, configKey: ConfigKeys.TAGS })}
data-test-subj="syntheticsTags"
/>
</EuiFormRow>
</>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ interface IBrowserAdvancedFieldsContextProvider {
export const initialValues: IBrowserAdvancedFields = {
[ConfigKeys.SCREENSHOTS]: ScreenshotOption.ON,
[ConfigKeys.SYNTHETICS_ARGS]: [],
[ConfigKeys.JOURNEY_FILTERS_MATCH]: '',
[ConfigKeys.JOURNEY_FILTERS_TAGS]: [],
[ConfigKeys.IGNORE_HTTPS_ERRORS]: false,
};

const defaultContext: IBrowserAdvancedFieldsContext = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export {
HTTPAdvancedFieldsContextProvider,
initialValues as defaultHTTPAdvancedFields,
useHTTPAdvancedFieldsContext,
} from './advanced_fields_http_context';
} from './http_context_advanced';
export {
TCPSimpleFieldsContext,
TCPSimpleFieldsContextProvider,
Expand All @@ -39,7 +39,7 @@ export {
TCPAdvancedFieldsContextProvider,
initialValues as defaultTCPAdvancedFields,
useTCPAdvancedFieldsContext,
} from './advanced_fields_tcp_context';
} from './tcp_context_advanced';
export {
BrowserSimpleFieldsContext,
BrowserSimpleFieldsContextProvider,
Expand Down
Loading