Address review comments

Signed-off-by: Levi Harrison <git@leviharrison.dev>
This commit is contained in:
Levi Harrison 2021-09-26 15:45:25 -04:00
parent e27ac3e7e4
commit 2f896c98ff
4 changed files with 10 additions and 2 deletions

View File

@ -44,7 +44,7 @@ the result.
The following trigonometric binary operators, which work in radians, exist in Prometheus: The following trigonometric binary operators, which work in radians, exist in Prometheus:
* `atan2` (https://pkg.go.dev/math#Atan2, _This is experimental_) * `atan2` (based on https://pkg.go.dev/math#Atan2, _This is experimental_)
Trigonometric operators allow trigonometric functions to be executed on two vectors using Trigonometric operators allow trigonometric functions to be executed on two vectors using
vector matching, which isn't available with normal functions. They act in the same manner vector matching, which isn't available with normal functions. They act in the same manner

View File

@ -17,7 +17,6 @@
@precedence { @precedence {
pow @right, pow @right,
mul @left mul @left
atan2 @left,
add @left, add @left,
eql @left, eql @left,
and @left, and @left,

View File

@ -840,3 +840,10 @@ sum:my_metric_name:rate5m
==> ==>
MetricName(MetricIdentifier(Identifier)) MetricName(MetricIdentifier(Identifier))
# Testing Atan2 inherited precedence level
1 + foo atan2 bar
==>
PromQL(Expr(BinaryExpr(Expr(NumberLiteral),Add,BinModifiers,Expr(BinaryExpr(Expr(VectorSelector(MetricIdentifier(Identifier))),Atan2,BinModifiers,Expr(VectorSelector(MetricIdentifier(Identifier))))))))

View File

@ -14,6 +14,7 @@
import { import {
And, And,
Avg, Avg,
Atan2,
Bool, Bool,
Bottomk, Bottomk,
By, By,
@ -58,6 +59,7 @@ export const specializeIdentifier = (value, stack) => {
const contextualKeywordTokens = { const contextualKeywordTokens = {
avg: Avg, avg: Avg,
atan2: Atan2,
bottomk: Bottomk, bottomk: Bottomk,
count: Count, count: Count,
count_values: CountValues, count_values: CountValues,