console: add “%” to available units

This is useful to detect interfaces that are close to saturation
quickly. It would usually require to group by exporter name and
interface name and it may not make sense for some graph types (like
stacked 100%). It is useful with Lines and Grid.
This commit is contained in:
Vincent Bernat
2023-02-09 21:14:29 +01:00
parent fb4ef4aa60
commit d5cde97891
11 changed files with 38 additions and 10 deletions

View File

@@ -196,6 +196,13 @@ func (c *Component) contextFunc(inputStr string) context {
// 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)`
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 ExporterName, InIfName)`
case "outl2%":
// Same but using output interface as reference
units = `SUM((Bytes+38*Packets)*SamplingRate*8*100/(OutIfSpeed*1000000))/COUNT(DISTINCT ExporterName, OutIfName)`
}
c.metrics.clickhouseQueries.WithLabelValues(table).Inc()