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-1407 console deduper merge mode #435

Merged
merged 4 commits into from
Jan 25, 2024

Conversation

jpinsonneau
Copy link
Contributor

@jpinsonneau jpinsonneau commented Nov 28, 2023

Description

  • Manage Interface and Direction arrays as a single field in the UI according to mark & merge configs
  • Skip frontend deduplication for both flows & metrics queries
  • Update filtering engine to query on new fields

image

To setup deduper merge, simply add the following config in ebpf debug (or advanced) configuration:

      advanced:
        env:
          DEDUPER_JUST_MARK: "false"
          DEDUPER_MERGE: "true"

Dependencies

netobserv/network-observability-operator#501
netobserv/network-observability-operator#529

Checklist

If you are not familiar with our processes or don't know what to answer in the list below, let us know in a comment: the maintainers will take care of that.

  • Is this PR backed with a JIRA ticket? If so, make sure it is written as a title prefix (in general, PRs affecting the NetObserv/Network Observability product should be backed with a JIRA ticket - especially if they bring user facing changes).
  • Does this PR require product documentation?
    • If so, make sure the JIRA epic is labelled with "documentation" and provides a description relevant for doc writers, such as use cases or scenarios. Any required step to activate or configure the feature should be documented there, such as new CRD knobs.
  • Does this PR require a product release notes entry?
    • If so, fill in "Release Note Text" in the JIRA.
  • Is there anything else the QE team should know before testing? E.g: configuration changes, environment setup, etc.
    • If so, make sure it is described in the JIRA ticket.
  • QE requirements (check 1 from the list):
    • Standard QE validation, with pre-merge tests unless stated otherwise.
    • Regression tests only (e.g. refactoring with no user-facing change).
    • No QE (e.g. trivial change with high reviewer's confidence, or per agreement with the QE team).

Copy link

codecov bot commented Nov 28, 2023

Codecov Report

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

Comparison is base (8f2df29) 58.61% compared to head (cc28165) 58.34%.
Report is 2 commits behind head on main.

❗ Current head cc28165 differs from pull request most recent head 09a3b91. Consider uploading reports for the commit 09a3b91 to get more accurate results

Files Patch % Lines
web/src/components/netflow-record/record-panel.tsx 12.12% 28 Missing and 1 partial ⚠️
web/src/components/netflow-record/record-field.tsx 47.36% 10 Missing ⚠️
pkg/loki/flow_query.go 10.00% 8 Missing and 1 partial ⚠️
pkg/loki/filter.go 33.33% 4 Missing ⚠️
web/src/components/netflow-traffic.tsx 60.00% 1 Missing and 1 partial ⚠️
web/src/api/ipfix.ts 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #435      +/-   ##
==========================================
- Coverage   58.61%   58.34%   -0.28%     
==========================================
  Files         167      167              
  Lines        8312     8385      +73     
  Branches     1061     1074      +13     
==========================================
+ Hits         4872     4892      +20     
- Misses       3132     3182      +50     
- Partials      308      311       +3     
Flag Coverage Δ
uitests 58.87% <36.36%> (-0.36%) ⬇️
unittests 56.79% <58.06%> (-0.03%) ⬇️

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

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

@msherif1234
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 Jan 9, 2024
@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 Jan 18, 2024
@netobserv netobserv deleted a comment from github-actions bot Jan 22, 2024
@jpinsonneau jpinsonneau added the ok-to-test To set manually when a PR is safe to test. Triggers image build on PR. label Jan 22, 2024
@jpinsonneau jpinsonneau marked this pull request as ready for review January 22, 2024 11:21
@netobserv netobserv deleted a comment from github-actions bot Jan 22, 2024
@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 Jan 22, 2024
@jpinsonneau jpinsonneau added the ok-to-test To set manually when a PR is safe to test. Triggers image build on PR. label Jan 22, 2024
Copy link

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

It will expire after two weeks.

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

USER=netobserv VERSION=51c5a2d make set-plugin-image

@jpinsonneau
Copy link
Contributor Author

jpinsonneau commented Jan 22, 2024

I sometimes get FlowDirection as string and sometimes as number 🤔
We should be consistent and only use numbers in any case

I'm adapting the plugin to manage both in between

@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 Jan 22, 2024
@@ -812,3 +818,6 @@ frontend:
alertNamespaces:
- netobserv
sampling: 50
deduper:
mark: false
merge: true
Copy link
Contributor

Choose a reason for hiding this comment

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

isn't better to stay with the current default till we change it ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure !

@@ -122,6 +128,10 @@ func ReadConfigFile(version, date, filename string) (*Config, error) {
Filters: []Filter{},
QuickFilters: []QuickFilter{},
Features: []string{},
Deduper: Deduper{
Copy link
Contributor

Choose a reason for hiding this comment

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

can u pls add a note here so when the agent default change we need to remember and change this as well ? OR it will be much better to have only one source of truth can u read it from the same cm instead of hard coding it here ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've added a TODO for now. We could load by default the sample yaml but that would force us to embed it in the code and parse two yaml, one after the other.

The plugin accept as arguments a file path that is configurable. These defaults are overriden below (line 141)

return metricType == constants.MetricTypeBytes ||
metricType == constants.MetricTypePackets
func shouldMergeReporters(metricType constants.MetricType, deduper loki.Deduper) bool {
return !deduper.Merge && deduper.Mark && (metricType == constants.MetricTypeBytes ||
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 think it make any sense to have mark true and merge true at the sametime
while we don't enforce this yet but this is something we should consider
IMO valid configs

Mark | Merge

T | F
F | T

since we always need to know about dup so both T or both F is invalid, maybe we can just single config knob at the agent side ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Both merge and mark could be false 🙃
But I agree both true doesn't make sense on eBPF side. I just wanted to manage every cases here since we have 2 flags for now.

I suggest to keep as is and cleanup the code for enablement in https://issues.redhat.com/browse/NETOBSERV-1459

@@ -141,7 +142,7 @@ func (f *lineFilter) asLabelFilters() []labelFilter {
valueType: v.valueType,
value: v.value,
}
if v.valueType == typeRegex || v.valueType == typeRegexContains {
if v.valueType == typeRegex || v.valueType == typeRegexContains || v.valueType == typeRegexArrayContains {
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe worth small helper to check for all regex flavor ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure !

@@ -141,7 +142,7 @@ func (f *lineFilter) asLabelFilters() []labelFilter {
valueType: v.valueType,
value: v.value,
}
if v.valueType == typeRegex || v.valueType == typeRegexContains {
if v.valueType == typeRegex || v.valueType == typeRegexContains || v.valueType == typeRegexArrayContains {
if f.not {
lf.matcher = labelNoMatches
} else {
Copy link
Contributor

Choose a reason for hiding this comment

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

not related to this commit but I think u can avoid if else here just init lf.matcher and check if !f.not

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sounds good to me

default:
isArray = false
}
}
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 understand this its always an array if merge is on ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes !

Currently, when deduper merged is enabled, we have both single and plural fields as:
FlowDirection, Interface, FlowDirections, Interfaces

I'm forcing a `lineMatch`` on plural fields here to avoid any query running on single fields.
In the future, I expect fully removing FlowDirection and Interface fields.

if (
flow.fields.Interfaces &&
flow.fields.FlowDirections &&
flow.fields.Interfaces.length === flow.fields.FlowDirections.length
Copy link
Contributor

Choose a reason for hiding this comment

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

why u need this check its not possible the two arrays of different len ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not supposed to happen indeed, but just in case, I'm checking the length to avoid crashing in the loop following this test since I'm accessing values by their index.

? t('Ingress')
: value === FlowDirection.Egress
? t('Egress')
: value === FlowDirection.Inner
Copy link
Contributor

Choose a reason for hiding this comment

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

can we ever get Inner flow direction its either ingress or egress right ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Inner is something calculated from reinterpret direction in FLP.
It's not yet adapted to plural fields

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@msherif1234
Copy link
Contributor

sounds good to me Thanks @jpinsonneau
/LGTM

@openshift-ci openshift-ci bot added the lgtm label Jan 24, 2024
@jpinsonneau jpinsonneau added no-qe This PR doesn't necessitate QE approval approved labels Jan 25, 2024
Copy link

openshift-ci bot commented Jan 25, 2024

[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-merge-bot openshift-merge-bot bot merged commit dfe7ac4 into netobserv:main Jan 25, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm no-qe This PR doesn't necessitate QE approval
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants