### Describe Your Changes - Doc updates on v1.14.1 - v1.14.2 of `vmanomaly` - [Changelog](https://docs.victoriametrics.com/anomaly-detection/changelog/) page - [Reader](https://docs.victoriametrics.com/anomaly-detection/components/reader/#vm-reader) page (`queries` arg refactor) - Also, a slight modification of `presets` [page](https://docs.victoriametrics.com/anomaly-detection/presets/) ### Checklist The following checks are **mandatory**: - [ ] My change adheres [VictoriaMetrics contributing guidelines](https://docs.victoriametrics.com/contributing/).
7.6 KiB
sort | title | weight | menu | aliases | |||||||
---|---|---|---|---|---|---|---|---|---|---|---|
2 | Reader | 2 |
|
|
VictoriaMetrics Anomaly Detection (vmanomaly
) primarily uses VmReader to ingest data. This reader focuses on fetching time-series data directly from VictoriaMetrics with the help of powerful MetricsQL expressions for aggregating, filtering and grouping your data, ensuring seamless integration and efficient data handling.
Future updates will introduce additional readers, expanding the range of data sources vmanomaly
can work with.
VM reader
Note
: Starting from v1.13.0 there is backward-compatible change of
queries
arg of VmReader. New format allows to specify per-query parameters, likestep
to reduce amount of data read from VictoriaMetrics TSDB and to allow config flexibility. Please see per-query parameters section for the details.
Old format like
# other config sections ...
reader:
class: 'vm'
datasource_url: 'http://localhost:8428' # source victoriametrics/prometheus
sampling_period: "10s" # set it <= min(infer_every) in schedulers section
queries:
# old format {query_alias: query_expr}, prior to 1.13, will be converted to a new format automatically
vmb: 'avg(vm_blocks)'
will be converted to a new one with a warning raised in logs:
# other config sections ...
reader:
class: 'vm'
datasource_url: 'http://localhost:8428' # source victoriametrics/prometheus
sampling_period: '10s'
queries:
# old format {query_alias: query_expr}, prior to 1.13, will be converted to a new format automatically
vmb:
expr: 'avg(vm_blocks)' # initial MetricsQL expression
step: '10s' # individual step for this query, will be filled with `sampling_period` from the root level
# new query-level arguments will be added in backward-compatible way in future releases
Per-query parameters
Starting from v1.13.0 there is change of queries
arg format. Now each query alias supports the next (sub)fields:
-
expr
(string): MetricsQL/PromQL expression that defines an input for VmReader. As accepted by/query_range?query=%s
. i.e.avg(vm_blocks)
-
step
(string): query-level frequency of the points returned, i.e.30s
. Will be converted to/query_range?step=%s
param (in seconds). Useful to optimize total amount of data read from VictoriaMetrics, where different queries may have different frequencies for different machine learning models to run on.Note
: if not set explicitly (or if older config style prior to v1.13.0) is used, then it is set to reader-level
sampling_period
arg.Note
: having different individual
step
args for queries (i.e.30s
forq1
and2m
forq2
) is not yet supported for multivariate model if you want to run it on several queries simultaneously (i.e. settingqueries
arg of a model to [q1
,q2
]).
Per-query config example
reader:
class: 'vm'
sampling_period: '1m'
# other reader params ...
queries:
ingestion_rate:
expr: 'sum(rate(vm_rows_inserted_total[5m])) by (type) > 0'
step: '2m' # overrides global `sampling_period` of 1m
Config parameters
Parameter | Example | Description |
---|---|---|
|
|
Name of the class needed to enable reading from VictoriaMetrics or Prometheus. VmReader is the default option, if not specified. |
|
See per-query config example above |
See per-query config section above |
|
|
Datasource URL address |
|
|
For VictoriaMetrics Cluster version only, tenants are identified by accountID or accountID:projectID. See VictoriaMetrics Cluster multitenancy docs |
|
|
Frequency of the points returned. Will be converted to |
|
|
Performs PromQL/MetricsQL range query |
|
|
Absolute or relative URL address where to check availability of the datasource. |
|
|
BasicAuth username |
|
|
BasicAuth password |
|
|
Timeout for the requests, passed as a string |
|
|
Allows disabling TLS verification of the remote certificate. |
|
|
Token is passed in the standard format with header: |
|
|
List of strings with series selector. See: Prometheus querying API enhancements |
Config file example:
reader:
class: "vm" # or "reader.vm.VmReader" until v1.13.0
datasource_url: "http://localhost:8428/"
tenant_id: "0:0"
queries:
ingestion_rate: 'sum(rate(vm_rows_inserted_total[5m])) by (type) > 0'
sampling_period: '1m'
Healthcheck metrics
VmReader
exposes several healthchecks metrics.