mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-11 14:53:49 +00:00
20 lines
409 B
Go
20 lines
409 B
Go
package streamaggr
|
|
|
|
type lastAggrValue struct {
|
|
last float64
|
|
timestamp int64
|
|
}
|
|
|
|
func (av *lastAggrValue) pushSample(ctx *pushSampleCtx) {
|
|
if ctx.sample.timestamp >= av.timestamp {
|
|
av.last = ctx.sample.value
|
|
av.timestamp = ctx.sample.timestamp
|
|
}
|
|
}
|
|
|
|
func (av *lastAggrValue) flush(ctx *flushCtx, key string) {
|
|
if av.timestamp > 0 {
|
|
ctx.appendSeries(key, "last", av.last)
|
|
av.timestamp = 0
|
|
}
|
|
}
|