GithubHelp home page GithubHelp logo

Comments (4)

tekert avatar tekert commented on June 23, 2024 1

Oh Thanks.

 -relabelConfig string
        Optional path to a file with relabeling rules, which are applied to all the ingested metrics. The path can point either to local file or to http url. See https://docs.victoriametrics.com/#relabeling for details. The config is reloaded on SIGHUP signal

Somehow missed this, google keep sending me to
https://docs.victoriametrics.com/vmagent/#relabeling
instead of
https://docs.victoriametrics.com/#relabeling

And somehow my fault too for not realizing there are two relabeling docs.

Going to try it now.

from victoriametrics.

tekert avatar tekert commented on June 23, 2024 1

All working now, following the https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config spec since victoriametrics points me that the spec to follow. And the guidance of https://valyala.medium.com/how-to-use-relabeling-in-prometheus-and-victoriametrics-8b90fc22c4b2

For anyone intered for droping metrics for go_ and process_ for example just write this in the file pointed by -relabelConfig

- action: drop
  source_labels: [__name__]
  regex: "go_.+|process_.+"

Thanks to vylyala post, if someone whats to drop go_ and process_ metrics only if the have a specific label or labels remeber they are parsed as: label1;label2;etc for regex.
The doc is all over the place but is nice to read and easy to find :)

quoting:

Then source_labels contains multiple labels, they are concatenated with ; char before matching the provided regex. 
For example, the following relabeling rule would drop metric with {job="foo",instance="bar"} labels:

- action: drop
  source_labels: [job, instance]
  regex: "foo;bar"

from victoriametrics.

jiekun avatar jiekun commented on June 23, 2024

I haven't tried it myself but there are some documents related to it:
https://docs.victoriametrics.com/single-server-victoriametrics/#relabeling

Also, if you are looking at the source code and issues of vminsert, you could find:

  1. people are using -relabelConfig flag in vminsert: #638
  2. For prometheus remote-write handler, vminsert will check if relabel config exists and do:

Please try it out and provide feedback here. I would be happy to test it myself if you encounter any unexpected issues while following the documentation.

from victoriametrics.

tekert avatar tekert commented on June 23, 2024

Just to add for anyone looking at this in the future.

Since RE2 regex doen't support negative lookahead for words we have to use the enhancements made for relabeling from https://docs.victoriametrics.com/vmagent/#relabeling-enhancements
(It's in the vmagent section but works perfectly from victoriametrics process single)

Example to drop all metrics that match a regex except for a particular job named victoriametrics:


# Drop all metrics that containt go_ OR process_ ONLY IF job != "victoriametrics"
- action: drop
  if:
  - '{job != "victoriametrics"}'
  source_labels: [__name__]
  regex: 
    - "go_.+"
    - "process_.+"

# Now drop only go_ metrics (while keeping process_ intact) of the metrics from job victoriametrics
- action: drop
  if:
  - '{job = "victoriametrics"}'
  source_labels: [__name__]
  regex: 
    - "go_.+"

from victoriametrics.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.