2021-03-10 15:24:13 -05:00
|
|
|
// Copyright 2013 The imageproxy authors.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
2017-11-10 17:07:07 -05:00
|
|
|
package imageproxy
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/prometheus/client_golang/prometheus"
|
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
2020-02-24 11:16:36 -05:00
|
|
|
metricServedFromCache = prometheus.NewCounter(
|
2017-11-10 17:07:07 -05:00
|
|
|
prometheus.CounterOpts{
|
2020-02-24 11:16:36 -05:00
|
|
|
Namespace: "imageproxy",
|
|
|
|
Name: "requests_served_from_cache_total",
|
|
|
|
Help: "Number of requests served from cache.",
|
2017-11-10 17:07:07 -05:00
|
|
|
})
|
2020-02-24 11:16:36 -05:00
|
|
|
metricTransformationDuration = prometheus.NewSummary(prometheus.SummaryOpts{
|
|
|
|
Namespace: "imageproxy",
|
|
|
|
Name: "transformation_duration_seconds",
|
|
|
|
Help: "Time taken for image transformations in seconds.",
|
2017-11-10 17:07:07 -05:00
|
|
|
})
|
2020-02-24 11:16:36 -05:00
|
|
|
metricRemoteErrors = prometheus.NewCounter(prometheus.CounterOpts{
|
|
|
|
Namespace: "imageproxy",
|
|
|
|
Name: "remote_fetch_errors_total",
|
|
|
|
Help: "Total remote image fetch errors",
|
2017-11-10 17:07:07 -05:00
|
|
|
})
|
2020-02-24 11:16:36 -05:00
|
|
|
metricRequestDuration = prometheus.NewSummary(prometheus.SummaryOpts{
|
2017-11-10 17:07:07 -05:00
|
|
|
Namespace: "http",
|
2020-02-24 11:16:36 -05:00
|
|
|
Name: "request_duration_seconds",
|
2017-11-10 17:07:07 -05:00
|
|
|
Help: "Request response times",
|
|
|
|
})
|
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
2020-02-24 11:16:36 -05:00
|
|
|
prometheus.MustRegister(metricTransformationDuration)
|
|
|
|
prometheus.MustRegister(metricServedFromCache)
|
|
|
|
prometheus.MustRegister(metricRemoteErrors)
|
|
|
|
prometheus.MustRegister(metricRequestDuration)
|
2017-11-10 17:07:07 -05:00
|
|
|
}
|