GithubHelp home page GithubHelp logo

Comments (1)

tgriffitts-ns avatar tgriffitts-ns commented on July 18, 2024

Digging through the source code, I have discovered that metrics with labels are treated different from metrics without labels.

Metrics without labels each have 1 counter and are initialized to 0 and always report. This is the behavior I requested above.

Metrics with labels have a vector of counters-- one for each unique label combination. Each time a log line matches the metric expression the label expression is processed and the metric vector is queried to see if there is already a counter for that label combination. If not, one is created and initialized to 0. Then the counter for the label combination is incremented by the value derived from the log line (or +1 if no value expression is declared for the counter metric). This vector of counters is sane and makes sense; how can you know all possible future combinations of labels and initialize those to 0 and report immediately? You can't and thus no metric is reported until a log line matches and the labels are derived from that log line. Fine.

I had a default configuration for grok_exporter which included the log file path as a label to all of our metrics. This caused them all to have the "labeled metric" behavior. Since my metrics do not derived their label from the matching log line, I expected the behavior of metrics without labels because my labels never change. But it still has a label and is dynamically generated (from the log path being tailed which had a matching metric expression). Fine. I don't expect grok_exporter to consider if the label expression will ever report different values. I mean, it actually could report different values if we had more than one input path and that expression matched from 2 different input paths. Anyway, all is good. I have removed the unnecessary label.

Case closed. My apologies for not initially understanding.

Thanks for the great tool!

from grok_exporter.

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.