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

Fix v6 ipfix export #94

Merged
merged 1 commit into from
Feb 17, 2023
Merged

Conversation

praveingk
Copy link
Collaborator

This PR fixes #93

@codecov-commenter
Copy link

Codecov Report

Merging #94 (b4da55f) into main (c54e7eb) will decrease coverage by 0.13%.
The diff coverage is 0.00%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##             main      #94      +/-   ##
==========================================
- Coverage   41.54%   41.42%   -0.13%     
==========================================
  Files          29       29              
  Lines        1993     1999       +6     
==========================================
  Hits          828      828              
- Misses       1127     1133       +6     
  Partials       38       38              
Flag Coverage Δ
unittests 41.42% <0.00%> (-0.13%) ⬇️

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

Impacted Files Coverage Δ
pkg/exporter/ipfix.go 0.00% <0.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@jotak jotak added no-doc This PR doesn't require documentation change on the NetObserv operator no-qe This PR doesn't necessitate QE approval labels Feb 10, 2023
@jotak
Copy link
Member

jotak commented Feb 10, 2023

/lgtm

err = dataSet.AddRecord(ipf.entitiesV4, templateID)
if err != nil {
return err
if v6 {
Copy link
Contributor

@msherif1234 msherif1234 Feb 14, 2023

Choose a reason for hiding this comment

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

its good practice to avoid if() {
} else {
}

instead

err = dataSet.AddRecord(ipf.entitiesV4, templateID)
if err != nil {
    return err
}

if v6 {
   err = dataSet.AddRecord(ipf.entitiesV6, templateID)
   if err != nil {
       return err
   }
}

Copy link
Collaborator Author

@praveingk praveingk Feb 15, 2023

Choose a reason for hiding this comment

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

@msherif1234 Wouldn't that perform dataSet.AddRecord multiple times for v6?

Copy link
Member

Choose a reason for hiding this comment

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

+1 @praveingk
I think the good practice referred to is writing if { ...return } ... return instead of if { ...return } else { ...return}, but it doesn't apply here as not all paths return in the conditional expressions

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah @praveingk I was commenting in general and yes whatu have make sense
/lgtm

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 see :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @praveingk
so we can do this

entities := ipf.entitiesV4
if v6 {
  entities = ipf.entitiesV6
}
if err := dataSet.AddRecord(entities, templateID); err != nil {
  return err
}

@jotak
Copy link
Member

jotak commented Feb 17, 2023

/approve

@openshift-ci
Copy link

openshift-ci bot commented Feb 17, 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-merge-robot openshift-merge-robot merged commit e33e690 into netobserv:main Feb 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm no-doc This PR doesn't require documentation change on the NetObserv operator no-qe This PR doesn't necessitate QE approval
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IPFIX export for v6 records fails
5 participants