No description
Find a file
rtm0 9fcfba3927
lib/storage: properly handle maxMetrics limit at metricID search
`TL;DR` This PR improves the metric IDs search in IndexDB:

- Avoid seaching for metric IDs twice when `maxMetrics` limit is
exceeded
- Use correct error type for indicating that the `maxMetrics` limit is
exceded
- Simplify the logic of deciding between per-day and global index search

A unit test has been added to ensure that this refactoring does not
break anything.

---

Function calls before the fix:

```
idb.searchMetricIDs
    |__ is.searchMetricIDs
        |__ is.searchMetricIDsInternal
            |__ is.updateMetricIDsForTagFilters
                |__ is.tryUpdatingMetricIDsForDateRange
                |                       |
                |__ is.getMetricIDsForDateAndFilters
```

- `searchMetricIDsInternal` searches metric IDs for each filter set. It
maintains a metric ID set variable which is updated every time the
`updateMetricIDsForTagFilters` function is called. After each successful
call, the function checks the length of the updated metric ID set and if
it is greater than `maxMetrics`, the function returns `too many
timeseries` error.
- `updateMetricIDsForTagFilters` uses either per-day or global index to
search metric IDs for the given filter set. The decision of which index
to use is made is made within the `tryUpdatingMetricIDsForDateRange`
function and if it returns `fallback to global search` error then the
function uses global index by calling `getMetricIDsForDateAndFilters`
with zero date.
- `tryUpdatingMetricIDsForDateRange` first checks if the given time
range is larger than 40 days and if so returns `fallback to global
search` error. Otherwise it proceeds to searching for metric IDs within
that time range by calling `getMetricIDsForDateAndFilters` for each
date.
- `getMetricIDsForDateAndFilters` searches for metric IDs for the given
date and returns `fallback to global search` error if the number of
found metric IDs is greater than `maxMetrics`.

Problems with this solution:

1. The `fallback to global search` error returned by
`getMetricIDsForDateAndFilters` in case when maxMetrics is exceeded is
misleading.
2. If `tryUpdatingMetricIDsForDateRange` proceeds to date range search
and returns `fallback to global search` error (because
`getMetricIDsForDateAndFilters` returns it) then this will trigger
global search in `updateMetricIDsForTagFilters`. However the global
search uses the same maxMetrics value which means this search is
destined to fail too. I.e. the same search is performed twice and fails
twice.
3. `too many timeseries` error is already handled in
`searchMetricIDsInternal` and therefore handing this error in
`updateMetricIDsForTagFilters` is redundant
4. updateMetricIDsForTagFilters is a better place to make a decision on
whether to use per-day or global index.

Solution:

1.  Use a dedicated error for `too many timeseries` case
2. Handle `too many timeseries` error in  `searchMetricIDsInternal` only
3. Move the per-day or global search decision from
`tryUpdatingMetricIDsForDateRange` to `updateMetricIDsForTagFilters` and
remove `fallback to global search` error.


---------

Signed-off-by: Artem Fetishev <wwctrsrx@gmail.com>
Co-authored-by: Nikolay <nik@victoriametrics.com>
2024-08-27 21:39:03 +02:00
.github Revert "deployment: build image for vmagent streamaggr benchmark (#6515)" 2024-07-16 13:27:06 +02:00
app app/vmselect:add command-line flag -search.inmemoryBufSizeBytes (#6869) 2024-08-26 14:48:53 +02:00
cspell docs: add spellcheck command (#6562) 2024-07-11 12:39:42 +02:00
dashboards dashboards: add Scrape duration 0.99 quantile panel 2024-07-30 14:57:17 +02:00
deployment deployment/docker: update Go builder from Go1.22.5 to Go1.23.0 (#6861) 2024-08-22 23:55:50 +02:00
docs lib/storage: properly handle maxMetrics limit at metricID search 2024-08-27 21:39:03 +02:00
lib lib/storage: properly handle maxMetrics limit at metricID search 2024-08-27 21:39:03 +02:00
package simplify release process (#3012) 2022-08-31 02:27:24 +03:00
ports/OpenBSD docs: convert png images to webp in all the docs except of docs/operator/* 2023-11-22 19:21:00 +02:00
vendor lib/promscrape: fixes proxy autorization (#6783) 2024-08-19 22:31:18 +02:00
.dockerignore added packer build for DigitalOcean Droplets (#1917) 2021-12-21 12:09:14 +02:00
.gitignore docs: removed redundant 'VictoriaLogs' from title (#6715) 2024-07-29 14:29:15 +02:00
.golangci.yml .golangci.yml: properly specify functions to exclude for return values check after the upgrade to v1.59.1 at 239a7b6e6f 2024-06-11 16:41:01 +02:00
.wwhrd.yml .wwhrd.yml: add ISC license, which is used by github.com/davecgh/go-spew 2022-12-14 14:55:46 -08:00
CODE_OF_CONDUCT.md A good change for MD files (#2353) 2022-03-22 13:40:55 +02:00
CONTRIBUTING.md Move CONTRIBUTING.md to docs/ 2024-04-20 23:11:22 +02:00
go.mod deployment/docker: update Go builder from Go1.22.5 to Go1.23.0 (#6861) 2024-08-22 23:55:50 +02:00
go.sum lib/promscrape: fixes proxy autorization (#6783) 2024-08-19 22:31:18 +02:00
LICENSE LICENSE: update the current year from 2023 to 2024 2024-01-17 01:48:04 +02:00
logo.png Add logo 2018-11-29 21:47:17 +02:00
Makefile make: reset permissions when creating release archive (#6846) 2024-08-21 11:25:13 +02:00
README.md docs: rm mentions of google group as it was deprecated 2024-08-21 14:08:27 +02:00
SECURITY.md add new LTS release v1.102.x 2024-08-02 11:12:20 +02:00
VM_logo.zip removed DS_Store files from VM_logo.zip (#1233) 2021-04-20 11:41:07 +03:00

VictoriaMetrics

Latest Release Docker Pulls Slack GitHub license Go Report Build Status codecov

VictoriaMetrics logo

VictoriaMetrics is a fast, cost-saving, and scalable solution for monitoring and managing time series data. It delivers high performance and reliability, making it an ideal choice for businesses of all sizes.

Here are some resources and information about VictoriaMetrics:

Yes, we open-source both the single-node VictoriaMetrics and the cluster version.

Prominent features

VictoriaMetrics is optimized for timeseries data, even when old time series are constantly replaced by new ones at a high rate, it offers a lot of features:

Enterprise version

In addition, the Enterprise version includes extra features:

  • Anomaly detection: Automation and simplification of your alerting rules, covering complex anomalies found in metrics data.
  • Backup automation: Automates regular backup procedures.
  • Multiple retentions: Reducing storage costs by specifying different retentions for different datasets.
  • Downsampling: Reducing storage costs and increasing performance for queries over historical data.
  • Stable releases with long-term support lines (LTS).
  • Comprehensive support: First-class consulting, feature requests and technical support provided by the core VictoriaMetrics dev team.
  • Many other features, which you can read about on the Enterprise page.

Contact us if you need enterprise support for VictoriaMetrics. Or you can request a free trial license here, downloaded Enterprise binaries are available at Github Releases.

We strictly apply security measures in everything we do. VictoriaMetrics has achieved security certifications for Database Software Development and Software-Based Monitoring Services. See Security page for more details.

Benchmarks

Some good benchmarks VictoriaMetrics achieved:

Community and contributions

Feel free asking any questions regarding VictoriaMetrics:

If you like VictoriaMetrics and want to contribute, then please read these docs.

Zip contains three folders with different image orientations (main color and inverted version).

Files included in each folder:

  • 2 JPEG Preview files
  • 2 PNG Preview files with transparent background
  • 2 EPS Adobe Illustrator EPS10 files

Logo Usage Guidelines

Font used

  • Lato Black
  • Lato Regular

Color Palette

We kindly ask

  • Please don't use any other font instead of suggested.
  • To keep enough clear space around the logo.
  • Do not change spacing, alignment, or relative locations of the design elements.
  • Do not change the proportions for any of the design elements or the design itself. You may resize as needed but must retain all proportions.