console: fix %-display when speed of an interface is 0

And add a warning about that in the documentation.
This commit is contained in:
Vincent Bernat
2023-06-22 01:09:22 +02:00
parent 18ad16eb56
commit b464a00be1
3 changed files with 6 additions and 3 deletions

View File

@@ -199,10 +199,10 @@ func (c *Component) contextFunc(inputStr string) context {
case "inl2%":
// That's like l2bps, but this time we use the interface speed to get a
// percent value
units = `SUM((Bytes+38*Packets)*SamplingRate*8*100/(InIfSpeed*1000000))/COUNT(DISTINCT ExporterAddress, InIfName)`
units = `ifNotFinite(SUM((Bytes+38*Packets)*SamplingRate*8*100/(InIfSpeed*1000000))/COUNT(DISTINCT ExporterAddress, InIfName),0)`
case "outl2%":
// Same but using output interface as reference
units = `SUM((Bytes+38*Packets)*SamplingRate*8*100/(OutIfSpeed*1000000))/COUNT(DISTINCT ExporterAddress, OutIfName)`
units = `ifNotFinite(SUM((Bytes+38*Packets)*SamplingRate*8*100/(OutIfSpeed*1000000))/COUNT(DISTINCT ExporterAddress, OutIfName),0)`
}
c.metrics.clickhouseQueries.WithLabelValues(table).Inc()

View File

@@ -115,7 +115,9 @@ aspect of the graph.
second (should match interface counters), packets par second, percentage of
use of the input interface or output interface. For percentage use, you should
group by exporter name and interface name or description for it to make sense.
Otherwise, you would get an average over the matched interfaces.
Otherwise, you would get an average over the matched interfaces. Also, because
interface speeds are retrieved infrequently, the percentage may be temporarily
incorrect when an interface speed changes.
- Four graph types are provided: “stacked”, “lines”, and “grid” to
display time series and “sankey” to show flow distributions between

View File

@@ -24,6 +24,7 @@ identified with a specific icon:
- `TCPFlags`
- `ICMPv4Type`, `ICMPv4Code`, `ICMPv6Type`, `ICMPv6Code`, `ICMPv4`, and `ICMPv6`
- 🩹 *inlet*: fix Netflow processing when template is received with data
- 🩹 *console*: fix display when using “%” units and interface speed is 0
- 🌱 *build*: minimum supported Node version is now 16
## 1.8.3 - 2023-04-28