
Selamat sore! Hari ini saya akan bercerita sedikit tentang PromQL. Ini adalah bahasa kueri untuk database deret waktu. Kemudian saya akan memberi tahu Anda bagaimana kami meningkatkannya dalam database VictoriaMetrics yang kami kembangkan deret waktu.

PromQL adalah bahasa kueri yang digunakan dalam sistem pemantauan Prometheus.

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 .
!
Seberapa terbuka model pengembangannya? Anda akan terbuka sekarang. Setelah itu, dua opsi dimungkinkan: kami melakukan penggabungan setiap enam bulan sekali, dan mereka ada di sana selama 5 GB, atau Anda mengembangkan secara terbuka
Kami akan berusaha melakukan pembangunan secara terbuka. Mungkin pertanyaannya diparafrasekan secara berbeda? Apakah kami akan menggabungkan permintaan penarikan pihak ketiga?
Ini adalah bagian kedua dari pertanyaan itu.
Kami akan melakukannya, tapi tidak semua. Jika kami dapat melihat bahwa mereka berguna, kami akan melakukannya. Tetapi kami akan mencoba melakukannya secara berbeda dari Brain Brazil, yaitu, kami tidak akan mengatakan bahwa kami memiliki model data dan hanya itu. Jika ada permintaan tarik yang bagus, maka kami akan menggabungkan.