0
Fork 0
mirror of https://github.com/willnorris/imageproxy.git synced 2024-12-16 21:56:43 -05:00
imageproxy/metrics.go
Will Norris 7ba3f124eb cleanup license headers and contributing docs
- switch to "project authors" style copyright.  Instead of an AUTHORS
  file (https://opensource.google/docs/releasing/authors/), I just list
  Google as a major copyright holder in the README.
- use SPDX style license headers in source files
- remove CLA requirement from contributing docs
2021-03-10 12:24:13 -08:00

39 lines
1.2 KiB
Go

// Copyright 2013 The imageproxy authors.
// SPDX-License-Identifier: Apache-2.0
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)
}