-
Notifications
You must be signed in to change notification settings - Fork 667
Make prometheus poll more generic, only handle one prometheus query #1596
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
Make prometheus poll more generic, only handle one prometheus query #1596
Conversation
spadgett
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 nice work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
555431c to
81ee4ef
Compare
| return () => controller.current.abort(); | ||
| }, []); | ||
|
|
||
| return (url) => coFetchJSON(url, 'get', {signal: controller.current.signal}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really awesome. Would be nice to have a unit test for it, you can check out some of the other unit tests for hooks that we've written. Also, we may want to use this for other HTTP methods in the future, but not needed now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding a unit test for this would be nice, but I went ahead and added lgtm since this PR is blocking some other graph work.
kyoto
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @TheRealJon. The code looks good to me and I also tested locally.
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: kyoto, TheRealJon The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/retest |
2 similar comments
|
/retest |
|
/retest |
|
/retest Please review the full test history for this PR and help us cut down flakes. |
|
/retest |
|
/retest Please review the full test history for this PR and help us cut down flakes. |
1 similar comment
|
/retest Please review the full test history for this PR and help us cut down flakes. |
Improve Prometheus poll hook.
useSafeFetchhook - uses anAbortControllerto terminate pending fetches on unmount.