Does SigNoz query service cache any queries by def...
# support
p
Does SigNoz query service cache any queries by default ?
s
Yes, it does. There is a flux-interval of 5 minutes to avoid caching anything recent. How did you send data? What kind of queries are these?
p
@Srikanth Chekuri I am sending PromQL queries to the query service. When running the script, I get empty query response (I mean query service does send response, but there are no data points). But when I run the same query through the frontend panel, and run the script again, I get all the data points.
Is there a way to disable it? I am using
query_range
endpoint on
v4
.
s
That doesn't sound like a cache issue to me. Please share more details on how this script is querying
p
@Srikanth Chekuri
Copy code
import requests
import json

url = "<QUERY_SERVICE_URL>/api/v4/query_range"

headers = {
    "authorization": "<AUTH_TOKEN>",
    "content-type": "application/json",
    "Cache-Control": "no-cache"
}

data = {'start': 1721022356, 'end': 1721027356, 'step': 60, 'variables': {}, 'compositeQuery': {'queryType': 'promql', 'panelType': 'graph', 'promQueries': {'default': {'disabled': False, 'legend': '', 'name': 'default', 'query': 'sum(kube_pod_info{cluster="cluster"})'}}}}

try:
    response = requests.post(url, headers=headers, json=data)

    if response.status_code == 200:
        print("Request successful!")
        print(json.dumps(response.json(), indent=2))
    else:
        print(f"Request failed with status code: {response.status_code}")
        print(response.text)

except requests.exceptions.RequestException as e:
    print(f"An error occurred: {e}")
s
The start and end should be in millis.
👍 1