valyala edited a comment on issue #2686:
URL: https://github.com/apache/superset/issues/2686#issuecomment-959239018
@mancubus77 , does Trino/Starburst push down the `element_at(labels, 'code')
= '200'` filter to Prometheus / VictoriaMetrics datasource, so it could be
converted to `{code="200"}` filter in PromQL and passed via `query` arg to
[/api/v1/query](https://prometheus.io/docs/prometheus/latest/querying/api/#instant-queries)
or via `match[]` arg to
[/api/v1/export](https://docs.victoriametrics.com/Single-server-VictoriaMetrics.html#how-to-export-data-in-json-line-format)?
The same question applies to filters on a `timestamp` column, which can be
converted to `start` and `end` query args for `/api/v1/export`. This should
speed up queries, since all the filtering will be performed at Prometheus side.
Another idea is to add a special `prometheus_selector()` function, which
could be used in `WHERE` clause and push down its arg directly to `query` arg
at `/api/v1/query`. For example, the query from your message above could be
rewritten then into a more clear query:
```sql
trino> SELECT count(element_at(labels, 'code')) FROM prometheus.default
where prom_selector('prometheus_http_requests_total{code="200"}');
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]