I'm trying to send request to VictoriaMetrix by API HTTP (from python and Insomnia - same problems), but response which I got do not agree with the response received through UI.
VictoriaMetrcis
PromQL request:
avg_over_time(node_namespace_pod_container:container_cpu_usage_seconds_total:sum_rate{container="test"}[1m])
From 2024-01-17 03:00:00, To 2024-01-17 03:30:00
Result: "value": [
1705451400,
"0.23692520737666"]
Insomnia
GET: http://my-test-victoria.com:8000/api/v1/query
Query:
query = avg_over_time(node_namespace_pod_container:container_cpu_usage_seconds_total:sum_rate{container="test"}[1m])
time = 2024-01-17T03:00:00.00Z
Result: "value": [
1705460400,
"0.01631004441833"]
Python code fragment (using library "requests" for connect with API)
request_params = {
"query": query['query'],
"time": input_datetime
}
responce = http_request(prometheus_common['url'] + "/api/v1/query", request_params)
Question
What am I doing wrong? Result in UI is correct, but HTTP-requests is not.
I tried add params from the VictoriaMetrcis docs and the Prometheus docs
@markalex, was right, thanks! Timestamps was diff.
time = 2024-01-17T03:30:00+03:00
Right time (end) and hard indication of the timezone