Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

chore(query-service): update `GoValuateFuncs` definitions (#5106)

Prashant Shahi0f9c8d91efad
diff --git a/pkg/query-service/postprocess/formula.go b/pkg/query-service/postprocess/formula.go
index b88677b0be..f88ceb77a1 100644
--- a/pkg/query-service/postprocess/formula.go
+++ b/pkg/query-service/postprocess/formula.go
@@ -266,20 +266,9 @@ func EvalFuncs() map[string]govaluate.ExpressionFunction {
GoValuateFuncs["radians"] = func(args ...interface{}) (interface{}, error) {
return args[0].(float64) * math.Pi / 180, nil
}
-
+ // Returns the current Unix timestamp in seconds.
GoValuateFuncs["now"] = func(args ...interface{}) (interface{}, error) {
- return time.Now().Unix(), nil
- }
-
- GoValuateFuncs["toUnixTimestamp"] = func(args ...interface{}) (interface{}, error) {
- if len(args) != 1 {
- return nil, fmt.Errorf("toUnixTimestamp requires exactly one argument")
- }
- t, err := time.Parse(time.RFC3339, args[0].(string))
- if err != nil {
- return nil, err
- }
- return t.Unix(), nil
+ return float64(time.Now().Unix()), nil
}
return GoValuateFuncs