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-1208 & NETOBSERV-1233 Aggregators skip missing fields #470

Merged
merged 3 commits into from
Aug 7, 2023

Conversation

jpinsonneau
Copy link
Collaborator

Following #451 we removed unused fields to the genericMap by default.

Aggregators on connection tracking needs to be updated to:

  • avoid reporting unecessary errors
  • be able to keep last provided field

This PR introduce a new ReportMissing field optional to allow error reporting on aggregations.

Please let me know if you want to have a different default behavior or a more flexible solution.

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

github-actions bot commented Aug 4, 2023

New image:
quay.io/netobserv/flowlogs-pipeline:e10d50b

It will expire after two weeks.

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

USER=netobserv VERSION=e10d50b make set-flp-image

@codecov
Copy link

codecov bot commented Aug 4, 2023

Codecov Report

Merging #470 (de53e15) into main (31e9d82) will decrease coverage by 0.07%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #470      +/-   ##
==========================================
- Coverage   66.12%   66.06%   -0.07%     
==========================================
  Files          94       94              
  Lines        6867     6877      +10     
==========================================
+ Hits         4541     4543       +2     
- Misses       2066     2072       +6     
- Partials      260      262       +2     
Flag Coverage Δ
unittests 66.06% <100.00%> (-0.07%) ⬇️

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

Files Changed Coverage Δ
pkg/api/conntrack.go 87.66% <ø> (ø)
pkg/pipeline/decode/decode_protobuf.go 30.50% <100.00%> (+0.95%) ⬆️
pkg/pipeline/extract/conntrack/aggregator.go 91.07% <100.00%> (-7.06%) ⬇️
pkg/pipeline/extract/conntrack/conn.go 78.46% <100.00%> (+0.16%) ⬆️

if agg.metrics != nil {
agg.metrics.aggregatorErrors.WithLabelValues("MissingFieldError", agg.inputField).Inc()
// error only if explicitly specified as FLP skip empty fields by default to reduce storage size
if agg.reportMissing {
Copy link
Contributor

Choose a reason for hiding this comment

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

I assume netobserv app always expect this bool to be false ? when can this bool be true I am wondering if we even need to bool and we can omit the error always ?

Copy link
Collaborator Author

@jpinsonneau jpinsonneau Aug 7, 2023

Choose a reason for hiding this comment

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

I feel this could be usefull even for netobserv.
FlowDirection, IfDirection, TimeFlowStartMs, Bytes, Packets fields for example.

@@ -179,11 +185,13 @@ func (agg *aMax) update(conn connection, flowLog config.GenericMap, d direction,
}

func (cp *aFirst) update(conn connection, flowLog config.GenericMap, d direction, isNew bool) {
if isNew {
if isNew && flowLog[cp.inputField] != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

I assume if we don't allow by default empty fields then we won't need this check as well as the one in the update function ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The goal here is to avoid reporting empty fields for first and last operations (just below this one).
Without it, these will create field with nil:

c.aggFields[fieldName] = newValue

I'm not sure to get your point. Can you please clarify ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

After testing it seems better to work directly in the toGenericMap function
74611d2

That avoid to manage per aggregate cases

Copy link
Collaborator Author

@jpinsonneau jpinsonneau Aug 7, 2023

Choose a reason for hiding this comment

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

@msherif1234 any reason not skipping zeros for Bytes and Packets fields ?
de53e15

For consistency it would be useful

Copy link
Contributor

Choose a reason for hiding this comment

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

no @jpinsonneau it makes sense to skip empty fields

@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 Aug 7, 2023
@jpinsonneau jpinsonneau added the ok-to-test To set manually when a PR is safe to test. Triggers image build on PR. label Aug 7, 2023
@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 Aug 7, 2023
@netobserv netobserv deleted a comment from github-actions bot Aug 7, 2023
@jpinsonneau jpinsonneau added the ok-to-test To set manually when a PR is safe to test. Triggers image build on PR. label Aug 7, 2023
@github-actions
Copy link

github-actions bot commented Aug 7, 2023

New image:
quay.io/netobserv/flowlogs-pipeline:5f298ac

It will expire after two weeks.

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

USER=netobserv VERSION=5f298ac make set-flp-image

@@ -100,7 +101,9 @@ func (c *connType) getNextHeartbeatTime() time.Time {
func (c *connType) toGenericMap() config.GenericMap {
gm := config.GenericMap{}
for k, v := range c.aggFields {
gm[k] = v
if v != nil && (reflect.TypeOf(v).Kind() != reflect.Float64 || v.(float64) != 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

should this be && i.e

if v != nil && reflect.TypeOf(v).Kind() == reflect.Float64 && v.(float64) != 0 {

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

aggFields can be other types than float64 here
Example: string for PktDropLatestState or PktDropLatestDropCause on last aggregate

Copy link
Contributor

Choose a reason for hiding this comment

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

/lgtm

@jpinsonneau
Copy link
Collaborator Author

merging this to unlock operator PR

@jpinsonneau
Copy link
Collaborator Author

/approve

@openshift-ci
Copy link

openshift-ci bot commented Aug 7, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jpinsonneau

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 Aug 7, 2023
@openshift-merge-robot openshift-merge-robot merged commit 5912edf into netobserv:main Aug 7, 2023
9 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants