Skip to content

Improve error logs for task manager poller#197635

Merged
mikecote merged 3 commits intoelastic:mainfrom
mikecote:task-manager/fix-polling-error-logs
Oct 25, 2024
Merged

Improve error logs for task manager poller#197635
mikecote merged 3 commits intoelastic:mainfrom
mikecote:task-manager/fix-polling-error-logs

Conversation

@mikecote
Copy link
Copy Markdown
Contributor

@mikecote mikecote commented Oct 24, 2024

I noticed some scenarios we see error logs from the task poller like Failed to poll for work: undefined making me think err.message is empty in some situations. I'm modifying the code to handle string situations if ever they occur by performing err.message || err and to also include a stack trace when strings are passed-in.

@mikecote mikecote added Feature:Task Manager Team:ResponseOps Platform ResponseOps team (formerly the Cases and Alerting teams) t// v9.0.0 backport:prev-minor v8.16.0 v8.17.0 labels Oct 24, 2024
@mikecote mikecote self-assigned this Oct 24, 2024
@mikecote mikecote requested a review from a team as a code owner October 24, 2024 13:08
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/response-ops (Team:ResponseOps)

@mikecote mikecote added the release_note:skip Skip the PR/issue when compiling release notes label Oct 24, 2024
Co-authored-by: Patrick Mueller <patrick.mueller@elastic.co>
Copy link
Copy Markdown
Contributor

@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

Happened to think, once the new Error(\${err}`)` gets thrown, the stack trace will lead back to this function, rather than whoever sent the error (which the other case will do). But, we'd never be able to get THAT stack trace anyway, since apparently it's not an Error. Hoping 🤞🏻 that the "new" message in there will help us pinpoint where it's coming from though. Think it's be best we can do for now ...

@mikecote
Copy link
Copy Markdown
Contributor Author

Happened to think, once the new Error(${err}) gets thrown, the stack trace will lead back to this function, rather than whoever sent the error (which the other case will do). But, we'd never be able to get THAT stack trace anyway, since apparently it's not an Error. Hoping 🤞🏻 that the "new" message in there will help us pinpoint where it's coming from though. Think it's be best we can do for now ...

@pmuellr yeah hopefully it can help a bit knowing the stack trace and where it was dropped so we can improve on that 🤞

@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

cc @mikecote

@mikecote mikecote merged commit 81b63c6 into elastic:main Oct 25, 2024
@kibanamachine
Copy link
Copy Markdown
Contributor

Starting backport for target branches: 8.16, 8.x

https://github.com/elastic/kibana/actions/runs/11517132514

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Oct 25, 2024
I noticed some scenarios we see error logs from the task poller like
`Failed to poll for work: undefined` making me think `err.message` is
empty in some situations. I'm modifying the code to handle string
situations if ever they occur by performing `err.message || err` and to
also include a stack trace when strings are passed-in.

---------

Co-authored-by: Patrick Mueller <patrick.mueller@elastic.co>
(cherry picked from commit 81b63c6)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Oct 25, 2024
I noticed some scenarios we see error logs from the task poller like
`Failed to poll for work: undefined` making me think `err.message` is
empty in some situations. I'm modifying the code to handle string
situations if ever they occur by performing `err.message || err` and to
also include a stack trace when strings are passed-in.

---------

Co-authored-by: Patrick Mueller <patrick.mueller@elastic.co>
(cherry picked from commit 81b63c6)
@kibanamachine
Copy link
Copy Markdown
Contributor

💚 All backports created successfully

Status Branch Result
8.16
8.x

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Oct 25, 2024
# Backport

This will backport the following commits from `main` to `8.x`:
- [Improve error logs for task manager poller
(#197635)](#197635)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Mike
Côté","email":"mikecote@users.noreply.github.com"},"sourceCommit":{"committedDate":"2024-10-25T11:12:44Z","message":"Improve
error logs for task manager poller (#197635)\n\nI noticed some scenarios
we see error logs from the task poller like\r\n`Failed to poll for work:
undefined` making me think `err.message` is\r\nempty in some situations.
I'm modifying the code to handle string\r\nsituations if ever they occur
by performing `err.message || err` and to\r\nalso include a stack trace
when strings are passed-in.\r\n\r\n---------\r\n\r\nCo-authored-by:
Patrick Mueller
<patrick.mueller@elastic.co>","sha":"81b63c60eb6d1fe623f2e177cd55d2f285f79590","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Feature:Task
Manager","Team:ResponseOps","v9.0.0","backport:prev-minor","v8.16.0","v8.17.0"],"title":"Improve
error logs for task manager
poller","number":197635,"url":"https://github.com/elastic/kibana/pull/197635","mergeCommit":{"message":"Improve
error logs for task manager poller (#197635)\n\nI noticed some scenarios
we see error logs from the task poller like\r\n`Failed to poll for work:
undefined` making me think `err.message` is\r\nempty in some situations.
I'm modifying the code to handle string\r\nsituations if ever they occur
by performing `err.message || err` and to\r\nalso include a stack trace
when strings are passed-in.\r\n\r\n---------\r\n\r\nCo-authored-by:
Patrick Mueller
<patrick.mueller@elastic.co>","sha":"81b63c60eb6d1fe623f2e177cd55d2f285f79590"}},"sourceBranch":"main","suggestedTargetBranches":["8.16","8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/197635","number":197635,"mergeCommit":{"message":"Improve
error logs for task manager poller (#197635)\n\nI noticed some scenarios
we see error logs from the task poller like\r\n`Failed to poll for work:
undefined` making me think `err.message` is\r\nempty in some situations.
I'm modifying the code to handle string\r\nsituations if ever they occur
by performing `err.message || err` and to\r\nalso include a stack trace
when strings are passed-in.\r\n\r\n---------\r\n\r\nCo-authored-by:
Patrick Mueller
<patrick.mueller@elastic.co>","sha":"81b63c60eb6d1fe623f2e177cd55d2f285f79590"}},{"branch":"8.16","label":"v8.16.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.x","label":"v8.17.0","branchLabelMappingKey":"^v8.17.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Mike Côté <mikecote@users.noreply.github.com>
kibanamachine added a commit that referenced this pull request Oct 25, 2024
# Backport

This will backport the following commits from `main` to `8.16`:
- [Improve error logs for task manager poller
(#197635)](#197635)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Mike
Côté","email":"mikecote@users.noreply.github.com"},"sourceCommit":{"committedDate":"2024-10-25T11:12:44Z","message":"Improve
error logs for task manager poller (#197635)\n\nI noticed some scenarios
we see error logs from the task poller like\r\n`Failed to poll for work:
undefined` making me think `err.message` is\r\nempty in some situations.
I'm modifying the code to handle string\r\nsituations if ever they occur
by performing `err.message || err` and to\r\nalso include a stack trace
when strings are passed-in.\r\n\r\n---------\r\n\r\nCo-authored-by:
Patrick Mueller
<patrick.mueller@elastic.co>","sha":"81b63c60eb6d1fe623f2e177cd55d2f285f79590","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Feature:Task
Manager","Team:ResponseOps","v9.0.0","backport:prev-minor","v8.16.0","v8.17.0"],"title":"Improve
error logs for task manager
poller","number":197635,"url":"https://github.com/elastic/kibana/pull/197635","mergeCommit":{"message":"Improve
error logs for task manager poller (#197635)\n\nI noticed some scenarios
we see error logs from the task poller like\r\n`Failed to poll for work:
undefined` making me think `err.message` is\r\nempty in some situations.
I'm modifying the code to handle string\r\nsituations if ever they occur
by performing `err.message || err` and to\r\nalso include a stack trace
when strings are passed-in.\r\n\r\n---------\r\n\r\nCo-authored-by:
Patrick Mueller
<patrick.mueller@elastic.co>","sha":"81b63c60eb6d1fe623f2e177cd55d2f285f79590"}},"sourceBranch":"main","suggestedTargetBranches":["8.16","8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/197635","number":197635,"mergeCommit":{"message":"Improve
error logs for task manager poller (#197635)\n\nI noticed some scenarios
we see error logs from the task poller like\r\n`Failed to poll for work:
undefined` making me think `err.message` is\r\nempty in some situations.
I'm modifying the code to handle string\r\nsituations if ever they occur
by performing `err.message || err` and to\r\nalso include a stack trace
when strings are passed-in.\r\n\r\n---------\r\n\r\nCo-authored-by:
Patrick Mueller
<patrick.mueller@elastic.co>","sha":"81b63c60eb6d1fe623f2e177cd55d2f285f79590"}},{"branch":"8.16","label":"v8.16.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.x","label":"v8.17.0","branchLabelMappingKey":"^v8.17.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Mike Côté <mikecote@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature:Task Manager release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Platform ResponseOps team (formerly the Cases and Alerting teams) t// v8.16.0 v8.17.0 v9.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants