Skip to content

Helper tool for VictoriaMetrics to remove "bad" data points without losing the rest of the data.

License

Notifications You must be signed in to change notification settings

tedpearson/vm-patch-metrics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vm-patch-metrics

vm-patch-metrics is a helper tool for VictoriaMetrics. I wrote it for removing "bad" points from metrics without losing the rest of the metrics.

What it does:

  1. Exports the matching metrics to a .jsonl file
  2. Removes datapoints from each line that fall within the -remove-start and -remove-end times, writing them to a new .jsonl file
  3. Deletes the matching metrics from VictoriaMetrics. (For all time!)
  4. Imports the metrics without the removed dates back into VictoriaMetrics.

This is a quick project and I won't guarantee you won't lose data in the process. You've been warned!

Usage:

Usage of vm-replace-metrics:
    -export-end string
        End time for the exported metrics (default: current time)
    -export-start string
        Start time for the exported metrics
    -file string
        File path to export metrics to (default "./metrics.jsonl")
    -match string
        Metric expression to export from VM
    -password string
        VM user password to authenticate
    -remove-end string
        End time of the points to remove from exported metrics (default: current time)
    -remove-start string
        Start time of the points to remove from exported metrics
    -url string
        VM url (default "http://localhost:8428")
    -user string
        VM user to authenticate
    -insecure bool
        Ignore server certificate issues

Example of removing December 1-4, 2022 data from data exported since Jan 1, 2020:

-user user -password password
-match 'my_cool_metric{mylabel="a", otherlabel=~"b_.*"}'
-export-start 2020-01-01T00:00:00+05:00
-remove-start 2022-12-01T00:00:00Z05:00
-remove-end 2022-12-05T00:00:00Z05:00

About

Helper tool for VictoriaMetrics to remove "bad" data points without losing the rest of the data.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages