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

[Actions] avoids setting a default dedupKey on PagerDuty #77773

Merged
merged 12 commits into from
Sep 28, 2020

Conversation

gmmorris
Copy link
Contributor

@gmmorris gmmorris commented Sep 17, 2020

Summary

closes #76908

The PagerDuty Action currently defaults to a dedupKey that's shared between all action executions of the same connector.
To ensure we don't group unrelated executions together this PR avoids setting a default, which means each execution will result in its own incident in PD.

As part of this change we've also made the dedupKey a required field whenever a resolve or acknowledge event_action is chosen. This ensure we don't try to resolve without a dedupKey, which would result in an error in PD.

A migration has been introduced to migrate existing alerts which might not have a dedupKey configured.

Users can set their dedupKey to ensure their executions are grouped and a follow up issue has been created to address this at a unified manner in Alerts.

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@gmmorris gmmorris requested a review from a team as a code owner September 17, 2020 14:42
@gmmorris gmmorris added Feature:Actions release_note:fix Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v7.10.0 v8.0.0 labels Sep 17, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-alerting-services (Team:Alerting Services)

Comment on lines +266 to -269
...omitBy(pick(params, ['timestamp', 'component', 'group', 'class']), isUndefined),
};

if (params.timestamp != null) data.payload.timestamp = params.timestamp;
if (params.component != null) data.payload.component = params.component;
if (params.group != null) data.payload.group = params.group;
if (params.class != null) data.payload.class = params.class;

Copy link
Contributor Author

@gmmorris gmmorris Sep 17, 2020

Choose a reason for hiding this comment

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

I made this change in the interest of making it easier to maintain longer term.
I spent a good few minutes tying to figure out why we were comparing to null a value that can only be String or undefined... I was convinced this was a bug... it took me embarassingly long to notice the != rather than !==.

Damn you Brendan Eich! 😩

To prevent others from going down the same rabbit hole, I've replaced this with an explicit check for undefined. :)

Copy link
Member

Choose a reason for hiding this comment

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

This will change the payload so that previously params that were null were not included in the payload, but now they will, with a value of null. If that's ok with the PagerDuty API, then it's fine with me :-)

@gmmorris
Copy link
Contributor Author

@elasticmachine merge upstream

Copy link
Contributor

@YulNaumenko YulNaumenko left a comment

Choose a reason for hiding this comment

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

LGTM

@gmmorris
Copy link
Contributor Author

@elasticmachine merge upstream

Copy link
Member

@pmuellr pmuellr left a comment

Choose a reason for hiding this comment

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

Code LGTM, but haven't tried it out yet.

For a change like this, I think we need to test a PD action against real PD, with and without a dedup key, make sure the expected things happen. Since we also changed the behavior with null payload properties (now set with a null value, instead of previously not sending the property at all), we should also test setting all of these to null to make sure PD can accept these.

If those manual tests have already been done, I'll change to approve. If not, let' do that, LMK if you need to get set up to test against real PD ...

Comment on lines +266 to -269
...omitBy(pick(params, ['timestamp', 'component', 'group', 'class']), isUndefined),
};

if (params.timestamp != null) data.payload.timestamp = params.timestamp;
if (params.component != null) data.payload.component = params.component;
if (params.group != null) data.payload.group = params.group;
if (params.class != null) data.payload.class = params.class;

Copy link
Member

Choose a reason for hiding this comment

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

This will change the payload so that previously params that were null were not included in the payload, but now they will, with a value of null. If that's ok with the PagerDuty API, then it's fine with me :-)

* master: (45 commits)
  [CSM] Use stacked chart for page views (elastic#78042)
  [Enterprise Search] Fix various plugin states when app has error connecting to Enterprise Search (elastic#78091)
  Remove service map beta badge (elastic#78039)
  [Enterprise Search] Rename "telemetry" to "stats" (elastic#78124)
  [Alerting] optimize calculation of unmuted alert instances (elastic#78021)
  call .destroy on ace when react component unmounts (elastic#78132)
  [Ingest Manager] Fix agent action acknowledgement (elastic#78089)
  [Upgrade Assistant] Rename "telemetry" to "stats" (elastic#78127)
  [Security Solution] Refactor Hosts Kpi to use Search Strategy (elastic#77606)
  Bump backport to 5.6.0 (elastic#78097)
  [Actions] adds a Test Connector tab in the Connectors list (elastic#77365)
  [Uptime] Improve ping chart axis (elastic#77992)
  [TSVB] Fields dropdowns are not populated if one of the indices is missing (elastic#77363)
  [UiActions] Remove duplicate apply filter action  (elastic#77485)
  [APM] Use transaction metrics for transaction error rate (elastic#78009)
  [ES-ARCHIVER] Fix bug when query flag is empty (elastic#77983)
  Edit UI text strings in Integrations and Fleet tabs (elastic#75837)
  [baseline capture] switch to large workers (elastic#78109)
  [SECURITY_SOLUTION] list UI is backwards compatible (elastic#77956)
  [Mappings editor] Add support for point field type (elastic#77543)
  ...
* master: (31 commits)
  skip tests for old pacakge (elastic#78194)
  [Ingest Pipelines] Add url generator for ingest pipelines app (elastic#77872)
  [Lens] Rename "telemetry" to "stats" (elastic#78125)
  [CSM] Url search (elastic#77516)
  [Drilldowns] Config to disable URL Drilldown  (elastic#77887)
  [Lens] Combined histogram/range aggregation for numbers (elastic#76121)
  Remove legacy plugins support (elastic#77599)
  'Auto' interval must be correctly calculated for natural numbers (elastic#77995)
  [CSM] fix ingest data retry order messed up (elastic#78163)
  Add response status helpers (elastic#78006)
  Bump react-beautiful-dnd (elastic#78028)
  [Security Solution][Detection Engine] Bubbles up more error messages from ES queries to the UI (elastic#78004)
  Index pattern  - refactor constructor (elastic#77791)
  Add `xpack.security.sameSiteCookies` to docker allow list (elastic#78192)
  Remove [key: string]: any; from IIndexPattern (elastic#77968)
  Remove requirement for manage_index_templates privilege for Index Management (elastic#77377)
  [Ingest Manager] Agent bulk actions UI (elastic#77690)
  [Metrics UI] Add inventory view timeline (elastic#77804)
  Reporting/Docs: Updates for setting to enable CSV Download (elastic#78101)
  Update to latest rum-react (elastic#78193)
  ...
@gmmorris
Copy link
Contributor Author

@elasticmachine merge upstream

@gmmorris
Copy link
Contributor Author

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

Copy link
Member

@pmuellr pmuellr left a comment

Choose a reason for hiding this comment

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

LGTM

gmmorris added a commit to gmmorris/kibana that referenced this pull request Sep 28, 2020
The PagerDuty Action currently defaults to a dedupKey that's shared between all action executions of the same connector.
To ensure we don't group unrelated executions together this PR avoids setting a default, which means each execution will result in its own incident in PD.

As part of this change we've also made the `dedupKey` a required field whenever a `resolve` or `acknowledge` event_action is chosen. This ensure we don't try to resolve without a dedupKey, which would result in an error in PD.

A migration has been introduced to migrate existing alerts which might not have a `dedupKey` configured.
gmmorris added a commit that referenced this pull request Sep 28, 2020
…8596)

The PagerDuty Action currently defaults to a dedupKey that's shared between all action executions of the same connector.
To ensure we don't group unrelated executions together this PR avoids setting a default, which means each execution will result in its own incident in PD.

As part of this change we've also made the `dedupKey` a required field whenever a `resolve` or `acknowledge` event_action is chosen. This ensure we don't try to resolve without a dedupKey, which would result in an error in PD.

A migration has been introduced to migrate existing alerts which might not have a `dedupKey` configured.
gmmorris added a commit to gmmorris/kibana that referenced this pull request Sep 28, 2020
* master:
  Fix APM lodash imports (elastic#78438)
  Add deprecated message to tile_map and region_map visualizations. (elastic#77683)
  Fix Lens smokescreen flaky tests (elastic#78566)
  updated discover with alt text (elastic#77660)
  Fix types (elastic#78619)
  Update tutorial-visualizing.asciidoc (elastic#76977)
  Update tutorial-discovering.asciidoc (elastic#76976)
  [Search] Error notification alignment (elastic#77788)
  Update tutorial-define-index.asciidoc (elastic#76975)
  [Lens] Fieldless operations (elastic#78080)
  [Usage Collection] [schema] Explicit "array" definition (elastic#78141)
  Update tutorial-define-index.asciidoc (elastic#76973)
  Fix --no-basepath references in doc (elastic#78570)
  Move StubIndexPattern to data plugin and convert to TS. (elastic#78518)
  Index pattern class - remove unused methods (elastic#78538)
  [Security Solution] [ALL] Eliminates all console.error and console.warn from Jest output (elastic#78523)
  [Actions] avoids setting a default dedupKey on PagerDuty (elastic#77773)
  First stab at developer-focussed saved objects docs (elastic#71430)
  remove unnecessary config validations (elastic#78527)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Actions release_note:fix Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v7.10.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Actions] Pager Duty action uses the same default dedupkey for all Alerts when resolving
5 participants