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

[Fleet] Fix agent action observable for long polling #81376

Merged
merged 3 commits into from
Oct 22, 2020

Conversation

nchaulet
Copy link
Member

@nchaulet nchaulet commented Oct 21, 2020

Summary

Partially resolve #80930

The policy reassign is relying on fetching INTERNAL_POLICY_REASSIGN action, but looks like there is some race condition that can cause the action to not been fetched.

This PR fix it and add some unit test.

Details

  • I changed a switchMap to an exhaustMap so if the function getNewActionsSince take more than 5 seconds we do not loose actions.
  • I used the last action we fetched creation date as the the timestamp for getNewActionsSince instead of the last time we fetched data, as it's looks like the created_at date will be available to search in elastic after the document is created in Kibana

@nchaulet nchaulet added bug Fixes for quality problems that affect the customer experience v8.0.0 v7.10.0 Team:Fleet Team label for Observability Data Collection Fleet team v7.11.0 labels Oct 21, 2020
@nchaulet nchaulet requested a review from a team October 21, 2020 18:46
@nchaulet nchaulet self-assigned this Oct 21, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/ingest-management (Team:Ingest Management)

@@ -247,11 +247,16 @@ export async function getNewActionsSince(
nodeTypes.literal.buildNode(false),
])
),
nodeTypes.function.buildNodeWithArgumentNodes('is', [
Copy link
Member Author

Choose a reason for hiding this comment

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

added this condition to not fetch POLICY_CHANGE here, (the action was filtered in the code after) but in my opinion the earlier we filter it the better it is

@nchaulet nchaulet force-pushed the fix-agent-action-long-polling branch from b177026 to 12f99ce Compare October 21, 2020 19:10
@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

  • 💔 Build #83172 failed b17702631e1598974fc5b17a9ebee2221b7bce82

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

@nchaulet nchaulet merged commit 8e34546 into elastic:master Oct 22, 2020
@nchaulet nchaulet deleted the fix-agent-action-long-polling branch October 22, 2020 00:52
nchaulet added a commit to nchaulet/kibana that referenced this pull request Oct 22, 2020
nchaulet added a commit to nchaulet/kibana that referenced this pull request Oct 22, 2020
gmmorris added a commit to gmmorris/kibana that referenced this pull request Oct 22, 2020
* master: (63 commits)
  [KP] Fix Headers timeout issue (elastic#81140)
  [ML] Functional tests - stabilize typing with checks service method (elastic#81338)
  tabify - support docs (elastic#80351)
  [Security Solution][Detections] Look-back time logic fix (elastic#81383)
  [Workplace Search] Add top-level tests for Groups (elastic#81215)
  [Fleet] Fix agent action observable for long polling (elastic#81376)
  [Maps] fix feature tooltip remains open when zoom level change hides layer (elastic#81373)
  skip flaky suite (elastic#78689)
  chore(NA): add spec-to-console and plugin-helpers as devOnly dependencies (elastic#81357)
  Ensure some data is returned (elastic#81375)
  Change dumb-init to tini (elastic#81126)
  [Reporting/Tech Debt] Convert PdfMaker class to TypeScript (elastic#81242)
  Use Storybook Controls instead of Knobs (elastic#80705)
  [junit] make sure that report paths are unique (elastic#81255)
  bump elastic/elasticsearch-js version to 7.10.0-rc1 (elastic#81288)
  run ssl tests on CI (elastic#81320)
  Fix alert defaults (elastic#81207)
  [ML] DF Analytics wizard: ensure user can set mml manually or select to use given estimate (elastic#81078)
  Add UI notifier to indicate secret fields and to remember / reenter values (elastic#80657)
  [Monitoring] Use async/await (elastic#81200)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience release_note:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team v7.10.0 v7.11.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Fleet] Fleet takes 10 minutes from install of Agent & policy change to show Endpoint state 'Running'
4 participants