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: remove duplicate imports in latency.go #445

Merged
merged 3 commits into from
Jun 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions pkg/module/metrics/latency.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"time"

"github.com/cilium/cilium/api/v1/flow"
v1 "github.com/cilium/cilium/api/v1/flow"
ttlcache "github.com/jellydator/ttlcache/v3"
api "github.com/microsoft/retina/crd/api/v1alpha1"
"github.com/microsoft/retina/pkg/common"
Expand Down Expand Up @@ -178,7 +177,7 @@ func (lm *LatencyMetrics) Clean() {
}
}

func (lm *LatencyMetrics) ProcessFlow(f *v1.Flow) {
func (lm *LatencyMetrics) ProcessFlow(f *flow.Flow) {
if f == nil || f.GetL4() == nil || f.GetL4().GetTCP() == nil || utils.GetTCPID(f) == 0 || f.GetIP() == nil {
return
}
Expand Down Expand Up @@ -255,12 +254,12 @@ func (lm *LatencyMetrics) ProcessFlow(f *v1.Flow) {
| |
+-------------------------------------------------+
*/
func (lm *LatencyMetrics) calculateLatency(f *v1.Flow) {
func (lm *LatencyMetrics) calculateLatency(f *flow.Flow) {
// Ignore all packets observed at endpoint.
// We only care about node-apiserver packets observed at eth0.
// TO_NETWORK: Packets leaving node via eth0.
// FROM_NETWORK: Packets entering node via eth0.
if f.TraceObservationPoint == v1.TraceObservationPoint_TO_NETWORK {
if f.GetTraceObservationPoint() == flow.TraceObservationPoint_TO_NETWORK {
k := key{
srcIP: f.IP.Source,
dstIP: f.IP.Destination,
Expand All @@ -275,7 +274,7 @@ func (lm *LatencyMetrics) calculateLatency(f *v1.Flow) {
flags: f.GetL4().GetTCP().GetFlags(),
}, TTL)
}
} else if f.TraceObservationPoint == v1.TraceObservationPoint_FROM_NETWORK {
} else if f.GetTraceObservationPoint() == flow.TraceObservationPoint_FROM_NETWORK {
k := key{
srcIP: f.IP.Destination,
dstIP: f.IP.Source,
Expand Down
Loading