PromQL: export function list (#6434)

This PR exports the list of supported PromQL functions and their signatures.

The reason for that is that the PromQL language server likes to use that list.

Signed-off-by: Tobias Guggenmos <tguggenm@redhat.com>
This commit is contained in:
Tobias Guggenmos 2019-12-09 15:33:43 +00:00 committed by Brian Brazil
parent 0ae048ff78
commit cd39ebe7c6
1 changed files with 3 additions and 2 deletions

View File

@ -907,7 +907,8 @@ func funcYear(vals []Value, args Expressions, enh *EvalNodeHelper) Vector {
}) })
} }
var functions = map[string]*Function{ // Functions is a list of all functions supported by PromQL, including their types.
var Functions = map[string]*Function{
"abs": { "abs": {
Name: "abs", Name: "abs",
ArgTypes: []ValueType{ValueTypeVector}, ArgTypes: []ValueType{ValueTypeVector},
@ -1197,7 +1198,7 @@ var functions = map[string]*Function{
// getFunction returns a predefined Function object for the given name. // getFunction returns a predefined Function object for the given name.
func getFunction(name string) (*Function, bool) { func getFunction(name string) (*Function, bool) {
function, ok := functions[name] function, ok := Functions[name]
return function, ok return function, ok
} }