[Connectors][PagerDuty] Edit labels for optional fields and generate docs (#172123)

This commit is contained in:
Lisa Cawley 2023-11-30 11:20:21 -08:00 committed by GitHub
parent 6910845901
commit 462bb3a290
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 128 additions and 41 deletions

View file

@ -31,9 +31,15 @@ image::management/connectors/images/pagerduty-connector.png[PagerDuty connector]
PagerDuty 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.
API URL:: An optional PagerDuty event URL. Defaults to `https://events.pagerduty.com/v2/enqueue`. If you are using the <<action-settings, `xpack.actions.allowedHosts`>> setting, make sure the hostname is added to the allowed hosts.
Integration Key:: A 32 character PagerDuty Integration Key for an integration on a service, also referred to as the routing key.
API URL::
An optional PagerDuty event URL.
Defaults to `https://events.pagerduty.com/v2/enqueue`.
If you are using the <<action-settings,`xpack.actions.allowedHosts`>> setting, make sure the hostname is added to the allowed hosts.
Integration key::
A 32 character PagerDuty Integration Key for an integration on a service, also referred to as the routing key.
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.
[float]
[[pagerduty-action-configuration]]
@ -80,17 +86,39 @@ image::management/connectors/images/pagerduty-trigger-test.png[PagerDuty params
This action has the following properties:
Severity:: The perceived severity of on the affected system. This can be one of `Critical`, `Error`, `Warning` or `Info`(default).
Event action:: One of `Trigger` (default), `Resolve`, or `Acknowledge`. See https://v2.developer.pagerduty.com/docs/events-api-v2#event-action[event action] for more details.
Dedup Key:: All actions sharing this key will be associated with the same PagerDuty alert. This value is used to correlate trigger and resolution. This value is optional, and if not set, defaults to `<rule ID>:<alert ID>`. The maximum length is 255 characters. See https://v2.developer.pagerduty.com/docs/events-api-v2#alert-de-duplication[alert deduplication] for details.
Class::
An optional value indicating the class/type of the event, for example `ping failure` or `cpu load`.
Component::
An optional value indicating the component of the source machine that is responsible for the event, for example `mysql` or `eth0`.
Custom details::
An optional set of additional details to add to the event.
DedupKey::
All actions sharing this key will be associated with the same PagerDuty alert.
This value is used to correlate trigger and resolution.
This value is optional, and if not set, defaults to `<rule ID>:<alert ID>`.
The maximum length is 255 characters. See https://v2.developer.pagerduty.com/docs/events-api-v2#alert-de-duplication[alert deduplication] for details.
+
By default, when you create rules that use the PagerDuty connector, the de-duplication key is used to create a new PagerDuty incident for each alert and reuse the incident when a recovered alert reactivates.
Timestamp:: An optional https://v2.developer.pagerduty.com/v2/docs/types#datetime[ISO-8601 format date-time], indicating the time the event was detected or generated.
Component:: An optional value indicating the component of the source machine that is responsible for the event, for example `mysql` or `eth0`.
Group:: An optional value indicating the logical grouping of components of a service, for example `app-stack`.
Source:: An optional value indicating the affected system, preferably a hostname or fully qualified domain name. Defaults to the {kib} saved object id of the action.
Summary:: An optional text summary of the event, defaults to `No summary provided`. The maximum length is 1024 characters.
Class:: An optional value indicating the class/type of the event, for example `ping failure` or `cpu load`.
Event action::
One of `Trigger` (default), `Resolve`, or `Acknowledge`.
See https://v2.developer.pagerduty.com/docs/events-api-v2#event-action[event action] for more details.
Group::
An optional value indicating the logical grouping of components of a service, for example `app-stack`.
Links::
An optional list of links to add to the event.
You must provide a URL and plain text description for each link.
Severity::
The perceived severity of on the affected system.
This can be one of `Critical`, `Error`, `Warning` or `Info`(default).
Source::
An optional value indicating the affected system, preferably a hostname or fully qualified domain name.
Defaults to the {kib} saved object id of the action.
Summary::
An optional text summary of the event, defaults to `No summary provided`.
The maximum length is 1024 characters.
Timestamp::
An optional https://v2.developer.pagerduty.com/v2/docs/types#datetime[ISO-8601 format date-time], indicating the time the event was detected or generated.
For more details on these properties, see https://v2.developer.pagerduty.com/v2/docs/send-an-event-events-api-v2[PagerDuty v2 event parameters].

Binary file not shown.

Before

Width:  |  Height:  |  Size: 140 KiB

After

Width:  |  Height:  |  Size: 141 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 129 KiB

After

Width:  |  Height:  |  Size: 149 KiB

Before After
Before After

View file

@ -13,6 +13,7 @@ import {
EuiFlexItem,
EuiFormRow,
EuiSpacer,
EuiText,
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import {
@ -20,6 +21,7 @@ import {
TextFieldWithMessageVariables,
} from '@kbn/triggers-actions-ui-plugin/public';
import { PagerDutyActionParams } from '../types';
import { OPTIONAL_LABEL } from './translations';
type LinksListProps = Pick<
ActionParamsProps<PagerDutyActionParams>,
@ -40,8 +42,13 @@ export const LinksList: React.FC<LinksListProps> = ({
<EuiFormRow
id="pagerDutyLinks"
label={i18n.translate('xpack.stackConnectors.components.pagerDuty.linksFieldLabel', {
defaultMessage: 'Links (optional)',
defaultMessage: 'Links',
})}
labelAppend={
<EuiText size="xs" color="subdued">
{OPTIONAL_LABEL}
</EuiText>
}
isInvalid={areLinksInvalid}
error={errors.links}
fullWidth

View file

@ -6,7 +6,7 @@
*/
import React from 'react';
import { EuiLink } from '@elastic/eui';
import { EuiLink, EuiText } from '@elastic/eui';
import { isEmpty } from 'lodash';
import { FormattedMessage } from '@kbn/i18n-react';
import { FieldConfig, UseField } from '@kbn/es-ui-shared-plugin/static/forms/hook_form_lib';
@ -21,6 +21,11 @@ const { emptyField, urlField } = fieldValidators;
const getApiURLConfig = (): FieldConfig => ({
label: i18n.API_URL_LABEL,
labelAppend: (
<EuiText size="xs" color="subdued">
{i18n.OPTIONAL_LABEL}
</EuiText>
),
validations: [
{
validator: (args) => {

View file

@ -12,6 +12,7 @@ import {
EuiFormRow,
EuiSelect,
EuiSpacer,
EuiText,
useEuiTheme,
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
@ -23,6 +24,7 @@ import {
import { TextFieldWithMessageVariables } from '@kbn/triggers-actions-ui-plugin/public';
import { PagerDutyActionParams } from '../types';
import { LinksList } from './links_list';
import { OPTIONAL_LABEL } from './translations';
const PagerDutyParamsFields: React.FunctionComponent<ActionParamsProps<PagerDutyActionParams>> = ({
actionParams,
@ -154,20 +156,18 @@ const PagerDutyParamsFields: React.FunctionComponent<ActionParamsProps<PagerDuty
fullWidth
error={errors.dedupKey}
isInvalid={isDedupKeyInvalid}
label={
isDedupeKeyRequired
? i18n.translate(
'xpack.stackConnectors.components.pagerDuty.dedupKeyTextRequiredFieldLabel',
{
defaultMessage: 'DedupKey',
}
)
: i18n.translate(
'xpack.stackConnectors.components.pagerDuty.dedupKeyTextFieldLabel',
{
defaultMessage: 'DedupKey (optional)',
}
)
label={i18n.translate(
'xpack.stackConnectors.components.pagerDuty.dedupKeyTextFieldLabel',
{
defaultMessage: 'DedupKey',
}
)}
labelAppend={
isDedupeKeyRequired ? null : (
<EuiText size="xs" color="subdued">
{OPTIONAL_LABEL}
</EuiText>
)
}
>
<TextFieldWithMessageVariables
@ -209,9 +209,14 @@ const PagerDutyParamsFields: React.FunctionComponent<ActionParamsProps<PagerDuty
label={i18n.translate(
'xpack.stackConnectors.components.pagerDuty.severitySelectFieldLabel',
{
defaultMessage: 'Severity (optional)',
defaultMessage: 'Severity',
}
)}
labelAppend={
<EuiText size="xs" color="subdued">
{OPTIONAL_LABEL}
</EuiText>
}
>
<EuiSelect
fullWidth
@ -233,9 +238,14 @@ const PagerDutyParamsFields: React.FunctionComponent<ActionParamsProps<PagerDuty
label={i18n.translate(
'xpack.stackConnectors.components.pagerDuty.timestampTextFieldLabel',
{
defaultMessage: 'Timestamp (optional)',
defaultMessage: 'Timestamp',
}
)}
labelAppend={
<EuiText size="xs" color="subdued">
{OPTIONAL_LABEL}
</EuiText>
}
>
<TextFieldWithMessageVariables
index={index}
@ -254,9 +264,14 @@ const PagerDutyParamsFields: React.FunctionComponent<ActionParamsProps<PagerDuty
label={i18n.translate(
'xpack.stackConnectors.components.pagerDuty.componentTextFieldLabel',
{
defaultMessage: 'Component (optional)',
defaultMessage: 'Component',
}
)}
labelAppend={
<EuiText size="xs" color="subdued">
{OPTIONAL_LABEL}
</EuiText>
}
>
<TextFieldWithMessageVariables
index={index}
@ -271,9 +286,14 @@ const PagerDutyParamsFields: React.FunctionComponent<ActionParamsProps<PagerDuty
label={i18n.translate(
'xpack.stackConnectors.components.pagerDuty.groupTextFieldLabel',
{
defaultMessage: 'Group (optional)',
defaultMessage: 'Group',
}
)}
labelAppend={
<EuiText size="xs" color="subdued">
{OPTIONAL_LABEL}
</EuiText>
}
>
<TextFieldWithMessageVariables
index={index}
@ -288,9 +308,14 @@ const PagerDutyParamsFields: React.FunctionComponent<ActionParamsProps<PagerDuty
label={i18n.translate(
'xpack.stackConnectors.components.pagerDuty.sourceTextFieldLabel',
{
defaultMessage: 'Source (optional)',
defaultMessage: 'Source',
}
)}
labelAppend={
<EuiText size="xs" color="subdued">
{OPTIONAL_LABEL}
</EuiText>
}
>
<TextFieldWithMessageVariables
index={index}
@ -304,8 +329,13 @@ const PagerDutyParamsFields: React.FunctionComponent<ActionParamsProps<PagerDuty
id="pagerDutyClass"
fullWidth
label={i18n.translate('xpack.stackConnectors.components.pagerDuty.classFieldLabel', {
defaultMessage: 'Class (optional)',
defaultMessage: 'Class',
})}
labelAppend={
<EuiText size="xs" color="subdued">
{OPTIONAL_LABEL}
</EuiText>
}
>
<TextFieldWithMessageVariables
index={index}
@ -315,7 +345,15 @@ const PagerDutyParamsFields: React.FunctionComponent<ActionParamsProps<PagerDuty
inputTargetValue={actionParams.class}
/>
</EuiFormRow>
<EuiFormRow id="pagerDutyCustomDetails" fullWidth>
<EuiFormRow
id="pagerDutyCustomDetails"
fullWidth
labelAppend={
<EuiText size="xs" color="subdued">
{OPTIONAL_LABEL}
</EuiText>
}
>
<JsonEditorWithMessageVariables
messageVariables={messageVariables}
paramsProperty={'customDetails'}
@ -324,7 +362,7 @@ const PagerDutyParamsFields: React.FunctionComponent<ActionParamsProps<PagerDuty
label={i18n.translate(
'xpack.stackConnectors.components.pagerDuty.customDetailsFieldLabel',
{
defaultMessage: 'Custom Details (optional)',
defaultMessage: 'Custom details',
}
)}
onDocumentsChange={(json: string) => {

View file

@ -31,7 +31,7 @@ export const INTEGRATION_KEY_REQUIRED = i18n.translate(
export const API_URL_LABEL = i18n.translate(
'xpack.stackConnectors.components.pagerDuty.apiUrlTextFieldLabel',
{
defaultMessage: 'API URL (optional)',
defaultMessage: 'API URL',
}
);
@ -48,3 +48,10 @@ export const INTEGRATION_KEY_LABEL = i18n.translate(
defaultMessage: 'Integration key',
}
);
export const OPTIONAL_LABEL = i18n.translate(
'xpack.stackConnectors.components.pagerDuty.optionalLabel',
{
defaultMessage: 'Optional',
}
);

View file

@ -38716,7 +38716,6 @@
"xpack.stackConnectors.components.pagerDuty.componentTextFieldLabel": "Composant (facultatif)",
"xpack.stackConnectors.components.pagerDuty.connectorTypeTitle": "Envoyer à PagerDuty",
"xpack.stackConnectors.components.pagerDuty.dedupKeyTextFieldLabel": "DedupKey (facultatif)",
"xpack.stackConnectors.components.pagerDuty.dedupKeyTextRequiredFieldLabel": "DedupKey",
"xpack.stackConnectors.components.pagerDuty.error.requiredDedupKeyText": "DedupKey est requis lors de la résolution ou de la reconnaissance d'un incident.",
"xpack.stackConnectors.components.pagerDuty.error.requiredRoutingKeyText": "Une clé d'intégration / clé de routage est requise.",
"xpack.stackConnectors.components.pagerDuty.error.requiredSummaryText": "Le résumé est requis.",

View file

@ -38715,7 +38715,6 @@
"xpack.stackConnectors.components.pagerDuty.componentTextFieldLabel": "コンポーネント(任意)",
"xpack.stackConnectors.components.pagerDuty.connectorTypeTitle": "PagerDuty に送信",
"xpack.stackConnectors.components.pagerDuty.dedupKeyTextFieldLabel": "DedupKey任意",
"xpack.stackConnectors.components.pagerDuty.dedupKeyTextRequiredFieldLabel": "DedupKey",
"xpack.stackConnectors.components.pagerDuty.error.requiredDedupKeyText": "インシデントを解決または確認するときには、DedupKeyが必要です。",
"xpack.stackConnectors.components.pagerDuty.error.requiredRoutingKeyText": "統合キー/ルーティングキーが必要です。",
"xpack.stackConnectors.components.pagerDuty.error.requiredSummaryText": "概要が必要です。",

View file

@ -38708,7 +38708,6 @@
"xpack.stackConnectors.components.pagerDuty.componentTextFieldLabel": "组件(可选)",
"xpack.stackConnectors.components.pagerDuty.connectorTypeTitle": "发送到 PagerDuty",
"xpack.stackConnectors.components.pagerDuty.dedupKeyTextFieldLabel": "DedupKey可选",
"xpack.stackConnectors.components.pagerDuty.dedupKeyTextRequiredFieldLabel": "DedupKey",
"xpack.stackConnectors.components.pagerDuty.error.requiredDedupKeyText": "解决或确认事件时需要 DedupKey。",
"xpack.stackConnectors.components.pagerDuty.error.requiredRoutingKeyText": "需要集成密钥/路由密钥。",
"xpack.stackConnectors.components.pagerDuty.error.requiredSummaryText": "“摘要”必填。",

View file

@ -30,7 +30,12 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await testSubjects.click('create-connector-flyout-save-test-btn');
await testSubjects.click('toastCloseButton');
await testSubjects.setValue('eventActionSelect', 'trigger');
await commonScreenshots.takeScreenshot('pagerduty-trigger-test', screenshotDirectories);
await commonScreenshots.takeScreenshot(
'pagerduty-trigger-test',
screenshotDirectories,
1400,
1600
);
await testSubjects.setValue('eventActionSelect', 'resolve');
await commonScreenshots.takeScreenshot('pagerduty-resolve-test', screenshotDirectories);
await testSubjects.setValue('eventActionSelect', 'acknowledge');