rishabhkailey / Grafana-Query-Cache

Grafana Query Cache is an Nginx-powered proxy that accelerates dashboard loading and reduces data source load by caching query results.
MIT License
2 stars 0 forks source link

Add caching support for proxied grafana data sources #7

Open rishabhkailey opened 10 months ago

rishabhkailey commented 10 months ago

Description

Current Limitation: The project's caching mechanism handles queries to standard data sources via the /api/ds/query endpoint. However, it doesn't extend to proxied data sources, which utilize distinct URLs.

Goal: Expand caching capabilities to encompass proxied data source queries, boosting performance and efficiency for these sources.

rishabhkailey commented 10 months ago

proxied data sources are also using the same endpoint for the query. test setup look like the following

setting incorrect socks proxy leads to an error that means grafana is using socks proxy. but still the query endpoint is same as normal data sources query request.

/api/ds/query?ds_type=prometheus&requestId=Q104
{
  "queries": [
    {
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus-proxied"
      },
      "editorMode": "code",
      "expr": "irate(prometheus_http_request_duration_seconds_sum[1m]) / prometheus_http_request_duration_seconds_count",
      "instant": false,
      "legendFormat": "{{ handler }}",
      "range": true,
      "refId": "A",
      "exemplar": false,
      "requestId": "3A",
      "utcOffsetSec": 19800,
      "interval": "",
      "datasourceId": 1,
      "intervalMs": 20000,
      "maxDataPoints": 1001
    }
  ],
  "from": "1705126273740",
  "to": "1705147873740"
}

I'm not sure when Grafana uses data source proxy API.

this Grafana dashboard uses graphite and proxy data source API.

rishabhkailey commented 10 months ago

moving this issue out of POC & Essential Features milestone.