Good afternoon! Today I will tell you a little about PromQL. It is a query language for time-series databases. Then I'll tell you how we improved it in the VictoriaMetrics database we are developing time-series.
PromQL is a query language used in the Prometheus monitoring system.
PromQL time-series β , SQL, InfluxQL Flux, , Graphite. time-series . , PromQL β time-series , , , time-series .
SQL , time-series .
? node_network_receive_bytes_total
. , timestamps . , . , JOIN.
, PromQL. PromQL .
s
PromQL Grafana. rate, total. counter, , . , . , rate , .
PromQL SQL.
, . . SQL , PromQL. SQL β . :
- SQL SELECT , , PromQL, β , , .
- PromQL JOIN.
- GROUP BY. , .
- . .
- HAVING.
- , SQL.
, time-series . SQL β , time-series .
https://github.com/grafana/grafana/issues/11451
https://github.com/prometheus/prometheus/issues/3746
https://github.com/prometheus/prometheus/issues/3806
PromQL β data model Prometheus PromQL. Brian Brazil.
- , , , , Brain , .
- - β , PromQL , ,
scrape_interval
, .. , . , . - - β ,
increase()
, , , . , 10,increase()
9,5. - , data model Brian Brazil. . . - PromQL , min/max rate. Rate β , . . . rate , , .
- rate
[d]
. , , , rate. , PromQL, . , , , , , Prometheus .
PromQL , Grafana, Grafana , .
, Grafana. .
?
- β VictoriaMetrics. time-series , .
- time-series , long-term remote storage Prometheus, . . Prometheus.
- Prometheus, Influx, OpenTSDB, Graphite, CVS, JSON lines, Prometheus text exposition format.
- VictoriaMetrics PromQL, PromQL.
- VictoriaMetrics PromQL MetricsQL. , . .
:
β rate.
PromQL VictoriaMetrics. VictoriaMetrics PromQL, .
? $__interval
. Grafana , . , . VictoriaMetrics, . rate β rate(m)
, rate(m[$__interval])
.
. . , , 5. , 5 . PromQL : rate(m[5i])
.
. , . . , . , PromQL deriv()
, .
, MetricsQL VictoriaMetrics. . , 5 , , 5 . step()
. .
VictoriaMetrics -, , , , . , Prometheus , VictoriaMetrics , .
Prometheus rate()
, . , , Prometheus . VictoriaMetrics , , , , , scrape_interval
time-series , , . . 0,1 . , 1 , , scrape_interval, . . , Prometheus, , -, 10 .
VictoriaMetrics rollup , . , . .
VictoriaMetrics rollup , rollup. , .
rollup_rate. rate. "" (Counters). , β . MetricsQL.
rollup_rate . , , . , , .
rate , . , . . , , , rate, , rate .
VictoriaMetrics range_*
, . , .
, , , quantile, sum, , .
? , . - rate . rate range_avg()
. , , .
default, , default.
, sinus, , 0,3. sinus. rand, . . . , , , . rand 0, .
labelβ. PromQL labelβ. : label_replace label_join, β , , .
MetricsQLL , labelβ:
- label_set β labels time-series. label bar query.
- label_del β labels query.
- label_keep β labels, , .
- label_copy label_move β label.
https://victoriametrics.com/promql/expand-with-exprs
PromQL , PromQL-, , . WITH templates. common table expressions β CTE. .
β . PromQL-. , {instance=~β$node:$portβ, job=~β$jobβ}
.
WITH templates
. with (cf = {instance=~β$node:$portβ, job=~β$jobβ})
. cf
β , . , . , cf
.
β WITH templates
. ru
, : free, limit, filters. .
Ru β resource usage. Free β , . Limit β . Filters β .
, resource usage resource utilization, . . .
WITH , . node exporter labels. . , , , . resource usage.
. WITH templates
templates. templates. ru, . .
ru MetricsQL VictoriaMetrics, . . WITH . ru.
β , . β . .
MetricsQL, VictoriaMetrics. , - , - . , , .
.
MetricsQL , template meta-variables Grafana.
, Grafana template variables. template variables . Grafana , variables. , , .
, PromQL Grafana , template variables. , , - - , , .
Template meta_variables . , WITH templates variables Grafana, , template meta-variables, Grafana.
issue pull request. issue, PR. Grafana PR. , , : ?
.
template meta-variables. variables, commonFilters. , variables: job, instance.
, , . WITH templates
, Prometheus.
- .
- Template meta-variables meta-variables.
- . , .
- Template meta-vars Prometheus, datasource Grafana.
VictoriaMetrics , .
single-node , . , , . . time-series , . open source . Update: β . single-node
WITH templates Grafana?
. . β template meta-variables, WITH templates .
, , ? InfluxQL, Graphite, Promβ?
, . PromQL MetricsQL, . , , - , MetricsQL.
. . Graphite, ? - ?
time-series , VictoriaMetrics , , . . matric name , value.
Graphite .
Graphite .
VictoriaMetrics . . . .
. . - ?
. Graphite metric name VictoriaMetrics, . . . , Influx line protocol, . (tags & fields). metric names. .
!
alerting. Thanos, PromQL , alerting Prometheus . PromQL alerting, ? alerting?
VictoriaMetrics PromQL, Prometheus. Prometheusβ, . Grafana, Prometheus, datasource url VictoriaMetrics. , . .
alerting β alerting' VictoriaMetrics. . . , alerting Prometheus, VictoriaMetrics. alerting , Prometheus, VictoriaMetrics, alerting rules Prometheus'. datasource. VictoriaMetrics, alerts, alert manager. Update: β vmalert.
VictoriaMetrics ?
VictoriaMetrics , . , . . , . . , . . . , time-series .
. , PromQL.
.
, .
, .
, JOIN. JOIN ? ?
VictoriaMetrics , Prometheus, Graphite, . . . VictoriaMetrics , Prometheus, , VictoriaMetrics.
. . , ?
, . VictoriaMetrics, Thanos, Prometheus', . VictoriaMetrics . . VictoriaMetrics. VictoriaMetrics , . , - , Thanos. Thanos Prometheus', . Prometheus. VictoriaMetrics .
, !
! , VictoriaMetrics single-node, . open source - - ?
Apache2 . , , , . . . , , , VictoriaMetrics.
! InfluxDB, Timescale. ? - benchmarks?
. InfluxDB . . ClickHouse . Altinity, , ClickHouse, . ClickHouse time-series Influx, -. Timescale . . https://altinity.com/blog/tag/benchmark/ .
, . , , . . , .
VictoriaMetrics , ClickHouse, , ClickHouse, . . : - , - .
?
benchmarks , 100 %. ClickHouse, , 100 % CPU .
, !
, ?
. , VictoriaMetrics, , , , . , . storage, google cloud . , - , . . - . . , , . . . , production, , , . Update: VictoriaMetrics β . https://victoriametrics.github.io/Cluster-VictoriaMetrics.html#replication-and-data-safety .
. - , , , ?
, , PromQL. Offset . offset 1d, . β , , , .
- ? . ., , , , ?
PromQL β quantile_over_time. , Prometheus, , , . , quantile_over_time(0.99, m[24h])
99- 24 .
!
How open will the development model be? You will open up now. After that, two options are possible: either we do merge once every six months, and they are there 5 GB each, or you are developing openly
We will try to conduct development openly. Maybe the question is differently paraphrased? Will we merge third-party pull requests?
This is the second part of the question.
We will, but not all. If we can see that they are useful, we will. But we will try to do it differently from Brain Brazil, that is, we will not say that we have a data model and that's it. If there is a good pull request, then we will merge.