-
-
Notifications
You must be signed in to change notification settings - Fork 77
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
Add support for query functions to custom_query_range #241
Comments
Hi @NoahZielke thanks for bringing this up! I believe you're right, I'm also unable to use query functions in start_time = parse_datetime("3d")
end_time = parse_datetime("now")
chunk_size = parse_timedelta("now", "1d")
query = "rate(scrape_duration_seconds[5m])"
metric_data = pc.get_metric_range_data(
query,
start_time=start_time,
end_time=end_time,
chunk_size=chunk_size,
) And yes, it's likely because of the way chunk size is implemented.
I was able to work around this problem by using start_time = parse_datetime("3d")
end_time = parse_datetime("now")
query = "rate(scrape_duration_seconds[5m])"
metric_data = pc.custom_query_range(
query,
start_time=start_time,
end_time=end_time,
step="1d",
) Does this work for your use case too?
Whether |
Yes, using |
Question: If I use
Where Is this right? Or am I crossing the streams (so to speak). Thanks in advance |
This is the "right" way to do it since Prometheus doesn't return a metric name when you use functions. I wasn't sure if the library should add the query string as the name by default. wdyt @chauhankaranraj? |
I encountered same issue with query fuction when using custom_query_range(). Is it possible to add a parameter for custom_query_range() to specify the missing metric name ? |
Hm that's an interesting problem. Do we know if users tend to pass the return value of |
I found that I was unable to use query functions on get_metric_range because of how the chunk is implemented.
Is there another way to use these functions or does this support need to be added? I don't mind trying to add it if it needs it.
The text was updated successfully, but these errors were encountered: