Skip to content

Commit

Permalink
Add new metrics for measuring latency and error ratio.
Browse files Browse the repository at this point in the history
Signed-off-by: Simon Kent <simek@google.com>
  • Loading branch information
Simon Kent committed Sep 20, 2022
1 parent 8260a79 commit d7ae846
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions pkg/api/metrics.go
Expand Up @@ -16,6 +16,8 @@
package api

import (
"time"

"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
)
Expand All @@ -35,4 +37,18 @@ var (
Name: "rekor_api_latency_summary",
Help: "Api Latency on calls",
}, []string{"path", "code"})

MetricRequestLatency = promauto.NewHistogramVec(prometheus.HistogramOpts{
Name: "rekor_latency_by_api",
Help: "Api Latency (in ns) by path and method",
Buckets: prometheus.ExponentialBucketsRange(
float64(time.Millisecond),
float64(4*time.Second),
10),
}, []string{"path", "method"})

MetricRequestCount = promauto.NewCounterVec(prometheus.CounterOpts{
Name: "rekor_qps_by_api",
Help: "Api QPS by path, method, and response code",
}, []string{"path", "method", "code"})
)

0 comments on commit d7ae846

Please sign in to comment.