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-1269 refactor overlapping detection for BNF #379

Merged
merged 1 commit into from
Sep 8, 2023

Conversation

jotak
Copy link
Member

@jotak jotak commented Sep 6, 2023

This fix allows working on situations as described in https://issues.redhat.com/browse/NETOBSERV-1269 and, hopefully, is a more generic / consistent solution in any case:
It changes how overlapping results are managed, now working on results rather than on query to remove overlapping parts.

  • When fetching flows, we don't explicitly remove the overlaps, but this is managed implicitly with the existing dedup functions
  • When fetching metrics, we consider that the computed metrics for any label set is the ORIGINAL metrics + the SWAPPED metrics - the OVERLAP metrics.

Also fixes https://issues.redhat.com/browse/NETOBSERV-1270

@codecov
Copy link

codecov bot commented Sep 6, 2023

Codecov Report

Patch coverage: 93.25% and project coverage change: -0.37% ⚠️

Comparison is base (bffb860) 57.69% compared to head (f26f169) 57.33%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #379      +/-   ##
==========================================
- Coverage   57.69%   57.33%   -0.37%     
==========================================
  Files         166      168       +2     
  Lines        7817     7936     +119     
  Branches      962      968       +6     
==========================================
+ Hits         4510     4550      +40     
- Misses       3030     3107      +77     
- Partials      277      279       +2     
Flag Coverage Δ
uitests 58.24% <93.25%> (+0.22%) ⬆️
unittests 54.79% <ø> (-1.98%) ⬇️

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

Files Changed Coverage Δ
web/src/model/filters.ts 78.46% <ø> (ø)
web/src/utils/filter-definitions.ts 66.66% <ø> (ø)
web/src/components/netflow-traffic.tsx 55.24% <80.00%> (-0.04%) ⬇️
web/src/utils/back-and-forth.ts 94.73% <94.73%> (ø)
web/src/utils/metrics.ts 88.16% <94.87%> (+1.80%) ⬆️
web/src/model/flow-query.ts 87.50% <100.00%> (-10.07%) ⬇️

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.

📢 Have feedback on the report? Share it here.

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

github-actions bot commented Sep 6, 2023

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

It will expire after two weeks.

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

USER=netobserv VERSION=5f8efb0 make set-plugin-image

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.

Let's test it 😸 thanks @jotak

@@ -387,6 +388,13 @@ export const NetflowTraffic: React.FC<{
topologyOptions.groupTypes
]);

const getFetchFunctionsClbk = React.useCallback(() => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not a huge fan of this Clbk suffix here. Can we either:

  • use distinct names in back-and-forth.ts / netflow-traffic.tsx
  • rename import like
import { getFetchFunctions as getBackAndForthFetch } from '../utils/back-and-forth';

Copy link
Member Author

Choose a reason for hiding this comment

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

sure I can do that

Copy link
Member Author

Choose a reason for hiding this comment

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

done

Comment on lines +49 to +52
// When bnf is on, this replaces the usual getTopologyMetrics with a function with same arguments that runs 3 queries and merge their results
// in order to get the ORIGINAL + SWAPPED - OVERLAP
// OVERLAP being ORIGINAL AND SWAPPED.
// E.g: if ORIGINAL is "SrcNs=foo", SWAPPED is "DstNs=foo" and OVERLAP is "SrcNs=foo AND DstNs=foo"
Copy link
Contributor

Choose a reason for hiding this comment

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

That may increase the too many outstanding request issue when not using filters.
See https://issues.redhat.com/browse/NETOBSERV-1235 comments with recording.

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, that's one more query indeed...
I don't see this error often, do you?
we could also start thinking more seriously about a throttling mechanism in the UI ?

Copy link
Contributor

Choose a reason for hiding this comment

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

I haven't retested using loki-operator but it will since the default value is used for outstanding requests.

We already have a story for graphs loadings improvments: https://issues.redhat.com/browse/NETOBSERV-1185
Let's start from there since it's the page that runs the most of them.

Copy link
Member Author

Choose a reason for hiding this comment

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

i don't remember, do we have a workaround for the "too many outstanding requests" issue? (a loki config?)
Doing some tests on my side, I don't get the error, but I can imagine people may have it.
I can also take a stab at 1185 but that would likely be another PR

Copy link
Member Author

Choose a reason for hiding this comment

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

actually, how about chaining those promises? bc076f0

Copy link
Contributor

Choose a reason for hiding this comment

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

To reproduce you need to remove all filters and set auto refresh to 15s or spam the refresh button.
Then it will appear by itself after some time.
As far as I know loki-operator doesn't expose this config.
https://redhat-internal.slack.com/archives/C02939DP5L5/p1693313480687369?thread_ts=1693259801.293669&cid=C02939DP5L5

Chaining the requests would not solve the issue and will make the page load slower right ?
We need to take advantage of parallelization; Loki query-frontend component is designed for that.

Copy link
Member Author

Choose a reason for hiding this comment

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

Chaining the requests would not solve the issue and will make the page load slower right ?

Make it load slower => yes; but it should reduce the number of parallel queries, which in my understanding is the cause of "too many outstanding requests" error ?

Copy link
Member Author

Choose a reason for hiding this comment

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

fwiw netobserv/network-observability-operator#409 + #380 should make it less likely to get "too many outstanding requests"

@jpinsonneau
Copy link
Contributor

LGTM after testing both 1269 & 1270 cases 🥳

@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 7, 2023
This fix allows working on situations as described in
https://issues.redhat.com/browse/NETOBSERV-1269 and, hopefully, is a
more generic / consistent solution anyway.

Changing how overlapping results are managed: work on results rather
than on query to remove overlapping parts.

When fetching flows, we don't explicitly remove the overlaps, but this
is managed implicitly with the existing dedup functions

When fetching metrics, we consider that the computed metrics for any
label set is the ORIGINAL metrics + the SWAPPED metrics - the OVERLAP
metrics.

Add tests, fix tests

Note that adjustment is necessary in MetricsQuerySummary test as the
"endWithTolerance" calculation has changed a little bit, modifying
computed rates ... new values are still close to the previous ones

Rename callback function
@jotak
Copy link
Member Author

jotak commented Sep 8, 2023

/approve

@openshift-ci
Copy link

openshift-ci bot commented Sep 8, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jotak

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 Sep 8, 2023
@openshift-merge-robot openshift-merge-robot merged commit a21bd6a into netobserv:main Sep 8, 2023
9 checks passed
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