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

Fix up undefined handling in EP Meta telem task #106269

Merged
merged 3 commits into from
Jul 20, 2021

Conversation

pjhampton
Copy link
Contributor

Summary

QA reported an error log in the snapshot release.

{"type":"log","@timestamp":"2021-07-20T09:29:45+00:00","tags":["error","plugins","taskManager"],"pid":3606,"message":"Task security:endpoint-meta-telemetry \"security:endpoint-meta-telemetry:1.0.0\" failed: TypeError: Cannot read property 'endpoint_agents' of undefined"}

I was able to reproduce. The task manager fires a task run on startup, and this happens where there are no active Endpoint Agents. This is not a new bug and was patched in the initial commit. However, a follow-up PR that made performance improvements regretfully introduced a regression in the guarding case. This PR adds additional safety to the task run.

Asides from the automated testing, I performed the following manual actions:

  1. I started a kibana with the security solution enabled, but no endpoints or fleet agents - (task ran fine)
  2. I started a kibana with the security solution and enrolled an agent - (task ran fine)
  3. I started a kibana with the security solution, enrolled an agent, and applied a policy with endpoint (task ran fine with metrics returned)
  4. I started a kibana with the security solution, enrolled an agent, and applied a policy with endpoint, emptied the data policy response cahce (task ran fine with metrics returned)
  5. I started a kibana with the security solution, enrolled an agent, and applied a policy with endpoint, emptied the data policy response cache + emptid the policy config cache (task ran fine with metrics returned)

Checklist

@pjhampton pjhampton added bug Fixes for quality problems that affect the customer experience v8.0.0 release_note:skip Skip the PR/issue when compiling release notes Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. v7.14.0 v7.15.0 v7.14.1 labels Jul 20, 2021
@pjhampton pjhampton requested a review from a team as a code owner July 20, 2021 14:59
@pjhampton pjhampton self-assigned this Jul 20, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-solution (Team: SecuritySolution)

@pjhampton pjhampton added the auto-backport Deprecated - use backport:version if exact versions are needed label Jul 20, 2021

// If there is no policy responses in the 24h > now then we will continue
const policyResponses =
failedPolicyResponses.aggregations === undefined
Copy link
Contributor

@michaelolo24 michaelolo24 Jul 20, 2021

Choose a reason for hiding this comment

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

Always like to double check, can this be null as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! Updated in be52925

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

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

cc @pjhampton

@pjhampton pjhampton merged commit 34e0983 into master Jul 20, 2021
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jul 20, 2021
* Fix up undefined handling in EP Meta telem task

* Check for null and undef.

* inverse the ternary op.
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jul 20, 2021
* Fix up undefined handling in EP Meta telem task

* Check for null and undef.

* inverse the ternary op.
@kibanamachine
Copy link
Contributor

💚 Backport successful

Status Branch Result
7.14
7.x

The backport PRs will be merged automatically after passing CI.

kibanamachine added a commit that referenced this pull request Jul 20, 2021
* Fix up undefined handling in EP Meta telem task

* Check for null and undef.

* inverse the ternary op.

Co-authored-by: Pete Hampton <pjhampton@users.noreply.github.com>
kibanamachine added a commit that referenced this pull request Jul 20, 2021
* Fix up undefined handling in EP Meta telem task

* Check for null and undef.

* inverse the ternary op.

Co-authored-by: Pete Hampton <pjhampton@users.noreply.github.com>
@spalger spalger deleted the pjhampton/fix-ep-telemetry branch May 8, 2022 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Deprecated - use backport:version if exact versions are needed bug Fixes for quality problems that affect the customer experience release_note:skip Skip the PR/issue when compiling release notes Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. v7.14.0 v7.14.1 v7.15.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants