mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-11 14:53:49 +00:00
23 lines
414 B
Go
23 lines
414 B
Go
package streamaggr
|
|
|
|
type maxAggrValue struct {
|
|
max float64
|
|
defined bool
|
|
}
|
|
|
|
func (av *maxAggrValue) pushSample(ctx *pushSampleCtx) {
|
|
if ctx.sample.value > av.max || !av.defined {
|
|
av.max = ctx.sample.value
|
|
}
|
|
if !av.defined {
|
|
av.defined = true
|
|
}
|
|
}
|
|
|
|
func (av *maxAggrValue) flush(ctx *flushCtx, key string) {
|
|
if av.defined {
|
|
ctx.appendSeries(key, "max", av.max)
|
|
av.max = 0
|
|
av.defined = false
|
|
}
|
|
}
|