Skip to content
This repository has been archived by the owner on Apr 2, 2024. It is now read-only.

Adds support for Prometheus metric rollups #1799

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

Harkishen-Singh
Copy link
Member

@Harkishen-Singh Harkishen-Singh commented Dec 15, 2022

Description

TODOs:
Action items to be implemented before marking this PR ready for review:

  • Improve UX for create/delete/update
  • Implement telemetry
  • Investigate and fix querying rollup data using PromQL via __schema__ & __column__ labels

Merge requirements

Please take into account the following non-code changes that you may need to make with your PR:

  • CHANGELOG entry for user-facing changes
  • Updated the relevant documentation

@Harkishen-Singh Harkishen-Singh added the epic/auto-rollups Automatic metric rollups, downsampling label Dec 15, 2022
@Harkishen-Singh Harkishen-Singh self-assigned this Dec 15, 2022
@Harkishen-Singh Harkishen-Singh force-pushed the feature_metric_rollup branch 3 times, most recently from 933cabf to e1b7371 Compare December 16, 2022 11:49
@@ -0,0 +1,66 @@
package database

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To reviewers: This file is yet to be reviewed. I had to merge the PR quickly that involved this file, hence.

@Harkishen-Singh Harkishen-Singh changed the title WIP: Adds support for Prometheus metric rollups Adds support for Prometheus metric rollups Jan 11, 2023
Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com>

This commit adds support for creation or deletion of metric rollups by reading
the dataset-config file. The dataset config file contains a new field `downsample:`
which supports 2 options: `automatic` & `resolution`.

If `automatic` is false, then
connector updates in the database so that `_prom_catalog.scan_for_new_rollups` does not
create any new rollups (Caggs).

`resolution` is a comma separated list of resolutions for downsampling, in a way that
label:resolution:retention is the format that is needed.
Example: `short:5m:90d,long:1h:365d`
-> The resolution works in a strict manner. Its aim is to make sure that the database contains
exactly those resolutions that are mentioned in the dataset config. Like, if the database
already contains `short` and `long` downsampled data and the dataset is supplied with `short:5m:90d,very_long:1d:365d`
then `long` downsampled case is deleted and `very_long` is created.
-> `resolution` is applied if `automatic` is `true`. If automatic is not given in dataset config, it defaults to `true`
based on our plan to keep downsampling applied as a default setting.
…ollups.

Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com>
Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com>
Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com>
Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com>
Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com>
Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com>
Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com>
Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com>
Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com>

This commit implements the update UX for creating downsampled data
for Prometheus metrics.

Now, downsampling can be done by
```
metrics:
  downsampling: 5m:30d,1h:365d
```

The above dataset-config setting will create 2 downsampling, ds_5m
(interval 5m & retention 30d) and ds_1h (interval 1h & retention 365d).

If an entry is removed, like
```
metrics:
  downsampling: 1h:365d
```

Then we disable the ds_5m downsampling from refreshing. Deletion can only
happen via SQL, `CALL _prom_catalog.delete_downsampling(<schema_name>)`. This
keeps the UX clean and simple.

If the removed dowmsapling is applied again later on, we simply enable the refreshing.

This also means that this commit adds ability to enable or disable downsampling as well.
…mn__.

Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com>
Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com>
Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com>
@Harkishen-Singh Harkishen-Singh marked this pull request as ready for review January 11, 2023 07:34
@Harkishen-Singh Harkishen-Singh requested review from a team as code owners January 11, 2023 07:34
@Harkishen-Singh Harkishen-Singh removed the request for review from a team January 11, 2023 08:05
Copy link
Contributor

@niksajakovljevic niksajakovljevic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of code here has been reviewed if I am not mistaken.
However I am just blocking PR so it does not accidentally get merged into master until we discuss downsampling feature in broader scope.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
epic/auto-rollups Automatic metric rollups, downsampling
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants