0

The below code registers five metrics count, oneminuteRate, fiftenMinuteRate, fiveMinuteRate, meanRate into graphite for every 30 seconds from my application.

public void collectMetric(string metricName, long metricValue){
        mr.meter(metricName).mark(value)
    }

I would like to show in the Grafana dashboard the no of requests that are received every minute.(i,e if in the first minute 60 is received, in the second minute 120 is received) Since the count in the meter metric above just keeps increasing and all the *Rate values are events per second. I am not sure how to log metric into Grafana dashboard that displays the no of requests received per minute. Any advice is highly appreciated?

Suppose if I use mr.counter(metricName).inc(value) IS there a way to reset the counters every 1 minute?

Harish
  • 565
  • 1
  • 12
  • 34

1 Answers1

0

I had the same problem. The way that I found is that I resolved this in Grafana. When you're on the panel's metrics, you can add a function to your query like this:

Screenshot

You can try the derivative() function or perSecond() function but these functions are not completly reliable, it depends what you're doing with these in your panel. But with these you'll see the number of input in time and not the total.

Nisse Engström
  • 4,738
  • 23
  • 27
  • 42
Jean
  • 197
  • 10
  • I have two metrics success and count which is taken using the per-second function. How do we calculate the percentage of success in another panel? – Harish May 01 '19 at 22:52
  • u can add a function like `asPercent(,)`. – Jean May 02 '19 at 12:22
  • What is the order to use persecond and hitcount(1minute) when aggregating the metric count based on a minute – Harish May 02 '19 at 17:52
  • Do you mean the which function you have to put inside the other ? Sorry i don't understand your point. – Jean May 02 '19 at 19:47