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

function: add support for absent() #152

Closed
wants to merge 7 commits into from
Closed

function: add support for absent() #152

wants to merge 7 commits into from

Conversation

zeus2611
Copy link

Signed-off-by: Nischay itsnischay2604@gmail.com

add support for absent(), related issue #138

http_requests_total{pod="nginx-1"} 0
http_requests_total{pod="nginx-2"} 1`,
query: "absent(http_requests_total[30s])",
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add another test case where there is no data matching the queried series at all?

Copy link
Author

Choose a reason for hiding this comment

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

i will try

Copy link
Member

@GiedriusS GiedriusS left a comment

Choose a reason for hiding this comment

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

Seems like CI failure is related.

@zeus2611
Copy link
Author

can you suggest how i can fix this

@@ -66,6 +66,21 @@ var Funcs = map[string]FunctionCall{
"asinh": simpleFunc(math.Asinh),
"acosh": simpleFunc(math.Acosh),
"atanh": simpleFunc(math.Atanh),
"absent": func(f FunctionArgs) promql.Sample{
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess we need to fix the series labels. Please refer to upstream Prometheus and see how it implements absent https://github.com/prometheus/prometheus/blob/main/promql/functions.go#L591

Copy link
Author

Choose a reason for hiding this comment

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

should i try to implement functions in promql-engine in similar way as promql function in prometheus

@fpetkovski
Copy link
Collaborator

@zeus2611 you can run make test locally to see where tests fail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants