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

NETOBSERV-1185 Console plugin async overview metrics #389

Merged
merged 3 commits into from
Oct 5, 2023

Conversation

jpinsonneau
Copy link
Contributor

@jpinsonneau jpinsonneau commented Sep 13, 2023

This PR improve Overview panel loading & code:

  • Renamed records & metrics routes to
    • /loki/flow/records
    • /loki/flow/metrics
  • Show graphs as soon as metrics are available
  • Keep previously loaded graph dimensions in local storage
  • Reduce number of queries according to selected panels / features
  • Add number of queries in summary
  • Fix testing

You can either check the number of queries in the side panel or in your browser debug -> network section to test this 🤓

*/!\ QE automated tests might break since the API route has been renamed and loading behavior changed /!*

@codecov
Copy link

codecov bot commented Sep 13, 2023

Codecov Report

Attention: 18 lines in your changes are missing coverage. Please review.

Comparison is base (62bdb9d) 56.69% compared to head (ebc3c45) 57.64%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #389      +/-   ##
==========================================
+ Coverage   56.69%   57.64%   +0.94%     
==========================================
  Files          29      169     +140     
  Lines        2025     7977    +5952     
  Branches        0      968     +968     
==========================================
+ Hits         1148     4598    +3450     
- Misses        761     3103    +2342     
- Partials      116      276     +160     
Flag Coverage Δ
uitests 58.68% <86.44%> (?)
unittests 54.71% <50.00%> (-1.98%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
pkg/server/routes.go 89.65% <100.00%> (ø)
web/src/api/loki.ts 100.00% <100.00%> (ø)
web/src/components/__tests-data__/config.ts 100.00% <100.00%> (ø)
web/src/components/__tests-data__/flows.ts 100.00% <100.00%> (ø)
web/src/components/metrics/metrics-content.tsx 86.66% <100.00%> (ø)
...b/src/components/metrics/metrics-total-content.tsx 93.10% <100.00%> (ø)
web/src/components/metrics/stat-donut.tsx 68.29% <100.00%> (ø)
...c/components/netflow-overview/netflow-overview.tsx 70.00% <ø> (ø)
...c/components/query-summary/flows-query-summary.tsx 96.15% <100.00%> (ø)
...components/query-summary/metrics-query-summary.tsx 61.76% <100.00%> (ø)
... and 11 more

... and 121 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

import { NamedMetric } from '../../api/loki';
import { MetricType } from '../../model/flow-query';
import { LOCAL_STORAGE_OVERVIEW_METRICS_DIMENSION_KEY, useLocalStorage } from '../../utils/local-storage-hook';
Copy link
Member

Choose a reason for hiding this comment

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

Side remark: We might want to use some formatting tool to organize import automatically like we have on the go side
E.g. https://medium.com/weekly-webtips/how-to-sort-imports-like-a-pro-in-typescript-4ee8afd7258a

Copy link
Contributor Author

Choose a reason for hiding this comment

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

return res.stats;
})
];
if (!selectedPanels.some(p => [DROPPED_ID_MATCHER, DNS_ID_MATCHER, RTT_ID_MATCHER].includes(p.id))) {
Copy link
Member

Choose a reason for hiding this comment

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

not sure to understand this logic : if there's any of [drops/dns/rtt] in panels then we don't fetch the bytes/packets metrics? Why?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If there is any panel which is not requiring special query (drop / dns / rtt),
then we query the defaults metrics..

An alternative could be to prepend a matcher to these defaults to manage this case the same way as nexts ones but users will loose their previous selections since it's stored in local storage.

Copy link
Member

Choose a reason for hiding this comment

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

I might be wrong but I think that selectedPanels.some(p => [DROPPED_ID_MATCHER, DNS_ID_MATCHER, RTT_ID_MATCHER].includes(p.id)) is always false.
This comes down to writing for instance ["drops", "dns", "rtt"].includes("top_avg_rtt_line"), that's never going to happen (?)
Should it be instead:

selectedPanels.some(p => [DROPPED_ID_MATCHER, DNS_ID_MATCHER, RTT_ID_MATCHER].some(matcher => p.id.includes(matcher)))

?

Copy link
Member

@jotak jotak Sep 29, 2023

Choose a reason for hiding this comment

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

I think this would be more correct and is perhaps easier to understand:

      if (selectedPanels.some(p => !p.id.includes(DROPPED_ID_MATCHER) && !p.id.includes(DNS_ID_MATCHER) && !p.id.includes(RTT_ID_MATCHER))) {

      }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right, thanks for catching that !

I applied your last suggestion: 15babbe

Copy link
Member

@jotak jotak left a comment

Choose a reason for hiding this comment

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

mostly LGTM with just a doubt on something
I'll also run some tests before approving

@jotak jotak added the ok-to-test To set manually when a PR is safe to test. Triggers image build on PR. label Sep 29, 2023
@github-actions
Copy link

New image:
quay.io/netobserv/network-observability-console-plugin:3be4f7a

It will expire after two weeks.

To deploy this build, run from the operator repo, assuming the operator is running:

USER=netobserv VERSION=3be4f7a make set-plugin-image

@jotak
Copy link
Member

jotak commented Sep 29, 2023

After testing, I can confirm my comment here that showing only [dns/rtt/drops] panel won't save us from doing a standard flows query, so I think that should be fixed.

Also a small thing, looks like the Globe icon alignment isn't perfect:
image

Apart from that, this looks good

@github-actions github-actions bot removed the ok-to-test To set manually when a PR is safe to test. Triggers image build on PR. label Sep 29, 2023
@jpinsonneau
Copy link
Contributor Author

Also a small thing, looks like the Globe icon alignment isn't perfect: image

should be better with that: 2be8de9

image

jotak
jotak previously approved these changes Sep 29, 2023
Copy link
Member

@jotak jotak left a comment

Choose a reason for hiding this comment

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

LGTM

@jpinsonneau
Copy link
Contributor Author

@nathan-weinberg would it be fine to merge this PR before QE validation ?
It may break your automated testings 🤔

I have 3 PRs needing these changes. If you prefer to take your time I will rebase them on this PR.
Thanks !

@nathan-weinberg
Copy link
Contributor

/cc @Amoghrd

@jpinsonneau If it's a breaking change, let's try and update the tests first so our regressions do not turn up false positives - i.e. prefer the rebase method :D

Do we have a Jira for this change?

@jpinsonneau
Copy link
Contributor Author

Do we have a Jira for this change?

I've created https://issues.redhat.com/browse/NETOBSERV-1348 for you guys

@nathan-weinberg
Copy link
Contributor

/ok-to-test

@openshift-ci openshift-ci bot added the ok-to-test To set manually when a PR is safe to test. Triggers image build on PR. label Oct 3, 2023
@github-actions
Copy link

github-actions bot commented Oct 3, 2023

New image:
quay.io/netobserv/network-observability-console-plugin:ba1acf4

It will expire after two weeks.

To deploy this build, run from the operator repo, assuming the operator is running:

USER=netobserv VERSION=ba1acf4 make set-plugin-image

@nathan-weinberg
Copy link
Contributor

@jpinsonneau
Copy link
Contributor Author

@jpinsonneau any manual verifications need to be done before merging?

Not particularly. Just that the graphs still shows 😸

@nathan-weinberg
Copy link
Contributor

@jpinsonneau any manual verifications need to be done before merging?

Not particularly. Just that the graphs still shows 😸

Sounds good - I am spinning up another cluster today to investigate some frontend failures @Amoghrd wanted me to double-check so I can do that as well!

@openshift-ci
Copy link

openshift-ci bot commented Oct 4, 2023

New changes are detected. LGTM label has been removed.

@github-actions github-actions bot removed the ok-to-test To set manually when a PR is safe to test. Triggers image build on PR. label Oct 4, 2023
@jpinsonneau
Copy link
Contributor Author

Rebased the PR
no changes from my end

@nathan-weinberg
Copy link
Contributor

/ok-to-test

@openshift-ci openshift-ci bot added the ok-to-test To set manually when a PR is safe to test. Triggers image build on PR. label Oct 4, 2023
@github-actions
Copy link

github-actions bot commented Oct 4, 2023

New image:
quay.io/netobserv/network-observability-console-plugin:74296d1

It will expire after two weeks.

To deploy this build, run from the operator repo, assuming the operator is running:

USER=netobserv VERSION=74296d1 make set-plugin-image

@nathan-weinberg
Copy link
Contributor

Full Success Run with our automated tests: https://mastern-jenkins-csb-openshift-qe.apps.ocp-c1.prod.psi.redhat.com/job/ocp-veno/job/no-regression/281/

@nathan-weinberg
Copy link
Contributor

/label qe-approved

@openshift-ci openshift-ci bot added the qe-approved QE has approved this pull request label Oct 4, 2023
@jpinsonneau
Copy link
Contributor Author

Thanks for the team effort ! 🥳 Merging now

@openshift-ci
Copy link

openshift-ci bot commented Oct 5, 2023

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by:

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 merged commit 390a160 into netobserv:main Oct 5, 2023
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm ok-to-test To set manually when a PR is safe to test. Triggers image build on PR. qe-approved QE has approved this pull request testing-breaking-change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants