mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
Add new Prom metrics fn_timeout and fn_errors (#679)
* Add new Prom metric fn_timedout * Add new Prometheus metric fn_errors * Tidy up variable name * Add new Prometheus metric fn_errors * gofmt
This commit is contained in:
@@ -94,7 +94,7 @@ func (s *stats) DequeueAndStart(ctx context.Context, app string, path string) {
|
||||
|
||||
s.running++
|
||||
s.getStatsForFunction(path).running++
|
||||
common.IncrementGauge(ctx, runningSuffix)
|
||||
common.IncrementGauge(ctx, runningMetricName)
|
||||
|
||||
s.mu.Unlock()
|
||||
}
|
||||
@@ -104,7 +104,7 @@ func (s *stats) Complete(ctx context.Context, app string, path string) {
|
||||
|
||||
s.running--
|
||||
s.getStatsForFunction(path).running--
|
||||
common.DecrementGauge(ctx, runningSuffix)
|
||||
common.DecrementGauge(ctx, runningMetricName)
|
||||
|
||||
s.complete++
|
||||
s.getStatsForFunction(path).complete++
|
||||
@@ -118,7 +118,7 @@ func (s *stats) Failed(ctx context.Context, app string, path string) {
|
||||
|
||||
s.running--
|
||||
s.getStatsForFunction(path).running--
|
||||
common.DecrementGauge(ctx, runningSuffix)
|
||||
common.DecrementGauge(ctx, runningMetricName)
|
||||
|
||||
s.failed++
|
||||
s.getStatsForFunction(path).failed++
|
||||
@@ -141,6 +141,14 @@ func (s *stats) DequeueAndFail(ctx context.Context, app string, path string) {
|
||||
s.mu.Unlock()
|
||||
}
|
||||
|
||||
func (s *stats) IncrementTimedout(ctx context.Context) {
|
||||
common.IncrementCounter(ctx, timedoutMetricName)
|
||||
}
|
||||
|
||||
func (s *stats) IncrementErrors(ctx context.Context) {
|
||||
common.IncrementCounter(ctx, errorsMetricName)
|
||||
}
|
||||
|
||||
func (s *stats) Stats() Stats {
|
||||
var stats Stats
|
||||
s.mu.Lock()
|
||||
@@ -160,7 +168,9 @@ func (s *stats) Stats() Stats {
|
||||
const (
|
||||
queuedMetricName = "queued"
|
||||
callsMetricName = "calls"
|
||||
runningSuffix = "running"
|
||||
runningMetricName = "running"
|
||||
completedMetricName = "completed"
|
||||
failedMetricName = "failed"
|
||||
timedoutMetricName = "timedout"
|
||||
errorsMetricName = "errors"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user