Aliaksandr Valialkin
5ace0701d3
app/vmselect/promql: add the ability to copy all the labels from one
side of group_left()/group_right() operation
...
This is performed by specifying `*` inside group_left()/group_right().
Also allow specifying prefix for the copied labels via `group_left(...) prefix "..."` and `group_right(...) prefix "..."` syntax.
For example, the following query adds all the namespace-related labels to pod info, and prefixes all the copied label names with "ns_" prefix:
kube_pod_info * on(namespace) group_left(*) prefix "ns_" kube_namespace_labels
This resolves the following StackOverflow questions:
- https://stackoverflow.com/questions/76661818/how-to-add-namespace-labels-to-pod-labels-in-prometheus
- https://stackoverflow.com/questions/76653997/how-can-i-make-a-new-copy-of-kube-namespace-labels-metric-with-a-different-name
2023-07-17 16:58:30 -07:00
Aliaksandr Valialkin
cc54fa2a56
app/vmselect/promql: recommend to use (a op b) keep_metric_names
instead of a op b keep_metric_names
...
The `a op b keep_metric_names` is ambigouos to `a op (b keep_metric_names)` when `b` is a transform or rollup function.
For example, `a + rate(b) keep_metric_names`. So it is better to use more clear syntax: `(a op b) keep_metric_names`
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3710
2023-07-16 23:47:15 -07:00
Zakhar Bessarab
781947a7e2
metricsql: add support of using keep_metric_names for binary operations ( #4109 )
...
* metricsql: add support of using keep_metric_names for binary operations
This should help to avoid confusion with queries like one in the issue #3710 .
Signed-off-by: Zakhar Bessarab <z.bessarab@victoriametrics.com>
* wip
---------
Signed-off-by: Zakhar Bessarab <z.bessarab@victoriametrics.com>
Co-authored-by: Aliaksandr Valialkin <valyala@victoriametrics.com>
2023-07-16 03:01:27 -07:00
Aliaksandr Valialkin
a7fdc3fcc7
all: add support for or
filters in series selectors
...
This commit adds ability to select series matching distinct filters via a single series selector.
For example, the following selector selects series with either {env="prod",job="a"}
or {env="dev",job="b"} labels:
{env="prod",job="a" or env="dev",job="b"}
The `or` filter is supported in all the VictoriaMetrics tools now.
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3997
Uses https://github.com/VictoriaMetrics/metricsql/pull/14
2023-07-15 23:56:18 -07:00
hagen1778
b43d27275d
docs/metricsql: fix typo in expression
...
Signed-off-by: hagen1778 <roman@victoriametrics.com>
2023-07-06 21:28:01 -07:00
Alexander Marshalov
d321ea91f2
fixed typos in documentation and commandline flags descriptions ( #4275 )
2023-05-10 02:22:06 -07:00
Artem Navoiev
283a75afba
prepare static docs to migration
...
Signed-off-by: Artem Navoiev <tenmozes@gmail.com>
2023-05-08 21:54:20 -07:00
Aliaksandr Valialkin
229b39ac7d
docs/MetricsQL.md: quote min, max and avg args for rollup_*() functions in order to reduce the level of confusion when users try to pass the second argument to these functions
2023-03-26 00:02:01 -07:00
Roman Khavronenko
79eb33556e
metricsql: support optional 2nd argument for rollup functions ( #3841 )
...
* metricsql: support optional 2nd argument for rollup functions
Support optional 2nd argument `min`, `max` or `avg` for rollup functions:
* rollup
* rollup_delta
* rollup_deriv
* rollup_increase
* rollup_rate
* rollup_scrape_interval
If second argument is passed, then rollup function will return only the selected aggregation type.
This change can be useful for situations where only one type of rollup calculation is needed.
For example, `rollup_rate(requests_total[5m], "max")`.
Signed-off-by: hagen1778 <roman@victoriametrics.com>
* wip
---------
Signed-off-by: hagen1778 <roman@victoriametrics.com>
Co-authored-by: Aliaksandr Valialkin <valyala@victoriametrics.com>
2023-02-24 13:48:30 -08:00
Aliaksandr Valialkin
a15da5ff73
app/vmselect/promql: add share(q)
aggregate function for normalizing results across multiple time series in [0..1] value range per each timestamp and aggregation group
2023-02-18 22:43:54 -08:00
Aliaksandr Valialkin
84b5532bc1
app/vmselect/promql: add range_zscore(q) and range_trim_zscore(z, q) functions
...
These functions may be useful for dropping outliers at https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3759
2023-02-18 22:43:53 -08:00
Aliaksandr Valialkin
450b6f6d39
app/vmselect/promql: add range_mad(q) and range_trim_outliers(k, q) functions
...
These functions may help trimming outliers during query time
for the use case described at https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3759
2023-02-18 15:18:47 -08:00
Aliaksandr Valialkin
db7f237da9
app/vmselect/promql: add mad_over_time(m[d])
function
...
See https://github.com/prometheus/prometheus/issues/5514
2023-02-11 01:06:39 -08:00
Aliaksandr Valialkin
6910dd2a98
docs/MetricsQL.md: add links to "rollup results" explanation
2023-02-03 11:10:49 -08:00
Aliaksandr Valialkin
78114e85d6
vendor: update github.com/VictoriaMetrics/metricsql from v0.50.0 to v0.51.0
...
Updates https://github.com/VictoriaMetrics/metricsql/pull/7
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3589
2023-01-05 01:50:26 -08:00
Aliaksandr Valialkin
6d13ca2b88
app/vmselect: add /select/0/prometheus/expand-with-exprs page
2022-12-14 16:23:17 -08:00
Aliaksandr Valialkin
c902500efc
app/vmselect/promql: add range_trim_spikes(phi, q) function for trimming phi percent of largest spikes per each time series returned by q
2022-12-05 21:55:24 -08:00
Aliaksandr Valialkin
6b2c85d6bf
docs/MetricsQL.md: document that histogram_share()
accepts optional boundsLabel
arg
2022-11-24 17:27:43 -08:00
Aliaksandr Valialkin
ad548abd6a
app/vmselect/promql: add range_normalize(q1, ..., qN)
function for normalizing query results into [0..1] value range
...
This may be useful for analyzing correlation between time series with different value ranges
2022-11-21 23:25:35 +02:00
Aliaksandr Valialkin
9cb76c9cd3
app/vmselect/promql: allow using SI and IEC suffixes in numeric values inside queries
...
For example, 10Ki is equivalent to 10*1024, while 5.3M is equivalent to 5.3*1000*1000
2022-11-21 21:28:34 +02:00
Aliaksandr Valialkin
0cc59b9f95
app/vmselect/promql: add range_stdvar()
and range_stddev()
functions for calculating variance and deviation over time series on the selected time range
2022-11-17 01:03:02 +02:00
Aliaksandr Valialkin
facf7efa3a
app/vmselect/promql: add range_linear_regression(q)
function for calculating simple linear regression for the selected time series on the selected time range
2022-11-17 00:39:17 +02:00
Aliaksandr Valialkin
704794f164
docs/MetricsQL.md: document that input histograms must have the same set of buckets when calculating the quantile over them
...
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3231
2022-10-14 14:00:26 +03:00
Aliaksandr Valialkin
b631b2bd64
docs/MetricsQL.md: formatting improvements
...
Also put a link to the function type in docs for every function.
This should simplify understanding of MetricsQL functions for novice users.
2022-10-07 00:54:41 +03:00
Roman Khavronenko
b8c4c36b89
docs: clarify numeric label values for label_value
( #3129 )
...
https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3114
Signed-off-by: hagen1778 <roman@victoriametrics.com>
Signed-off-by: hagen1778 <roman@victoriametrics.com>
2022-09-26 16:49:45 +03:00
Dmytro Kozlov
36ea8537d9
vmselect/promql: add alphanumeric sort by label (sort_by_label_numeric) ( #2982 )
...
* vmselect/promql: add alphanumeric sort by label (sort_by_label_numeric)
* vmselect/promql: fix tests, add documentation
* vmselect/promql: update test
* vmselect/promql: update for alphanumeric sorting, fix tests
* vmselect/promql: remove comments
* vmselect/promql: cleanup
* vmselect/promql: avoid memory allocations, update functions descriptions
* vmselect/promql: make linter happy (remove ineffectual assigment)
* vmselect/promql: add test case, fix behavior when strings are equal
* vendor: update github.com/VictoriaMetrics/metricsql from v0.44.1 to v0.45.0
this adds support for sort_by_label_numeric and sort_by_label_numeric_desc functions
* wip
* lib/promscrape: read response body into memory in stream parsing mode before parsing it
This reduces scrape duration for targets returning big responses.
The response body was already read into memory in stream parsing mode before this change,
so this commit shouldn't increase memory usage.
* wip
Co-authored-by: Aliaksandr Valialkin <valyala@victoriametrics.com>
2022-09-14 17:42:07 +03:00
John Belmonte
eb0b2ef3d9
MetricsQL doc spellcheck ( #3080 )
2022-09-08 21:28:49 +03:00
Dmytro Kozlov
2cf29cc4d1
vmselect/promql: fix panic in histogram_quantiles function ( #3029 )
...
* vmselect/promql: fix panic in histogram_quantiles function
* Update docs/MetricsQL.md
Co-authored-by: Roman Khavronenko <roman@victoriametrics.com>
Co-authored-by: Aliaksandr Valialkin <valyala@victoriametrics.com>
Co-authored-by: Roman Khavronenko <roman@victoriametrics.com>
2022-08-27 01:34:54 +03:00
Aliaksandr Valialkin
d39915ff8e
docs/MetricsQL.md: add the list of supported ... functions
lines just before the corresponding lists
...
This improves the readability a bit
2022-08-16 12:10:09 +03:00
Aliaksandr Valialkin
979444b4ed
all: fix other typos in the same way as 6f4d9b2a48
does
2022-07-18 12:10:41 +03:00
Roman Khavronenko
3ada676879
docs: reference links from key concepts ( #2745 )
...
Signed-off-by: hagen1778 <roman@victoriametrics.com>
Co-authored-by: Aliaksandr Valialkin <valyala@victoriametrics.com>
2022-06-19 23:14:30 +03:00
Denis Fondras
53b68eb254
Fix typo ( #2538 )
2022-05-05 21:16:39 +03:00
Peter Dupej
9e193fb764
Update MetricsQL.md ( #2519 )
...
remove typo from label_replace doc.
2022-05-02 09:43:57 +03:00
Aliaksandr Valialkin
83db416567
docs/MetricsQL.md: clarify keep_metric_names docs
2022-04-27 11:25:02 +03:00
Aliaksandr Valialkin
6eb1580158
app/vmselect/promql: add tlast_change_over_time(m[d])
function, which returns the timestamp for the last change of m
on the given lookbehind window d
2022-04-27 10:58:40 +03:00
Aliaksandr Valialkin
a5cfe5d13e
app/vmselect/promql: add drop_common_labels()
function
2022-04-21 14:20:36 +03:00
Roman Khavronenko
5b367ad594
docs: update increase_prometheus
desc ( #2381 )
...
Remove note that this func is supported by PromQL.
2022-03-28 12:29:41 +03:00
Dima Lazerka
6e8e385375
VMAnomaly docs fixes ( #2361 )
...
* Added docs for vmanomaly
* Add example images
* Stylistic fixes
* Move images to root
* Update docs/vmanomaly.md
* Update docs/vmanomaly.md
Co-authored-by: Roman Khavronenko <roman@victoriametrics.com>
* Squeeze vmanomaly after vmbackupmanager before Case Studies
Co-authored-by: Aliaksandr Valialkin <valyala@victoriametrics.com>
Co-authored-by: Roman Khavronenko <roman@victoriametrics.com>
2022-03-25 12:09:05 +02:00
Arash Hatami
2e01691d5d
A good change for MD files ( #2353 )
...
* Lint YAML
* Remove extra comment
* Fix command problem
* Format MD files
* Format & fix problem of MD files for docs
* Another fix for MD files
2022-03-22 14:01:04 +02:00
Aliaksandr Valialkin
5a1e4a140f
app/vmselect/promql: implement keep_metric_names
modifier for transform and rollup functions
...
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/949
2022-01-14 04:15:35 +02:00
Aliaksandr Valialkin
53c9a81f2b
app/vmselect/promql: add stale_samples_over_time()
function
2022-01-14 01:49:24 +02:00
Aliaksandr Valialkin
0580a58feb
app/vmselect/promql: add support for @
modifier
...
Add support for `@` modifier in MetricsQL according to https://prometheus.io/docs/prometheus/latest/querying/basics/#modifier
Extend the support with the following features:
* Allow using `@` modifier everywhere in the query. For example, `sum(foo) @ end()`
* Allow using arbitrary expression as `@` modifier. For example, `foo @ (end() - 1h)`
returns `foo` value at `end - 1 hour` timestamp on the selected time range `[start ... end]`
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1348
2022-01-13 22:15:19 +02:00
Aliaksandr Valialkin
3396f08874
app/vmselect/promql: follow-up after 177e345d8a
...
* Document changes_prometheus(), increase_prometheus() and delta_prometheus() functions.
* Simplify their implementation
* Mention these functions in docs/CHANGELOG.md
2021-12-20 13:15:06 +02:00
Roman Khavronenko
a92f53486a
docs: update MetricsQL
.Subquery
section description ( #1951 )
...
* simplify sentences;
* fix typo.
Signed-off-by: hagen1778 <roman@victoriametrics.com>
2021-12-17 11:52:42 +02:00
Aliaksandr Valialkin
c170841951
app/vmselect/promql: add timestamp_with_name(m[d])
function
...
This function works the same as `timestamp()`, but doesn't remove source time series names.
See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/949#issuecomment-995222388
2021-12-15 23:38:09 +02:00
Aliaksandr Valialkin
c922c7af9a
lib/storage: convert alternate regexps into Graphite wildcards inside __graphite__
pseudo-label
...
For example, `{__graphite__=~"foo.(bar|baz)"}` is automatically converted to `{__graphite__=~"foo.{bar,baz}"}` before execution.
This allows using multi-value Grafana template variables such as `{__graphite__=~"foo.($app)"}`.
2021-12-14 19:55:59 +02:00
Aliaksandr Valialkin
addae7fc6a
app/vmselect/promql: preserve the order of time series passed to limit_offset()
function
...
Previously time series passed to `limit_offset()` were shuffled according to hash for their labels.
This was unexpected behaviour for most users.
See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1920 and https://github.com/VictoriaMetrics/VictoriaMetrics/issues/951
2021-12-12 18:07:15 +02:00
Aliaksandr Valialkin
aa6d11a33f
app/vmselect/promql: add now()
function, which returns the current timestamp as a floating-point value in seconds
2021-11-17 16:42:11 +02:00
Aliaksandr Valialkin
a352b59b7e
docs/MetricsQL.md: mention than tlast_over_time() is an alias for timestamp()
2021-11-08 18:29:59 +02:00
Aliaksandr Valialkin
3a1ac218ba
app/vmselect/promql: add duration_over_time(m[d], max_interval)
function
...
This function calculates the actual lifetime of the time series on the given lookbehdind window `d`
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1780
2021-11-08 13:14:57 +02:00