forked from willnorris/imageproxy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
metrics.go
36 lines (33 loc) · 1.08 KB
/
metrics.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package imageproxy
import (
"github.com/prometheus/client_golang/prometheus"
)
var (
metricServedFromCache = prometheus.NewCounter(
prometheus.CounterOpts{
Namespace: "imageproxy",
Name: "requests_served_from_cache_total",
Help: "Number of requests served from cache.",
})
metricTransformationDuration = prometheus.NewSummary(prometheus.SummaryOpts{
Namespace: "imageproxy",
Name: "transformation_duration_seconds",
Help: "Time taken for image transformations in seconds.",
})
metricRemoteErrors = prometheus.NewCounter(prometheus.CounterOpts{
Namespace: "imageproxy",
Name: "remote_fetch_errors_total",
Help: "Total remote image fetch errors",
})
metricRequestDuration = prometheus.NewSummary(prometheus.SummaryOpts{
Namespace: "http",
Name: "request_duration_seconds",
Help: "Request response times",
})
)
func init() {
prometheus.MustRegister(metricTransformationDuration)
prometheus.MustRegister(metricServedFromCache)
prometheus.MustRegister(metricRemoteErrors)
prometheus.MustRegister(metricRequestDuration)
}