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

Move topology monitoring data fetching into Hooks #6875

Merged

Conversation

jeff-phillips-18
Copy link
Member

Fixes
https://issues.redhat.com/browse/ODC-4987

Description
Create hooks for retrieving prometheus rules and overview alerts and metrics.

Browser conformance:

  • Chrome
  • Firefox
  • Safari
  • Edge

/kind cleanup

@openshift-ci-robot openshift-ci-robot added the kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. label Oct 8, 2020
@openshift-ci-robot openshift-ci-robot added component/core Related to console core functionality component/dev-console Related to dev-console labels Oct 8, 2020
@openshift-ci-robot openshift-ci-robot added the component/monitoring Related to monitoring label Oct 8, 2020
@jeff-phillips-18 jeff-phillips-18 changed the title Topology monitoring Move topology monitoring data fetching into Hooks Oct 8, 2020
@jeff-phillips-18
Copy link
Member Author

/retest

4 similar comments
@invincibleJai
Copy link
Member

/retest

@jeff-phillips-18
Copy link
Member Author

/retest

@jeff-phillips-18
Copy link
Member Author

/retest

@jeff-phillips-18
Copy link
Member Author

/retest

Comment on lines +49 to +52
alert.rule.alerts &&
alert.rule.alerts.forEach((ruleAlert) => {
delete ruleAlert.activeAt;
});
Copy link
Member

@jerolimov jerolimov Oct 9, 2020

Choose a reason for hiding this comment

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

Suggested change
alert.rule.alerts &&
alert.rule.alerts.forEach((ruleAlert) => {
delete ruleAlert.activeAt;
});
alert.rule.alerts?.forEach((ruleAlert) => {
delete ruleAlert.activeAt;
});

Wdyt?

Copy link
Member Author

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);
Copy link
Member

@jerolimov jerolimov Oct 9, 2020

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.

Suggested change
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?

Copy link
Member Author

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);
Copy link
Member

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?

Comment on lines 6 to 9
const url = getPrometheusURL({
endpoint: PrometheusEndpoint.RULES,
namespace,
query: `namespace=${namespace}`,
});
Copy link
Member

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?

Copy link
Member Author

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

@jeff-phillips-18
Copy link
Member Author

/retest

@jeff-phillips-18
Copy link
Member Author

Updated. @jerolimov PTAL

Copy link
Member

@vikram-raj vikram-raj left a 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';
Copy link
Member

Choose a reason for hiding this comment

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

nit: sort imports.

Copy link
Contributor

@rohitkrai03 rohitkrai03 left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 20, 2020
@openshift-ci-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 20, 2020
@openshift-merge-robot openshift-merge-robot merged commit e010963 into openshift:master Oct 20, 2020
@spadgett spadgett added this to the v4.7 milestone Oct 21, 2020
@jeff-phillips-18 jeff-phillips-18 deleted the topology-monitoring branch December 2, 2020 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. component/core Related to console core functionality component/dev-console Related to dev-console component/monitoring Related to monitoring kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants