console: fix calculation of the L2 overhead when selecting L2 bps

This commit is contained in:
Vincent Bernat
2023-02-01 14:52:33 +01:00
parent e4b30ecea7
commit 740251f30d
2 changed files with 7 additions and 1 deletions

View File

@@ -190,7 +190,12 @@ func (c *Component) contextFunc(inputStr string) context {
case "l3bps":
units = `SUM(Bytes*SamplingRate*8)`
case "l2bps":
units = `SUM((Bytes+18*Packets)*SamplingRate*8)`
// For each packet, we add the Ethernet header (14 bytes), the CRC (4
// bytes), the preamble and start frame delimiter (8 bytes) and the IPG
// (~ 12 bytes). We don't include the VLAN header (4 bytes) as it is
// often not used with external entities. Both sFlow and IPFIX may have
// a better view of that, but we don't collect it yet.
units = `SUM((Bytes+38*Packets)*SamplingRate*8)`
}
c.metrics.clickhouseQueries.WithLabelValues(table).Inc()