diff --git a/README.md b/README.md index de5fcd1cb7..c8f372521c 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ Cluster version is available [here](https://github.com/VictoriaMetrics/VictoriaM ## Prominent features * Supports [Prometheus querying API](https://prometheus.io/docs/prometheus/latest/querying/api/), so it can be used as Prometheus drop-in replacement in Grafana. - Additionally, VictoriaMetrics extends PromQL with opt-in [useful features](https://github.com/VictoriaMetrics/VictoriaMetrics/wiki/ExtendedPromQL). + VictoriaMetrics implements [MetricsQL](https://github.com/VictoriaMetrics/VictoriaMetrics/wiki/ExtendedPromQL) query language, which is inspired by PromQL. * Supports global query view. Multiple Prometheus instances may write data into VictoriaMetrics. Later this data may be used in a single query. * High performance and good scalability for both [inserts](https://medium.com/@valyala/high-cardinality-tsdb-benchmarks-victoriametrics-vs-timescaledb-vs-influxdb-13e6ee64dd6b) and [selects](https://medium.com/@valyala/when-size-matters-benchmarking-victoriametrics-vs-timescale-and-influxdb-6035811952d4). diff --git a/docs/ExtendedPromQL.md b/docs/ExtendedPromQL.md index e9ac32fb64..81e9ed4712 100644 --- a/docs/ExtendedPromQL.md +++ b/docs/ExtendedPromQL.md @@ -1,9 +1,24 @@ -# PromQL extensions +# MetricsQL -VictoriaMetrics supports [standard PromQL](https://prometheus.io/docs/prometheus/latest/querying/basics/) -including [subqueries](https://prometheus.io/blog/2019/01/28/subquery-support/). -Additionally it supports useful extensions mentioned below. -Try these extensions on [an editable Grafana dashboard](http://play-grafana.victoriametrics.com:3000/d/4ome8yJmz/node-exporter-on-victoriametrics-demo). +VictoriaMetrics implements MetricsQL - query language inspired by [PromQL](https://prometheus.io/docs/prometheus/latest/querying/basics/). +It is backwards compatible with PromQL, so Grafana dashboards backed by Prometheus datasource should work the same after switching from Prometheus to VictoriaMetrics. + +The following functionality is implemented differently in MetricsQL comparing to PromQL in order to improve user experience: +* MetricsQL takes into account the previous point before the window in square brackets for range functions such as `rate` and `increase`. + It also doesn't extrapolate range function results. This addresses [this issue from Prometheus](https://github.com/prometheus/prometheus/issues/3746). +* MetricsQL returns the expected non-empty responses for requests with `step` values smaller than scrape interval. This addresses [this issue from Grafana](https://github.com/grafana/grafana/issues/11451). +* MetricsQL treats `scalar` type the same as `instant vector` without labels, since users usually don't feel the difference between these types. + See [the corresponding Prometheus docs](https://prometheus.io/docs/prometheus/latest/querying/basics/#expression-language-data-types) for details. + +Other PromQL functionality should work the same in MetricsQL. [File an issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues) +if you notice discrepancies between PromQL and MetricsQL results other than mentioned above. + +MetricsQL provides additional functionality mentioned below, which is aimed towards solving practical cases. +Feel free [filing a feature request](https://github.com/VictoriaMetrics/VictoriaMetrics/issues) if you think MetricsQL misses certain useful functionality. + +*Note that the functionality mentioned below doesn't work in PromQL, so it is impossible switching back to Prometheus after you start using it.* + +This functionality can be tried at [an editable Grafana dashboard](http://play-grafana.victoriametrics.com:3000/d/4ome8yJmz/node-exporter-on-victoriametrics-demo). - [`WITH` templates](https://play.victoriametrics.com/promql/expand-with-exprs). This feature simplifies writing and managing complex queries. Go to [`WITH` templates playground](https://victoriametrics.com/promql/expand-with-exprs) and try it. - Metric names and metric labels may contain escaped chars. For instance, `foo\-bar{baz\=aa="b"}` is valid expression. It returns time series with name `foo-bar` containing label `baz=aa` with value `b`. Additionally, `\xXX` escape sequence is supported, where `XX` is hexadecimal representation of escaped char. diff --git a/docs/Home.md b/docs/Home.md index 116b338d87..1cd7b74b5b 100644 --- a/docs/Home.md +++ b/docs/Home.md @@ -3,10 +3,11 @@ * [Quick start](Quick-Start) * [`WITH` templates playground](https://play.victoriametrics.com/promql/expand-with-exprs) * [Grafana playground](http://play-grafana.victoriametrics.com:3000/d/4ome8yJmz/node-exporter-on-victoriametrics-demo) -* [PromQL extensions](ExtendedPromQL) +* [MetricsQL](ExtendedPromQL) * [Single-node version](Single-server-VictoriaMetrics) * [FAQ](FAQ) * [Cluster version](Cluster-VictoriaMetrics) * [Articles](Articles) +* [CaseStudies](Case studies) * [vmbackup](vmbackup) * [vmrestore](vmrestore) diff --git a/docs/Single-server-VictoriaMetrics.md b/docs/Single-server-VictoriaMetrics.md index 241af1b334..b311e19511 100644 --- a/docs/Single-server-VictoriaMetrics.md +++ b/docs/Single-server-VictoriaMetrics.md @@ -18,7 +18,7 @@ Cluster version is available [here](https://github.com/VictoriaMetrics/VictoriaM ## Prominent features * Supports [Prometheus querying API](https://prometheus.io/docs/prometheus/latest/querying/api/), so it can be used as Prometheus drop-in replacement in Grafana. - Additionally, VictoriaMetrics extends PromQL with opt-in [useful features](https://github.com/VictoriaMetrics/VictoriaMetrics/wiki/ExtendedPromQL). + VictoriaMetrics implements [MetricsQL](https://github.com/VictoriaMetrics/VictoriaMetrics/wiki/ExtendedPromQL) query language, which is inspired by PromQL. * Supports global query view. Multiple Prometheus instances may write data into VictoriaMetrics. Later this data may be used in a single query. * High performance and good scalability for both [inserts](https://medium.com/@valyala/high-cardinality-tsdb-benchmarks-victoriametrics-vs-timescaledb-vs-influxdb-13e6ee64dd6b) and [selects](https://medium.com/@valyala/when-size-matters-benchmarking-victoriametrics-vs-timescale-and-influxdb-6035811952d4). @@ -395,6 +395,18 @@ VictoriaMetrics supports the following handlers from [Prometheus querying API](h These handlers can be queried from Prometheus-compatible clients such as Grafana or curl. +VictoriaMetrics accepts additional args for `/api/v1/labels` and `/api/v1/label/.../values` handlers. +See [this feature request](https://github.com/prometheus/prometheus/issues/6178) for details: + +* Any number [time series selectors](https://prometheus.io/docs/prometheus/latest/querying/basics/#time-series-selectors) via `match[]` query arg. +* Optional `start` and `end` query args for limiting the time range for the selected labels or label values. + +Additionally VictoriaMetrics provides the following handlers: + +* `/api/v1/series/count` - it returns the total number of time series in the database. Note that this handler scans all the inverted index, + so it can be slow if the database contains tens of millions of time series. +* `/api/v1/labels/count` - it returns a list of `label: values_count` entries. It can be used for determining labels with the maximum number of values. + ### How to build from sources