mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-03-21 15:45:01 +00:00
app/vmselect/promql: skip superflouos timestamps copying in count_values
This commit is contained in:
parent
d2be567482
commit
8bb6bc986d
2 changed files with 5 additions and 3 deletions
|
@ -316,7 +316,7 @@ func aggrFuncCountValues(afa *aggrFuncArg) ([]*timeseries, error) {
|
||||||
var rvs []*timeseries
|
var rvs []*timeseries
|
||||||
for _, v := range values {
|
for _, v := range values {
|
||||||
var dst timeseries
|
var dst timeseries
|
||||||
dst.CopyFrom(tss[0])
|
dst.CopyFromShallowTimestamps(tss[0])
|
||||||
dst.MetricName.RemoveTag(dstLabel)
|
dst.MetricName.RemoveTag(dstLabel)
|
||||||
dst.MetricName.AddTag(dstLabel, strconv.FormatFloat(v, 'g', -1, 64))
|
dst.MetricName.AddTag(dstLabel, strconv.FormatFloat(v, 'g', -1, 64))
|
||||||
for i := range dst.Values {
|
for i := range dst.Values {
|
||||||
|
|
|
@ -38,11 +38,13 @@ func (ts *timeseries) String() string {
|
||||||
return fmt.Sprintf("MetricName=%s, Values=%g, Timestamps=%d", &ts.MetricName, ts.Values, ts.Timestamps)
|
return fmt.Sprintf("MetricName=%s, Values=%g, Timestamps=%d", &ts.MetricName, ts.Values, ts.Timestamps)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ts *timeseries) CopyFrom(src *timeseries) {
|
func (ts *timeseries) CopyFromShallowTimestamps(src *timeseries) {
|
||||||
ts.Reset()
|
ts.Reset()
|
||||||
ts.MetricName.CopyFrom(&src.MetricName)
|
ts.MetricName.CopyFrom(&src.MetricName)
|
||||||
ts.Values = append(ts.Values[:0], src.Values...)
|
ts.Values = append(ts.Values[:0], src.Values...)
|
||||||
ts.Timestamps = append(ts.Timestamps[:0], src.Timestamps...)
|
ts.Timestamps = src.Timestamps
|
||||||
|
|
||||||
|
ts.denyReuse = true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ts *timeseries) CopyFromMetricNames(src *timeseries) {
|
func (ts *timeseries) CopyFromMetricNames(src *timeseries) {
|
||||||
|
|
Loading…
Reference in a new issue