mq-java-exporter icon indicating copy to clipboard operation
mq-java-exporter copied to clipboard

Consider the need to implement "smart" counters

Open echerniak opened this issue 6 years ago • 3 comments

Current exporter implementation manages counters as simple as possible. Every mq counter is a prometheus counter, which can only increase. There are pros and cons of such implementation: pros:

  • exporter only updates counters. There is no additional work required from exporter.

cons:

  • query format, which should be used, to display diff between counters (metric - metric offset 10s). Every grafana dashboard will depend on prometheus scrape interval.
  • actually, the way we expose counters differs from the way mq exposes them.

The idea is to implement mq counters via prometheus gauges (that's how counters become smart). They will increase between scrapes, but after each scrape all "smart" counters will be reset to 0. This implementation also have pros and cons:

pros:

  • grafana dashboard doesn't depend on prometheus scrape interval.
  • exporter exposes metrics the way mq exposes them. From my point it is more obvious implementation.

cons:

  • need to reset counters after each scrape.

Need to be discussed.

echerniak avatar Mar 14 '19 15:03 echerniak

An alternative - make counters provide "average per second" value. Time interval, that is publish with mq statistics, can be taken to calculate the average.

Both oprions have to be considered.

sberdyshev avatar Mar 15 '19 12:03 sberdyshev

@echerniak Describe here the decision we agreed on

sberdyshev avatar Apr 11 '19 11:04 sberdyshev

The final agreed decision about counters is following:

The idea is to implement mq counters via prometheus gauges (that's how counters become smart). They will increase between scrapes, but after each scrape all "smart" counters will be reset to 0. Main disadvantage of this approach is a significant increase in metrics values in case of long unavailability of prometheus. It was decided to solve this problem as follows: In case prometheus does not collect metrics longer than usual, the exporter will reset counters and will give the last value only for each counter on the next prometheus scrape.

echerniak avatar Apr 11 '19 15:04 echerniak