Commit graph

2846 commits

Author SHA1 Message Date
Nikolay
544fba6826
lib/storage: pre-create timeseries before indexDB rotation (#4652)
* lib/storage: pre-create timeseries before indexDB rotation
during an hour before indexDB rotation start creating records at the next indexDB
it must improve performance during switch for the next indexDB and remove ingestion issues.
Since there is no need for creation new index records for timeseries already ingested into current indexDB
https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4563

* lib/storage: further work on indexdb rotation optimization

- Document the change at docs/CHAGNELOG.md
- Move back various caches from indexDB to Storage. This makes the change less intrusive.
  The dateMetricIDCache now takes into account indexDB generation, so it stores (date, metricID)
  entries for both the current and the next indexDB.
- Consolidate the code responsible for idbNext pre-filling into prefillNextIndexDB() function.
  This improves code readability and maintainability a bit.
- Rewrite and simplify the code responsible for calculating the next retention timestamp.
  Add various tests for corner cases of this code.
- Remove indexdb pre-filling from RegisterMetricNames() function, since this function is rarely called.
  It is OK to add indexdb entries on demand in this function. This simplifies the code.

Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1401

* docs/CHANGELOG.md: refer to https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4563

---------

Co-authored-by: Aliaksandr Valialkin <valyala@victoriametrics.com>
2023-07-22 15:20:21 -07:00
yrka
44cfcfe62e
Update MetricsQL.md (#4689)
misspell
2023-07-21 18:59:23 +04:00
Zakhar Bessarab
866b150f0f
app/vmalert/datasource/graphite: allow overriding "from" parameter for datasource queries (#4687)
* app/vmalert/datasource/graphite: allow overriding "from" parameter for datasource queries

Fixes construction of URL parameters for graphite render to allow overriding "from" parameter.

See: https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4685
Signed-off-by: Zakhar Bessarab <z.bessarab@victoriametrics.com>

* app/vmalert/datasource/graphite: update flow for building URL parameters

Makes flow of building URL parameters same as Prometheus datasource has:
1) Setting all default values
2) Merging those values with provided `extraParams`

Signed-off-by: Zakhar Bessarab <z.bessarab@victoriametrics.com>

* Update docs/CHANGELOG.md

Co-authored-by: Roman Khavronenko <roman@victoriametrics.com>

---------

Signed-off-by: Zakhar Bessarab <z.bessarab@victoriametrics.com>
Co-authored-by: Roman Khavronenko <roman@victoriametrics.com>
2023-07-21 14:28:10 +04:00
Aliaksandr Valialkin
680a0d43f2
docs/VictoriaLogs/data-ingestion: mention that VictoriaLogs automatically extracts message and timestamp from data ingested via Loki JSON API 2023-07-20 21:11:18 -07:00
Aliaksandr Valialkin
2086c0885d
deployment: update VictoriaLogs Docker image tag from from v0.2.0-victorialogs to v0.3.0-victorialogs 2023-07-20 20:58:41 -07:00
Aliaksandr Valialkin
49d524a5b0
docs/VictoriaLogs/CHANGELOG.md: cut v0.3.0-victorialogs 2023-07-20 20:48:30 -07:00
Aliaksandr Valialkin
49bd2905fa
lib/promscrape: follow-up after 6aa50ca954
- Improve docs
- Hide `debug relabeling` column when -promscrape.dropOriginalLabels command-line flag is set
- Inline the code from the added template functions, since the code is harder to follow
  with the template functions, especially when these functions have misleading names.
  Also, these functions are used only in one place, e.g. they do not reduce the amounts of code.
- Hide `click to show original labels` title at `labels` column when original labels aren't available.
- Show the reason on whey original labels aren't available at /service-discovery page.

Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4597
2023-07-20 19:14:33 -07:00
Aliaksandr Valialkin
b8ba2d5f1a
app/{vmselect,vlselect}: run make vmui-update vmui-logs-update after recent changes to VMUI
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4604
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/pull/4676
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/pull/4294
2023-07-20 17:26:03 -07:00
Aliaksandr Valialkin
8470eb44de
docs/VictoriaLogs/CHANGELOG.md: document the addition of Grafana Loki push protocol support (aka Promtail)
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/pull/4482
2023-07-20 16:53:02 -07:00
Aliaksandr Valialkin
f548adce0b
app/vlinsert/loki: follow-up after 09df5b66fd
- Parse protobuf if Content-Type isn't set to `application/json` - this behavior is documented at https://grafana.com/docs/loki/latest/api/#push-log-entries-to-loki

- Properly handle gzip'ped JSON requests. The `gzip` header must be read from `Content-Encoding` instead of `Content-Type` header

- Properly flush all the parsed logs with the explicit call to vlstorage.MustAddRows() at the end of query handler

- Check JSON field types more strictly.

- Allow parsing Loki timestamp as floating-point number. Such a timestamp can be generated by some clients,
  which store timestamps in float64 instead of int64.

- Optimize parsing of Loki labels in Prometheus text exposition format.

- Simplify tests.

- Remove lib/slicesutil, since there are no more users for it.

- Update docs with missing info and fix various typos. For example, it should be enough to have `instance` and `job` labels
  as stream fields in most Loki setups.

- Allow empty of missing timestamps in the ingested logs.
  The current timestamp at VictoriaLogs side is then used for the ingested logs.
  This simplifies debugging and testing of the provided HTTP-based data ingestion APIs.

The remaining MAJOR issue, which needs to be addressed: victoria-logs binary size increased from 13MB to 22MB
after adding support for Loki data ingestion protocol at https://github.com/VictoriaMetrics/VictoriaMetrics/pull/4482 .
This is because of shitty protobuf dependencies. They must be replaced with another protobuf implementation
similar to the one used at lib/prompb or lib/prompbmarshal .
2023-07-20 16:48:21 -07:00
Aliaksandr Valialkin
2991f8684f
docs/stream-aggregation.md: mention that sum_samples, stddev, stdvar, histogram_bucket and quantiles outputs must be applied only to gauge metrics 2023-07-20 11:32:34 -07:00
Dmytro Kozlov
5b5d8ae51d
docs: update information about tsdb usage in cluster version (#4678)
update information about tsdb usage in cluster version
2023-07-20 20:14:12 +02:00
hagen1778
b9b1661319
docs: fix the next release version for vmalert
Signed-off-by: hagen1778 <roman@victoriametrics.com>
2023-07-20 18:48:21 +02:00
Zakhar Bessarab
4f340411b8
docs: fix broken link to managed VM (#4679)
Signed-off-by: Zakhar Bessarab <z.bessarab@victoriametrics.com>
2023-07-20 17:00:36 +02:00
hagen1778
12b06d78a0
docs: mention streaming aggregation as way to reduce cardinality
Signed-off-by: hagen1778 <roman@victoriametrics.com>
2023-07-20 16:42:38 +02:00
Alexander Marshalov
70773f53d7
allow configuring staleness interval in stream aggregation (#4667) (#4670)
---------

Signed-off-by: Alexander Marshalov <_@marshalov.org>
Co-authored-by: Roman Khavronenko <roman@victoriametrics.com>
2023-07-20 16:07:33 +02:00
hagen1778
a24541bdb7
docs: specify min version and limitations for vmalert's unit tests
Signed-off-by: hagen1778 <roman@victoriametrics.com>
2023-07-20 15:32:49 +02:00
Haleygo
da60a68d09
vmalert: init unit test (#4596)
vmalert: support unit tests

See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/2945 
---------

Signed-off-by: hagen1778 <roman@victoriametrics.com>
Co-authored-by: hagen1778 <roman@victoriametrics.com>
2023-07-20 15:07:10 +02:00
hagen1778
ecab3abb76
docs: mention the simplest way to migrate data in vmctl docs
Signed-off-by: hagen1778 <roman@victoriametrics.com>
2023-07-20 14:39:30 +02:00
Dmytro Kozlov
6aa50ca954
app/vmagent: fix creating target id if --promscrape.dropOriginalLabels flag was used (#4616)
* app/vmagent: fix creating target id if `--promscrape.dropOriginalLabels` flag was used

* app/vmagent: hide links if OriginalLabels was dropped

* app/vmagent: update CHANGELOG.md and added information to the docs

* app/vmagent: fix comments
2023-07-20 10:13:39 +02:00
Zakhar Bessarab
09df5b66fd
app/vlinsert: add support of loki push protocol (#4482)
* app/vlinsert: add support of loki push protocol

- implemented loki push protocol for both Protobuf and JSON formats
- added examples in documentation
- added example docker-compose

Signed-off-by: Zakhar Bessarab <z.bessarab@victoriametrics.com>

* app/vlinsert: move protobuf metric into its own file

Signed-off-by: Zakhar Bessarab <z.bessarab@victoriametrics.com>

* deployment/docker/victorialogs/promtail: update reference to docker image

Signed-off-by: Zakhar Bessarab <z.bessarab@victoriametrics.com>

* deployment/docker/victorialogs/promtail: make volume name unique

Signed-off-by: Zakhar Bessarab <z.bessarab@victoriametrics.com>

* app/vlinsert/loki: add license reference

Signed-off-by: Zakhar Bessarab <z.bessarab@victoriametrics.com>

* deployment/docker/victorialogs/promtail: fix volume name

Signed-off-by: Zakhar Bessarab <z.bessarab@victoriametrics.com>

* docs/VictoriaLogs/data-ingestion: add stream fields for loki JSON ingestion example

Signed-off-by: Zakhar Bessarab <z.bessarab@victoriametrics.com>

* app/vlinsert/loki: move entities to places where those are used

Signed-off-by: Zakhar Bessarab <z.bessarab@victoriametrics.com>

* app/vlinsert/loki: refactor to use common components

- use CommonParameters from insertutils
- stop ingestion after first error similar to elasticsearch and jsonline

Signed-off-by: Zakhar Bessarab <z.bessarab@victoriametrics.com>

* app/vlinsert/loki: address review feedback

- add missing logstorage.PutLogRows calls
- refactor tenant ID parsing to use common function
- reduce number of allocations for parsing by reusing  logfields slices
- add tests and benchmarks for requests processing funcs

Signed-off-by: Zakhar Bessarab <z.bessarab@victoriametrics.com>

---------

Signed-off-by: Zakhar Bessarab <z.bessarab@victoriametrics.com>
2023-07-20 10:10:55 +02:00
Roman Khavronenko
399dc39ee9
docs: mention tags routing for new release (#4566)
* docs: mention tags routing for new release

Signed-off-by: hagen1778 <roman@victoriametrics.com>

* Update docs/Release-Guide.md

---------

Signed-off-by: hagen1778 <roman@victoriametrics.com>
Co-authored-by: Aliaksandr Valialkin <valyala@victoriametrics.com>
2023-07-19 16:55:10 -07:00
Aliaksandr Valialkin
8a91eb25c4
app/vmselect: follow-up after 6a96fd8ed5
- Add `Active queries` chapter to VMUI docs
- Set `Content-Type: json` header inside promql.WriteActiveQueries() handler,
  in order to be consistent with other request handlers called at app/vmselect/main.go
- Pass the request to promql.WriteActiveQueries() handler, so it can change its output
  depending on the provided request params. This also improves consistency of
  promql.WriteActiveQueries() args with other request hanlers at app/vmselect/main.go

Updates https://github.com/VictoriaMetrics/VictoriaMetrics/pull/4653
2023-07-19 16:26:03 -07:00
Yury Molodov
6a96fd8ed5
vmui: add Active Queries page (#4653)
* feat: add page to display a list of active queries (#4598)

* app/vmagent: code formatting

* fix: remove console

---------

Co-authored-by: dmitryk-dk <kozlovdmitriyy@gmail.com>
2023-07-19 15:47:21 -07:00
Aliaksandr Valialkin
262932f517
vendor: update github.com/VictoriaMetrics/metricsql from v0.60.0 to v0.61.1
This adds support for passing durations via WITH template vars:

- `WITH (w = 5m) m[w]` is transformed to `m[5m]`
- `WITH (f(w, step, off) = m[w:step] offset off) f(5m, 10s, 1h)` is transformed to `m[5m:10s] offset 1h`

Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4025
Updates https://github.com/VictoriaMetrics/metricsql/issues/12

See also the initial implementation by @lujiajing1126 at https://github.com/VictoriaMetrics/metricsql/pull/13
2023-07-19 14:59:46 -07:00
hagen1778
4dcf7563ff
docs: typo
Signed-off-by: hagen1778 <roman@victoriametrics.com>
2023-07-19 16:56:24 +02:00
Artem Navoiev
54b7bd4564
specify formating in vmalert doc
Signed-off-by: Artem Navoiev <tenmozes@gmail.com>
2023-07-19 10:43:52 +02:00
Roman Khavronenko
c32a01c52e
docs: follow-up after aec4b5db81 (#4638)
Signed-off-by: hagen1778 <roman@victoriametrics.com>
2023-07-19 10:10:51 +02:00
Roman Khavronenko
25317b4e70
vmalert: follow-up after d4ac4b7813 (#4659)
Signed-off-by: hagen1778 <roman@victoriametrics.com>
2023-07-18 15:53:37 +02:00
hagen1778
99f4f6a653
docs: mention change from 6f3fee197e
Signed-off-by: hagen1778 <roman@victoriametrics.com>
2023-07-18 11:48:06 +02:00
Aliaksandr Valialkin
beaad4a227
docs/VictoriaLogs/CHANGELOG.md: remove newlines inside FEATURE descriptions, since they dont play nicely when copy-n-pasting to https://github.com/VictoriaMetrics/VictoriaMetrics/releases/ 2023-07-17 23:31:27 -07:00
Aliaksandr Valialkin
920cc26793
all: use the new release for VictoriaLogs - v0.2.0-victorialogs 2023-07-17 23:19:46 -07:00
Aliaksandr Valialkin
9c3717412a
docs/VictoriaLogs: add CHANGELOG.md 2023-07-17 23:14:05 -07:00
Aliaksandr Valialkin
ed00b03ecb
lib/logstorage: add abilty to speficy offset for the selected _time filter
The following syntax is supported: _time:filter offset off
For example:

- _time:5m offset 1h - 5-minute duration one hour before the current time
- _time:2023 offset 2w - 2023 year with the 2 weeks offset in the past
2023-07-17 19:07:42 -07:00
Aliaksandr Valialkin
bdfb80668d
lib/logstorage: support for short form of _time:(now-duration, now] filter: _time:duration 2023-07-17 19:07:40 -07:00
Aliaksandr Valialkin
3bf58326e7
lib/logstorage: LogsQL: replace exact_prefix("...") with exact("..."*)
This makes LogsQL queries more consistent with i("...") and i("..."*) syntax
2023-07-17 19:07:40 -07:00
Aliaksandr Valialkin
8815080030
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 19:07:39 -07:00
Aliaksandr Valialkin
be31bdc88c
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:46:34 -07:00
Aliaksandr Valialkin
070365c870
docs/keyConcepts.md: clarify that the number of ,-delimited filters per each or group can be arbitrary
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3997
2023-07-16 23:37:17 -07:00
Aliaksandr Valialkin
dd2c2a6ac8
docs/VictoriaLogs/data-ingestion/README.md: document how to verify whether the data is successfully ingested into VictoriaLogs 2023-07-16 22:53:59 -07:00
Zakhar Bessarab
e2367b6d1c
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:00:39 -07:00
Aliaksandr Valialkin
4cb024d8a3
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-16 00:06:33 -07:00
Artem Navoiev
bc4b6f2cb4
docs: logs disable table of content for pages with no h2-h6, add aliases
Signed-off-by: Artem Navoiev <tenmozes@gmail.com>
2023-07-14 22:56:38 +02:00
Artem Navoiev
68c7b73d99
docs: victorialogs add front-matter for readme pages
Signed-off-by: Artem Navoiev <tenmozes@gmail.com>
2023-07-14 22:21:58 +02:00
Artem Navoiev
d0d3917445
docs: victorialogs add front-matter for data-ingestion items
Signed-off-by: Artem Navoiev <tenmozes@gmail.com>
2023-07-14 22:06:27 +02:00
Aliaksandr Valialkin
a47932f4a2
all: replace ElasticSearch -> Elasticsearch for the sake of consistency
This is a follow-up for 7f6b5dc47b
2023-07-14 10:52:13 -07:00
Aliaksandr Valialkin
10afbd7b12
docs/VictoriaLogs: use exact number when comparing efficiency of VictoriaLogs and Elasticsearch 2023-07-14 10:36:06 -07:00
Haleygo
b002e2a743
vmalert: fix evalTS after modify group interval (#4629) 2023-07-14 14:45:24 +02:00
subham sarkar
7f6b5dc47b
docs: Update README.md (#4613)
Fix grammatical mistakes and also s/ElasticSearch/Elasticsearch
2023-07-14 13:50:56 +02:00
Artem Navoiev
f24fc1c763 fix alias
Signed-off-by: Artem Navoiev <tenmozes@gmail.com>
2023-07-14 03:15:18 -07:00