GithubHelp home page GithubHelp logo

Comments (8)

saifulmuhajir avatar saifulmuhajir commented on June 2, 2024

I would love to have this feature.

Thank you for this awesome project.

from sql_exporter.

pasali avatar pasali commented on June 2, 2024

+1 for this feature, we currently have scenario that needs counter type metrics.

from sql_exporter.

zwopir avatar zwopir commented on June 2, 2024

Hi @pasali,

could you elaborate on your scenario, so I can think about it? As Dominik said, we'd like to keep the exporter as simple as possible, but this shouldn't prevent us from implementing important features.

from sql_exporter.

pasali avatar pasali commented on June 2, 2024

Hi, @zwopir

Let say i have table called 'failed_sms' and i want to fire alerts when count of failed SMSes in last 5 minutes greater than 1.

from sql_exporter.

zwopir avatar zwopir commented on June 2, 2024

I understand. But that's not a prometheus counter. Have a look at https://prometheus.io/docs/concepts/metric_types/#counter. In your use case there are two mismatches to consider the metric a prometheus counter:

  • the metric isn't cumulativ
  • the metric can go up and down

from sql_exporter.

pasali avatar pasali commented on June 2, 2024

I can not use type gauge either. Because if query returns zero rows, metric value stays the same.I see you don't change the metric value when query returns zero rows because this can create ambiguity(my opinion). So i think if i can store my metrics as counter and look for the increase then i i can fire alerts. Or do you have any suggestions ?

from sql_exporter.

zwopir avatar zwopir commented on June 2, 2024

I may have misunderstood or made false assumptions about your use case. If you export a SELECT count(*) FROM ... WHERE <...timerange limit...> as a prometheus counter, my above statement is true. If we where to implement a counter that adds the result of a query to the counter, that counter would be a valid prometheus counter. But that would imply that we limit the timerange to the time since the last scrape and here the trouble begins....!
So I would suggest to use delta() as promQL function or (if possible) instrument the code to count the number of failures

from sql_exporter.

pasali avatar pasali commented on June 2, 2024

@zwopir thanks for the suggestion, but i think best way to handle this is usage type gauge and always return rows to make metric value 0.

from sql_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.