app/vmstorage: add vm_index_search_duration_seconds histogram for monitoring the performance of index search

This commit is contained in:
Aliaksandr Valialkin 2021-03-17 01:12:28 +02:00
parent 5e77a939c2
commit 8ef1184adf
2 changed files with 5 additions and 0 deletions

View File

@ -1193,7 +1193,9 @@ func (s *Server) processVMSelectSearch(ctx *vmselectRequestCtx) error {
if err := checkTimeRange(s.storage, tr); err != nil { if err := checkTimeRange(s.storage, tr); err != nil {
return ctx.writeErrorMessage(err) return ctx.writeErrorMessage(err)
} }
startTime := time.Now()
ctx.sr.Init(s.storage, ctx.tfss, tr, *maxMetricsPerSearch, ctx.deadline) ctx.sr.Init(s.storage, ctx.tfss, tr, *maxMetricsPerSearch, ctx.deadline)
indexSearchDuration.UpdateDuration(startTime)
defer ctx.sr.MustClose() defer ctx.sr.MustClose()
if err := ctx.sr.Error(); err != nil { if err := ctx.sr.Error(); err != nil {
return ctx.writeErrorMessage(err) return ctx.writeErrorMessage(err)
@ -1228,6 +1230,8 @@ func (s *Server) processVMSelectSearch(ctx *vmselectRequestCtx) error {
return nil return nil
} }
var indexSearchDuration = metrics.NewHistogram(`vm_index_search_duration_seconds`)
// checkTimeRange returns true if the given tr is denied for querying. // checkTimeRange returns true if the given tr is denied for querying.
func checkTimeRange(s *storage.Storage, tr storage.TimeRange) error { func checkTimeRange(s *storage.Storage, tr storage.TimeRange) error {
if !*denyQueriesOutsideRetention { if !*denyQueriesOutsideRetention {

View File

@ -8,6 +8,7 @@
- `histogram_stddev(buckets)` - returns standard deviation for the given buckets. - `histogram_stddev(buckets)` - returns standard deviation for the given buckets.
* FEATURE: reduce median query duration by up to 2x. See https://github.com/VictoriaMetrics/VictoriaMetrics/commit/18fe0ff14bc78860c5569e2b70de1db78fac61be * FEATURE: reduce median query duration by up to 2x. See https://github.com/VictoriaMetrics/VictoriaMetrics/commit/18fe0ff14bc78860c5569e2b70de1db78fac61be
* FEATURE: export `vm_available_memory_bytes` and `vm_available_cpu_cores` metrics, which show the number of available RAM and available CPU cores for VictoriaMetrics apps. * FEATURE: export `vm_available_memory_bytes` and `vm_available_cpu_cores` metrics, which show the number of available RAM and available CPU cores for VictoriaMetrics apps.
* FEATURE: export `vm_index_search_duration_seconds` histogram, which can be used for troubleshooting time series search performance.
* FEATURE: vmagent: add ability to replicate scrape targets among `vmagent` instances in the cluster with `-promscrape.cluster.replicationFactor` command-line flag. See [these docs](https://victoriametrics.github.io/vmagent.html#scraping-big-number-of-targets). * FEATURE: vmagent: add ability to replicate scrape targets among `vmagent` instances in the cluster with `-promscrape.cluster.replicationFactor` command-line flag. See [these docs](https://victoriametrics.github.io/vmagent.html#scraping-big-number-of-targets).
* FEATURE: vmagent: accept `scrape_offset` option at `scrape_config`. This option may be useful when scrapes must start at the specified offset of every scrape interval. See [these docs](https://victoriametrics.github.io/vmagent.html#troubleshooting) for details. * FEATURE: vmagent: accept `scrape_offset` option at `scrape_config`. This option may be useful when scrapes must start at the specified offset of every scrape interval. See [these docs](https://victoriametrics.github.io/vmagent.html#troubleshooting) for details.
* FEATURE: vmagent: support `proxy_tls_config`, `proxy_basic_auth`, `proxy_bearer_token` and `proxy_bearer_token_file` options at `scrape_config` section for configuring proxies specified via `proxy_url`. See [these docs](https://victoriametrics.github.io/vmagent.html#scraping-targets-via-a-proxy). * FEATURE: vmagent: support `proxy_tls_config`, `proxy_basic_auth`, `proxy_bearer_token` and `proxy_bearer_token_file` options at `scrape_config` section for configuring proxies specified via `proxy_url`. See [these docs](https://victoriametrics.github.io/vmagent.html#scraping-targets-via-a-proxy).