Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge Grafana's fork changes #686

Merged
merged 120 commits into from
Sep 13, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
120 commits
Select commit Hold shift + click to select a range
39ec0ce
Update go.mod with new path
carrieedwards Jun 14, 2022
b7dbb6f
Merge pull request #19 from grafana/cedwards/update-go-mod
carrieedwards Jun 14, 2022
b4f114b
Update dependencies for CarbonAPI
carrieedwards Jun 15, 2022
f61c410
Merge pull request #20 from grafana/cedwards/update-dependencies
carrieedwards Jun 15, 2022
af21cba
Update imports to use grafana/carbonapi
carrieedwards Jun 15, 2022
a7fbdaa
Merge pull request #21 from grafana/cedwards/update-imports
carrieedwards Jun 15, 2022
4c11a5a
Add configuration for tests, coverage and linting on drone (#23)
carrieedwards Jul 8, 2022
718cc5d
Add support for Graphite web exp() function (#2)
carrieedwards Jul 12, 2022
40f705f
Remove references to pidfiles (#30)
carrieedwards Jul 13, 2022
92d075e
Add support for Graphite web logit() function (#14)
carrieedwards Jul 18, 2022
28ae5c2
Add support for Graphite web unique() function (#10)
carrieedwards Jul 18, 2022
160f16f
Update tags handling in expr functions to match Graphite web (#22)
carrieedwards Jul 19, 2022
695fb3f
Revert test changes so they fail on input mutability
npazosmendez Jul 19, 2022
d6e2e70
Clone MetricData to avoid mutating input when needed
npazosmendez Jul 19, 2022
4d8e542
Delete obsolete function
npazosmendez Jul 19, 2022
8c74625
Delete obsolete function
npazosmendez Jul 19, 2022
89fda16
Correct test assertions
npazosmendez Jul 19, 2022
ecb1570
Fix failing tests
npazosmendez Jul 19, 2022
5aafd59
Fix mutamility in logit function
npazosmendez Jul 19, 2022
fb037b2
Fix filing tests
npazosmendez Jul 19, 2022
af4020b
Copy metric slice on alignment
npazosmendez Jul 19, 2022
ac97c47
Merge pull request #31 from grafana/npazosmendez/dont-mutate-input
npazosmendez Jul 20, 2022
06d3807
Fix timeStack function
npazosmendez Jul 20, 2022
a212c8c
Merge branch 'main' into npazosmendez/dont-mutate-input
npazosmendez Jul 20, 2022
6d961d0
Fix other functions mutating input
npazosmendez Jul 20, 2022
9fb499c
Merge pull request #32 from grafana/npazosmendez/dont-mutate-input
npazosmendez Jul 20, 2022
f0b0db2
filterSeries should add 'name' tag
npazosmendez Jul 21, 2022
ddbff9b
aliasByMetric: set 'name' tag correctly
npazosmendez Jul 21, 2022
598f2f0
aliasByNode: always set 'name' tag
npazosmendez Jul 21, 2022
8d18608
Prefer arg.Name for metric name
npazosmendez Jul 21, 2022
cd6459e
Revert "filterSeries should add 'name' tag"
npazosmendez Jul 21, 2022
8100462
Revert "aliasByNode: always set 'name' tag"
npazosmendez Jul 21, 2022
faf9910
Fix groupByNode handling of queries with no callback provided (#34)
carrieedwards Jul 22, 2022
74ee465
Merge branch 'main' into npazosmendez/various-fixes
npazosmendez Jul 25, 2022
da64eae
Fix summarize function handling of tags (#35)
carrieedwards Jul 25, 2022
90386ae
Fix e2e tests: '@' is a valid character for names
npazosmendez Jul 25, 2022
4fa361d
Merge pull request #33 from grafana/npazosmendez/various-fixes
npazosmendez Jul 25, 2022
62d60dd
Fix .name in aggregation with wildcard functions
npazosmendez Jul 27, 2022
cdfb110
Merge pull request #37 from grafana/npazosmendez/aggregate-with-wildc…
npazosmendez Jul 27, 2022
8468b38
Add support for Graphite web sinFunction (#39)
carrieedwards Jul 27, 2022
2487ecd
Fix legendValue function so that optional system parameters are corre…
carrieedwards Jul 27, 2022
3f952f6
Add support for Graphite web's aggregateWithWildcards function (#4)
carrieedwards Jul 29, 2022
7e14877
Add powSeries function
leizor Jul 29, 2022
3e79874
Add support for Graphite web averageOutsidePercentile function (#44)
carrieedwards Aug 1, 2022
2dde0b6
Add support for Graphite web sigmoid() function (#15)
carrieedwards Aug 1, 2022
cce3163
Cache series values
leizor Aug 1, 2022
b82ff49
Add benchmark
leizor Aug 1, 2022
577ad8b
Add support for xFilesFactor and setXFilesFactor (#8)
carrieedwards Aug 1, 2022
cff82c6
Minor variable renaming
leizor Aug 2, 2022
5ff1e97
Merge pull request #42 from grafana/leizor/pow-series
leizor Aug 2, 2022
d3bd455
Add support for Graphite web removeBetweenPercentile() function (#24)
carrieedwards Aug 2, 2022
23be4f9
Add support for Graphite web identity function (#47)
carrieedwards Aug 2, 2022
2e11a50
Add support for Graphite web minMax() function (#18)
carrieedwards Aug 2, 2022
d59c9f5
Update COMPATIBILITY.md to reflect newly supported functions (#45)
carrieedwards Aug 2, 2022
0771e43
Add aggregateSeriesLists function
leizor Aug 2, 2022
c4d464a
Add tests that cause panics
npazosmendez Aug 3, 2022
aa8c074
Fix various functions panicking for empty input
npazosmendez Aug 3, 2022
1e641f6
Copy Tags to avoid mutating input (and panics)
npazosmendez Aug 3, 2022
7c77d61
Add failing and panicking tests
npazosmendez Aug 3, 2022
5f96514
Use GetNodeOrTagArgs helper for groupByNode
npazosmendez Aug 3, 2022
0e2942f
Merge pull request #51 from grafana/npazosmendez/fix-nil-tags-assignment
npazosmendez Aug 3, 2022
0dd4873
Merge pull request #53 from grafana/npazosmendez/fix-groupByNodes-panic
npazosmendez Aug 3, 2022
1fa2058
Default to xfilesfactor from input series
leizor Aug 3, 2022
4018fb6
Merge pull request #49 from grafana/leizor/aggregate-series-list
leizor Aug 3, 2022
8138b60
Merge pull request #50 from grafana/npazosmendez/fix-out-of-range-panics
npazosmendez Aug 4, 2022
40310c2
Add support for Graphite web movingWindow() function (#26)
carrieedwards Aug 4, 2022
9d91243
Add support for Graphite web exponentialMovingAverage function (#16)
carrieedwards Aug 8, 2022
2b62fc1
Add Github Actions workflow for syncing with upstream (#55)
carrieedwards Aug 8, 2022
dfa2c72
Set target's tag name to string version of window size (#58)
carrieedwards Aug 8, 2022
babf638
Fix error when no series exists in nested functions (#56)
carrieedwards Aug 8, 2022
0a50700
Pin version of ubuntu used for GH actions tests
leizor Aug 9, 2022
3640a73
Merge pull request #63 from grafana/leizor/flaky-tests
leizor Aug 9, 2022
064b23d
Implement verticalLine function
leizor Aug 3, 2022
e81ff9d
Add non-cairo version of verticalLine
leizor Aug 4, 2022
f7e907b
Clarify function for unsupported builds
leizor Aug 9, 2022
80622bb
Add aggregatedBy tag to *SeriesWithWildcards functions
leizor Aug 8, 2022
f862d03
Merge pull request #54 from grafana/leizor/vertical-line
leizor Aug 9, 2022
aa5337a
Merge pull request #59 from grafana/leizor/transmog/issue-1423
leizor Aug 9, 2022
0bcdac8
Add missing tags based on MetricData.Name
leizor Aug 8, 2022
a5b8ada
Add newly supported functions to compatibility doc (#67)
carrieedwards Aug 10, 2022
67f0e64
Merge pull request #66 from grafana/leizor/transmog/issue-1419
leizor Aug 10, 2022
0333910
Merge remote-tracking branch 'upstream/main' into npazosmendez/sync-u…
npazosmendez Aug 10, 2022
cab938e
Merge branch 'main' into npazosmendez/sync-upstream
npazosmendez Aug 10, 2022
8455d27
Pin ubuntu-22.04 to fix build
npazosmendez Aug 10, 2022
e18e46e
Please fix the e2e tests
npazosmendez Aug 10, 2022
ff089eb
Don't run e2e tests with go1.19
npazosmendez Aug 10, 2022
23e4e7e
Fix ubuntu tag again
npazosmendez Aug 10, 2022
65e84f0
Merge pull request #69 from grafana/npazosmendez/sync-upstream
npazosmendez Aug 11, 2022
ed01aa6
Merge branch 'go-graphite:main' into main
leizor Aug 22, 2022
454bfe0
Fix issue with version when syncing upstreaming in Github Actions (#74)
carrieedwards Aug 22, 2022
dd4a8e2
Update divideSeries handling of missing denominators (#73)
carrieedwards Aug 22, 2022
f0faed3
Fix tag handling in nested functions (#76)
carrieedwards Aug 23, 2022
adff392
Revert "Add missing tags based on MetricData.Name"
leizor Aug 23, 2022
70c5ee5
Merge pull request #79 from grafana/revert-66-leizor/transmog/issue-1419
leizor Aug 24, 2022
1cf8078
Allow inf as value for limit parameter in keepLastValue (#83)
carrieedwards Aug 26, 2022
a418fbd
Fix asPercent error when series has more values than totalSeries (#87)
carrieedwards Aug 30, 2022
c627d84
Use ExtractMetric for name parsing in aliasByMetric and sumSeriesWith…
carrieedwards Aug 30, 2022
072c479
Add consolidation function aliases to function mapping (#91)
carrieedwards Aug 30, 2022
299dc9d
Update spacing in removeBelowSeries assignment of name to match Graph…
carrieedwards Aug 31, 2022
5e17caf
Revert module identity change (#94)
npazosmendez Sep 2, 2022
7d90fad
Revert removal of pidfile and implement our own (#95)
npazosmendez Sep 5, 2022
45cf761
Merge remote-tracking branch 'upstream/main' into njpm/merge-upstream
npazosmendez Sep 5, 2022
9485b87
Fix GetCommonTags and its usage in aggregate
npazosmendez Sep 5, 2022
af3bd4c
Merge pull request #96 from grafana/njpm/merge-upstream
npazosmendez Sep 6, 2022
846e900
Delete Drone files and Sync Upstream Action
npazosmendez Sep 7, 2022
14050d5
Fix readme to refernce upstream
npazosmendez Sep 7, 2022
5d001e9
Merge pull request #98 from grafana/njpm/fix-readme
npazosmendez Sep 7, 2022
4ae1e1f
Merge branch 'main' into njpm/upstream-preparation
npazosmendez Sep 7, 2022
d511d4c
Uncomment 1.19 go tests in workflow
npazosmendez Sep 7, 2022
1c79b04
aliasByBase64: use CopyName to set name tag
npazosmendez Sep 9, 2022
9eb0a9e
Avoid fmt.SPrintf calls
npazosmendez Sep 9, 2022
1ecf628
cairo dashed: move arg parse out of cycle
npazosmendez Sep 9, 2022
58d7087
integralByInterval: avoid .Args() call
npazosmendez Sep 9, 2022
6b03de9
AggDiff consolidation: preallocate slice
npazosmendez Sep 9, 2022
d77e3ee
Fix metric name extracting in AggKey
npazosmendez Sep 12, 2022
7b2a1ee
Replace ExtractMetric calls with ExtractNameTag
npazosmendez Sep 12, 2022
4214530
Fix xFilesFactor handling in AggregateSeries and add tests (#107)
carrieedwards Sep 12, 2022
9faff07
Avoid double copy of tags in rangeOfSeries
npazosmendez Sep 12, 2022
2f8c064
Remove redundant isNaN check
leizor Sep 12, 2022
25738b8
Merge remote-tracking branch 'upstream/main' into njpm/upstream-prepa…
npazosmendez Sep 12, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions expr/functions/aliasByBase64/function.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ func (f *aliasByBase64) Do(ctx context.Context, e parser.Expr, from, until int64
if withoutFieldArg {
decoded, err := base64.StdEncoding.DecodeString(a.Name)
if err == nil {
r = a.CopyLink()
r.Name = string(decoded)
r = a.CopyName(string(decoded))
} else {
r = a
}
Expand Down
3 changes: 2 additions & 1 deletion expr/functions/cairo/png/cairo.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"net/http"
"os"
"sort"
"strconv"
"strings"
"time"

Expand Down Expand Up @@ -790,7 +791,7 @@ func EvalExprGraph(ctx context.Context, e parser.Expr, from, until int64, values
return nil, err
}
r.Dashed = d
r.Tags["dashed"] = fmt.Sprintf("%f", d)
r.Tags["dashed"] = strconv.FormatFloat(d, 'g', -1, 64)
npazosmendez marked this conversation as resolved.
Show resolved Hide resolved
case "drawAsInfinite":
r.DrawAsInfinite = true
r.Tags["drawAsInfinite"] = "1"
Expand Down
3 changes: 1 addition & 2 deletions expr/functions/delay/function.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package delay

import (
"context"
"fmt"
"math"

"github.com/go-graphite/carbonapi/expr/helper"
Expand Down Expand Up @@ -65,7 +64,7 @@ func (f *delay) Do(ctx context.Context, e parser.Expr, from, until int64, values

result := series.CopyName("delay(" + series.Name + "," + stepsStr + ")")
result.Values = newValues
result.Tags["delay"] = fmt.Sprintf("%d", steps)
result.Tags["delay"] = stepsStr

results[i] = result
}
Expand Down
3 changes: 1 addition & 2 deletions expr/functions/exp/function.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package exp

import (
"context"
"fmt"
"math"

"github.com/go-graphite/carbonapi/expr/helper"
Expand Down Expand Up @@ -38,7 +37,7 @@ func (f *exp) Do(ctx context.Context, e parser.Expr, from, until int64, values m

for _, a := range args {
r := a.CopyLink()
r.Name = fmt.Sprintf("exp(%s)", a.Name)
r.Name = "exp(" + a.Name + ")"
r.Values = make([]float64, len(a.Values))
r.Tags["exp"] = "e"

Expand Down
2 changes: 1 addition & 1 deletion expr/functions/exponentialMovingAverage/function.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func (f *exponentialMovingAverage) Do(ctx context.Context, e parser.Expr, from,

for _, a := range arg {
r := a.CopyLink()
r.Name = fmt.Sprintf("%s(%s,%s)", e.Target(), a.Name, argstr)
r.Name = e.Target() + "(" + a.Name + "," + argstr + ")"

var vals []float64

Expand Down
3 changes: 1 addition & 2 deletions expr/functions/identity/function.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package identity

import (
"context"
"fmt"

"github.com/go-graphite/carbonapi/expr/interfaces"
"github.com/go-graphite/carbonapi/expr/types"
Expand Down Expand Up @@ -46,7 +45,7 @@ func (f *identity) Do(ctx context.Context, e parser.Expr, from, until int64, val

p := types.MetricData{
FetchResponse: pb.FetchResponse{
Name: fmt.Sprintf("identity(%s)", name),
Name: "identity(" + name + ")",
StartTime: from,
StopTime: until,
StepTime: step,
Expand Down
3 changes: 1 addition & 2 deletions expr/functions/integralByInterval/function.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package integralByInterval

import (
"context"
"fmt"
"math"

"github.com/go-graphite/carbonapi/expr/helper"
Expand Down Expand Up @@ -55,7 +54,7 @@ func (f *integralByInterval) Do(ctx context.Context, e parser.Expr, from, until
current := 0.0
currentTime := arg.StartTime

name := fmt.Sprintf("integralByInterval(%s,'%s')", arg.Name, e.Args()[1].StringValue())
name := "integralByInterval(" + arg.Name + ",'" + e.Args()[1].StringValue() + "')"
npazosmendez marked this conversation as resolved.
Show resolved Hide resolved
result := arg.CopyLink()
result.Name = name
result.PathExpression = name
Expand Down
8 changes: 4 additions & 4 deletions expr/functions/linearRegression/function.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package linearRegression

import (
"context"
"fmt"
"math"
"strconv"

"github.com/go-graphite/carbonapi/expr/consolidations"
"github.com/go-graphite/carbonapi/expr/helper"
Expand Down Expand Up @@ -45,9 +45,9 @@ func (f *linearRegression) Do(ctx context.Context, e parser.Expr, from, until in
for _, a := range arg {
r := a.CopyLink()
if len(e.Args()) > 2 {
r.Name = fmt.Sprintf("linearRegression(%s,'%s','%s')", a.GetName(), e.Arg(1).StringValue(), e.Arg(2).StringValue())
r.Name = "linearRegression(" + a.GetName() + ",'" + e.Arg(1).StringValue() + "','" + e.Arg(2).StringValue() + "')"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also move e.Arg(N).StringValue() outside a cycle/. But not blocking change, may be for simplify PR refactoing we can merge without this.

} else if len(e.Args()) > 1 {
r.Name = fmt.Sprintf("linearRegression(%s,'%s')", a.GetName(), e.Arg(2).StringValue())
r.Name = "linearRegression(" + a.GetName() + ",'" + e.Arg(1).StringValue() + "')"
} else {
r.Name = "linearRegression(" + a.Name + ")"
}
Expand Down Expand Up @@ -88,7 +88,7 @@ func (f *linearRegression) Do(ctx context.Context, e parser.Expr, from, until in
for i := range r.Values {
r.Values[i] = consolidations.Poly(float64(i), c.RawMatrix().Data...)
}
r.Tags["linearRegressions"] = fmt.Sprintf("%d, %d", a.GetStartTime(), a.GetStopTime())
r.Tags["linearRegressions"] = strconv.FormatInt(a.GetStartTime(), 10) + ", " + strconv.FormatInt(a.GetStopTime(), 10)

results = append(results, r)
}
Expand Down
3 changes: 1 addition & 2 deletions expr/functions/movingMedian/function.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package movingMedian

import (
"context"
"fmt"
"math"
"strconv"

Expand Down Expand Up @@ -144,7 +143,7 @@ func (f *movingMedian) Do(ctx context.Context, e parser.Expr, from, until int64,
}
}
}
r.Tags["movingMedian"] = fmt.Sprintf("%d", windowSize)
r.Tags["movingMedian"] = argstr
result[n] = r
}
return result, nil
Expand Down
5 changes: 2 additions & 3 deletions expr/functions/nPercentile/function.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package nPercentile

import (
"context"
"fmt"
"math"
"strconv"

Expand Down Expand Up @@ -46,9 +45,9 @@ func (f *nPercentile) Do(ctx context.Context, e parser.Expr, from, until int64,
results := make([]*types.MetricData, len(arg))
for i, a := range arg {
r := a.CopyLink()
r.Name = fmt.Sprintf("nPercentile(%s,%s)", a.Name, percentStr)
r.Name = "nPercentile(" + a.Name + "," + percentStr + ")"
r.Values = make([]float64, len(a.Values))
r.Tags["nPercentile"] = fmt.Sprintf("%f", percent)
r.Tags["nPercentile"] = percentStr
var values []float64
for _, v := range a.Values {
if !math.IsNaN(v) {
Expand Down
2 changes: 1 addition & 1 deletion expr/functions/offset/function.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func (f *offset) Do(ctx context.Context, e parser.Expr, from, until int64, value

for i, a := range arg {
r := a.CopyLink()
npazosmendez marked this conversation as resolved.
Show resolved Hide resolved
r.Name = fmt.Sprintf("%s(%s,%s)", e.Target(), a.Name, factorStr)
r.Name = e.Target() + "(" + a.Name + "," + factorStr + ")"
r.Values = make([]float64, len(a.Values))
r.Tags[e.Target()] = fmt.Sprintf("%f", factor)

Expand Down
4 changes: 2 additions & 2 deletions expr/functions/offsetToZero/function.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package offsetToZero

import (
"context"
"fmt"
"math"
"strconv"

"github.com/go-graphite/carbonapi/expr/helper"
"github.com/go-graphite/carbonapi/expr/interfaces"
Expand Down Expand Up @@ -42,7 +42,7 @@ func (f *offsetToZero) Do(ctx context.Context, e parser.Expr, from, until int64,
for i, v := range a.Values {
r.Values[i] = v - minimum
}
r.Tags["offsetToZero"] = fmt.Sprintf("%f", minimum)
r.Tags["offsetToZero"] = strconv.FormatFloat(minimum, 'g', -1, 64)
return r
})
}
Expand Down
5 changes: 2 additions & 3 deletions expr/functions/pow/function.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package pow

import (
"context"
"fmt"
"math"
"strconv"

Expand Down Expand Up @@ -45,9 +44,9 @@ func (f *pow) Do(ctx context.Context, e parser.Expr, from, until int64, values m

for j, a := range arg {
r := a.CopyLink()
r.Name = fmt.Sprintf("pow(%s,%s)", a.Name, factorStr)
r.Name = "pow(" + a.Name + "," + factorStr + ")"
r.Values = make([]float64, len(a.Values))
r.Tags["pow"] = fmt.Sprintf("%f", factor)
r.Tags["pow"] = factorStr

for i, v := range a.Values {
if math.IsNaN(v) {
Expand Down
4 changes: 2 additions & 2 deletions expr/functions/removeBelowSeries/function.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package removeBelowSeries

import (
"context"
"fmt"
"math"
"strconv"
"strings"

"github.com/go-graphite/carbonapi/expr/consolidations"
Expand Down Expand Up @@ -72,7 +72,7 @@ func (f *removeBelowSeries) Do(ctx context.Context, e parser.Expr, from, until i
r := a.CopyLink()
r.Name = e.Target() + "(" + a.Name + ", " + numberStr + ")"
r.Values = make([]float64, len(a.Values))
r.Tags["removeBelowSeries"] = fmt.Sprintf("%f", threshold)
r.Tags["removeBelowSeries"] = strconv.FormatFloat(threshold, 'f', -1, 64)

for i, v := range a.Values {
if math.IsNaN(v) || condition(v, threshold) {
Expand Down
5 changes: 3 additions & 2 deletions expr/functions/removeBetweenPercentile/function.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package removeBetweenPercentile

import (
"context"
"fmt"
"math"
"strconv"

"github.com/go-graphite/carbonapi/expr/consolidations"
"github.com/go-graphite/carbonapi/expr/helper"
Expand Down Expand Up @@ -67,9 +67,10 @@ func (f *removeBetweenPercentile) Do(ctx context.Context, e parser.Expr, from, u
}
}

numberStr := strconv.FormatFloat(number, 'f', -1, 64)
for i, a := range args {
r := a.CopyLink()
r.Name = fmt.Sprintf("%s(%s, %g)", e.Target(), a.Name, number)
r.Name = e.Target() + "(" + a.Name + ", " + numberStr + ")"

for _, v := range a.Values {
if !(v > lowerThresholds[i] && v < higherThresholds[i]) {
Expand Down
7 changes: 2 additions & 5 deletions expr/functions/round/function.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package round

import (
"context"
"fmt"
"strconv"

"github.com/go-graphite/carbonapi/expr/helper"
Expand Down Expand Up @@ -41,9 +40,7 @@ func (f *round) Do(ctx context.Context, e parser.Expr, from, until int64, values
if err != nil {
return nil, err
}
if withPrecision {
precisionStr = strconv.Itoa(precision)
}
precisionStr = strconv.Itoa(precision)

results := make([]*types.MetricData, len(arg))
for j, a := range arg {
Expand All @@ -59,7 +56,7 @@ func (f *round) Do(ctx context.Context, e parser.Expr, from, until int64, values
r.Values[i] = helper.SafeRound(v, precision)
}

r.Tags["round"] = fmt.Sprintf("%d", precision)
r.Tags["round"] = precisionStr
results[j] = r

}
Expand Down
4 changes: 1 addition & 3 deletions expr/functions/scale/function.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package scale

import (
"context"
"fmt"
"strconv"

"github.com/go-graphite/carbonapi/expr/helper"
Expand Down Expand Up @@ -51,11 +50,10 @@ func (f *scale) Do(ctx context.Context, e parser.Expr, from, until int64, values
if timestamp == 0 {
r.Name = "scale(" + a.Name + "," + scaleStr + ")"
} else {
r.Name = fmt.Sprintf("scale(%s,%g,%d)", a.Name, scale, timestamp)
r.Name = "scale(" + a.Name + "," + scaleStr + "," + e.Arg(2).StringValue() + ")"
}
r.Values = make([]float64, len(a.Values))
r.Tags["scale"] = fmt.Sprintf("%f", scale)
r.Tags["scale"] = scaleStr

currentTimestamp := a.StartTime
for i, v := range a.Values {
Expand Down
3 changes: 1 addition & 2 deletions expr/functions/scaleToSeconds/function.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package scaleToSeconds

import (
"context"
"fmt"
"strconv"

"github.com/go-graphite/carbonapi/expr/helper"
Expand Down Expand Up @@ -47,7 +46,7 @@ func (f *scaleToSeconds) Do(ctx context.Context, e parser.Expr, from, until int6
r := a.CopyLink()
r.Name = "scaleToSeconds(" + a.Name + "," + secondsStr + ")"
r.Values = make([]float64, len(a.Values))
r.Tags["scaleToSeconds"] = fmt.Sprintf("%f", seconds)
r.Tags["scaleToSeconds"] = secondsStr

factor := seconds / float64(a.StepTime)

Expand Down
3 changes: 1 addition & 2 deletions expr/functions/sigmoid/function.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package sigmoid

import (
"context"
"fmt"
"math"

"github.com/go-graphite/carbonapi/expr/helper"
Expand Down Expand Up @@ -39,7 +38,7 @@ func (f *sigmoid) Do(ctx context.Context, e parser.Expr, from, until int64, valu

for _, a := range arg {
r := a.CopyLink()
r.Name = fmt.Sprintf("sigmoid(%s)", a.Name)
r.Name = "sigmoid(" + a.Name + ")"
r.Values = make([]float64, len(a.Values))
r.Tags["sigmoid"] = "sigmoid"

Expand Down
5 changes: 2 additions & 3 deletions expr/functions/timeSlice/function.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package timeSlice

import (
"context"
"fmt"
"math"
"strconv"
"time"
Expand Down Expand Up @@ -60,8 +59,8 @@ func (f *timeSlice) Do(ctx context.Context, e parser.Expr, from, until int64, va
r := a.CopyLink()
r.Name = "timeSlice(" + a.Name + "," + startStr + "," + endStr + ")"
r.Values = make([]float64, len(a.Values))
r.Tags["timeSliceStart"] = fmt.Sprintf("%d", start)
r.Tags["timeSliceEnd"] = fmt.Sprintf("%d", end)
r.Tags["timeSliceStart"] = startStr
r.Tags["timeSliceEnd"] = endStr

current := from
for i, v := range a.Values {
Expand Down
7 changes: 5 additions & 2 deletions expr/functions/timeStack/function.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package timeStack
import (
"context"
"fmt"
"strconv"

"github.com/go-graphite/carbonapi/expr/helper"
"github.com/go-graphite/carbonapi/expr/interfaces"
Expand Down Expand Up @@ -34,6 +35,7 @@ func (f *timeStack) Do(ctx context.Context, e parser.Expr, from, until int64, va
if err != nil {
return nil, err
}
unitStr := e.Arg(1).StringValue()

start, err := e.GetIntArg(2)
if err != nil {
Expand All @@ -55,13 +57,14 @@ func (f *timeStack) Do(ctx context.Context, e parser.Expr, from, until int64, va
return nil, err
}

offsStr := strconv.FormatInt(offs, 10)
for _, a := range arg {
r := a.CopyLink()
r.Name = fmt.Sprintf("timeShift(%s,%d)", a.Name, offs)
r.StartTime = a.StartTime - offs
r.StopTime = a.StopTime - offs
r.Tags["timeShiftUnit"] = fmt.Sprintf("%d", unit)
r.Tags["timeShift"] = fmt.Sprintf("%d", offs)
r.Tags["timeShiftUnit"] = unitStr
r.Tags["timeShift"] = offsStr
results = append(results, r)
}
}
Expand Down
Loading