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

Add support for isMetadataFilled for aggregation process #196

Merged
merged 2 commits into from
May 17, 2021

Conversation

zyiou
Copy link
Contributor

@zyiou zyiou commented May 14, 2021

If correlation is required, we will set isMetadataFilled to true.
if correlation is not required, we will set isMetadataFilled to true only when the flow is intra-Node.

isMetadataFilled is always true for Intra-Node and ToExternal flows and only applicable for Inter-Node flows that are not required to be correlated. (e.g. flows with Egress deny rule applied)

@codecov
Copy link

codecov bot commented May 14, 2021

Codecov Report

Merging #196 (5aef325) into main (9b4f91e) will decrease coverage by 0.18%.
The diff coverage is 86.95%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #196      +/-   ##
==========================================
- Coverage   78.66%   78.48%   -0.19%     
==========================================
  Files          17       17              
  Lines        2133     2143      +10     
==========================================
+ Hits         1678     1682       +4     
- Misses        304      308       +4     
- Partials      151      153       +2     
Flag Coverage Δ
integration-tests 56.09% <30.43%> (-1.67%) ⬇️
unit-tests 78.28% <86.95%> (-0.04%) ⬇️

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

Impacted Files Coverage Δ
pkg/intermediate/aggregate.go 72.26% <86.95%> (-0.77%) ⬇️

Copy link
Contributor

@srikartati srikartati left a comment

Choose a reason for hiding this comment

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

Please also add explicitly that the new field is always true for Intra-Node flows and ToExternal flows in the PR description. It is only applicable for inter-node flows and we do not expect them to be correlated.

@@ -331,6 +340,12 @@ func (a *AggregationProcess) addOrUpdateRecordInMap(flowKey *FlowKey, record ent
}
if !correlationRequired {
aggregationRecord.ReadyToSend = true
// if no correlation is required for inter-Node record, K8s metadata will not be filled.
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you rephrase this? Also please explicitly mention that for Intra-node flows and ToExternal flows, we can set the MetaDataFilled as true by default.

// if no correlation is required for inter-Node record, K8s metadata will not
// be filled. For Intra-Node flows and ToExternal flows, isMetaDataFilled is set
// to true by default.
if isRecordFromSrc(record) || isRecordFromDst(record) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Not your change? Do we still need isRecordFromSrc and isRecordFromDst? We already have flow type in the flow record. Can we use that to make code simple?

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. We can switch to using flowType here. But function isRecordFromSrc, isRecordFromDst and areRecordsFromSameNode need to be kept because this information is not revealed from flowType.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes we still need those methods. Moving to flowType here makes the code easily readable.

@@ -331,6 +340,14 @@ func (a *AggregationProcess) addOrUpdateRecordInMap(flowKey *FlowKey, record ent
}
if !correlationRequired {
aggregationRecord.ReadyToSend = true
// if no correlation is required for inter-Node record, K8s metadata will not
Copy link
Contributor

Choose a reason for hiding this comment

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

"If no correlation is required for an inter-Node record, K8s metadata is expected to be not completely filled."

Copy link
Contributor

@srikartati srikartati left a comment

Choose a reason for hiding this comment

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

Thanks for addressing comments.
LGTM

@zyiou zyiou merged commit c47a31a into vmware:main May 17, 2021
heanlan pushed a commit to heanlan/go-ipfix that referenced this pull request May 17, 2021
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.

3 participants