cloudflare / goflow

The high-scalability sFlow/NetFlow/IPFIX collector used internally at Cloudflare.
BSD 3-Clause "New" or "Revised" License
852 stars 171 forks source link

Same Time* for sflow even if they are different #121

Open galushka opened 11 months ago

galushka commented 11 months ago

Firstly, thank you for the library. In the goflow/utils/sflow.go file, there are the following blocks of code: 1) Defining "ts":

ts := uint64(time.Now().UTC().Unix())
if pkt.SetTime {
    ts = uint64(pkt.RecvTime.UTC().Unix())
}

2) Setting TimeReceived, TimeFlowStart, and TimeFlowEnd:

for _, fmsg := range flowMessageSet {
    fmsg.TimeReceived = ts
    fmsg.TimeFlowStart = ts
    fmsg.TimeFlowEnd = ts
}

Currently, there is no difference between TimeFlowStart / TimeFlowEnd and TimeReceived. However, when the flag "SetTime" is set to "true", it would be very useful to distinguish between these timestamps. Thank you!