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

Added alert banner in netobserv page #286

Merged
merged 13 commits into from
Feb 9, 2023

Conversation

OlivierCazade
Copy link
Collaborator

Request monitoring API and display banners if netobserv alerts are firing.

image

Comment on lines +55 to +57
<AlertFetcher>
<NetflowTraffic forcedFilters={null} />
</AlertFetcher>
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if this should be here or inside netflow-traffic.tsx. The tabs will not show the alerts as is. Is it the expected behavior ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was intended to not have this in the tabs, I thought it would not fit in the tab view.

You think we should add it there too?

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know the console behavior in this case. May @andrew-ronaldson has a better knowledge ?

setAlerts(
result.data.groups.flatMap(group => {
return group.rules
.filter(rule => !!rule.labels.namespace && rule.labels.namespace == 'netobserv' && rule.state == 'firing')
Copy link
Contributor

Choose a reason for hiding this comment

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

'netobserv' should come from config here ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I added configuration through the frontend config endpoint, thanks!

web/src/components/alerts/banner.tsx Outdated Show resolved Hide resolved
web/src/components/alerts/banner.tsx Show resolved Hide resolved
web/src/components/alerts/banner.tsx Show resolved Hide resolved
export const AlertFetcher: React.FC<AlertFetcherProps> = ({ children }) => {
const [alerts, setAlerts] = React.useState<AlertsRule[]>([]);
React.useEffect(() => {
getAlerts().then(result => {
Copy link
Contributor

Choose a reason for hiding this comment

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

we should also catch errors and at least log it in the console

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done, thanks!

rules: AlertsRule[];
}

export interface AlertsRule {
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done, thanks!

Copy link
Contributor

@jpinsonneau jpinsonneau left a comment

Choose a reason for hiding this comment

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

👍 LGTM, thanks @OlivierCazade

@OlivierCazade
Copy link
Collaborator Author

/approve

@openshift-ci
Copy link

openshift-ci bot commented Feb 9, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: OlivierCazade

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 openshift-ci bot added the approved label Feb 9, 2023
@openshift-merge-robot openshift-merge-robot merged commit 450b797 into netobserv:main Feb 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants