mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2026-05-17 00:26:36 +03:00
### Describe Your Changes fixes #8469 ### Checklist The following checks are **mandatory**: - [ ] My change adheres [VictoriaMetrics contributing guidelines](https://docs.victoriametrics.com/contributing/).
29 lines
605 B
Go
29 lines
605 B
Go
package streamaggr
|
|
|
|
type sumSamplesAggrValue struct {
|
|
sum float64
|
|
}
|
|
|
|
func (av *sumSamplesAggrValue) pushSample(_ aggrConfig, sample *pushSample, _ string, _ int64) {
|
|
av.sum += sample.value
|
|
}
|
|
|
|
func (av *sumSamplesAggrValue) flush(_ aggrConfig, ctx *flushCtx, key string, _ bool) {
|
|
ctx.appendSeries(key, "sum_samples", av.sum)
|
|
av.sum = 0
|
|
}
|
|
|
|
func (*sumSamplesAggrValue) state() any {
|
|
return nil
|
|
}
|
|
|
|
func newSumSamplesAggrConfig() aggrConfig {
|
|
return &sumSamplesAggrConfig{}
|
|
}
|
|
|
|
type sumSamplesAggrConfig struct{}
|
|
|
|
func (*sumSamplesAggrConfig) getValue(_ any) aggrValue {
|
|
return &sumSamplesAggrValue{}
|
|
}
|