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
Move topology monitoring data fetching into Hooks #6875
Move topology monitoring data fetching into Hooks #6875
Conversation
/retest |
4 similar comments
/retest |
/retest |
/retest |
/retest |
a704038
to
72240c1
Compare
alert.rule.alerts && | ||
alert.rule.alerts.forEach((ruleAlert) => { | ||
delete ruleAlert.activeAt; | ||
}); |
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.
alert.rule.alerts && | |
alert.rule.alerts.forEach((ruleAlert) => { | |
delete ruleAlert.activeAt; | |
}); | |
alert.rule.alerts?.forEach((ruleAlert) => { | |
delete ruleAlert.activeAt; | |
}); |
Wdyt?
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.
eslint doesn't like that
fetchAlerts(); | ||
|
||
return () => { | ||
clearInterval(alertsInterval); |
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.
I don't tested it clearInterval could also clear a timeout, but I think you should use clearTimeout here to make clear that its an update after each successfully response.
clearInterval(alertsInterval); | |
clearTimeout(timeout); |
The second catch could never happen? Could you move the setTimeout to the first then block instead? The only benefit of this multiple then/catches is here to fetch alerts again if the network call was successfully andf the updateMonitroingAlerts callback crashs, or?
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.
Correct. If the update fails we still want to attempt to fetch again.
fetchMetrics(); | ||
|
||
return () => { | ||
clearInterval(metricsInterval); |
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.
Same question here. It's a timeout actually?
const url = getPrometheusURL({ | ||
endpoint: PrometheusEndpoint.RULES, | ||
namespace, | ||
query: `namespace=${namespace}`, | ||
}); |
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.
Here I have a just question, is this change the expected behaviour? I double checked the API calls to the backend, and the query parameter is new here:
Old: /api/prometheus-tenancy/api/v1/rules?namespace=christoph-test
New: /api/prometheus-tenancy/api/v1/rules?namespace=christoph-test&query=namespace%3Dchristoph-test
Is this "okay" or unnecessary?
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.
Right, unnecessary query
prop in metricUtils.ts
/retest |
72240c1
to
e9c636e
Compare
Updated. @jerolimov PTAL |
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.
Verified and tested the Monitoring Alerts and Topology Alerts and it works as expected.
@@ -24,6 +22,7 @@ import { | |||
applyListSort, | |||
} from './monitoring-alerts-utils'; | |||
import './MonitoringAlerts.scss'; | |||
import { usePrometheusRulesPoll } from '@console/internal/components/graphs/prometheus-rules-hook'; |
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.
nit: sort imports.
e9c636e
to
b9a9079
Compare
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.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jeff-phillips-18, rohitkrai03 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Fixes
https://issues.redhat.com/browse/ODC-4987
Description
Create hooks for retrieving prometheus rules and overview alerts and metrics.
Browser conformance:
/kind cleanup