Documentation
¶
Overview ¶
Package metrics provides functions to collect runtime registry statistics and expose the registered metrics via HTTP.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( HTTPInFlightRequests = prometheus.NewGauge(prometheus.GaugeOpts{ Namespace: namespace, Subsystem: httpSubsystem, Name: "in_flight_requests", Help: "A gauge of requests currently being served by the registry.", }) HTTPRequestsTotal = prometheus.NewCounterVec( prometheus.CounterOpts{ Namespace: namespace, Subsystem: httpSubsystem, Name: "requests_total", Help: "A counter for requests to the registry.", }, []string{"code", "method"}, ) HTTPRequestDurationSeconds = prometheus.NewSummaryVec( prometheus.SummaryOpts{ Namespace: namespace, Subsystem: httpSubsystem, Name: "request_duration_seconds", Help: "A histogram of latencies for requests to the registry.", }, []string{"method"}, ) HTTPRequestSizeBytes = prometheus.NewSummaryVec( prometheus.SummaryOpts{ Namespace: namespace, Subsystem: httpSubsystem, Name: "request_size_bytes", Help: "A histogram of sizes of requests to the registry.", }, []string{}, ) HTTPResponseSizeBytes = prometheus.NewSummaryVec( prometheus.SummaryOpts{ Namespace: namespace, Subsystem: httpSubsystem, Name: "response_size_bytes", Help: "A histogram of response sizes for requests to the registry.", }, []string{}, ) HTTPTimeToWriteHeaderSeconds = prometheus.NewSummaryVec( prometheus.SummaryOpts{ Namespace: namespace, Subsystem: httpSubsystem, Name: "time_to_write_header_seconds", Help: "A histogram of request durations until the response headers are written.", }, []string{}, ) )
Functions ¶
Types ¶
type Core ¶
type Core interface {
// Repository wraps a distribution.Repository to collect statistics.
Repository(r distribution.Repository, reponame string) distribution.Repository
}
Core is a set of metrics for the core functionality.
type Counter ¶
type Counter interface {
Inc()
}
Counter represents a single numerical value that only goes up.
type DigestCache ¶
DigestCache is a set of metrics for the digest cache subsystem.
type Metrics ¶
type Metrics interface {
Core
Pullthrough
Storage
DigestCache
}
Metrics is a set of all metrics that can be provided.
func NewMetrics ¶
NewMetrics returns a helper that exposes the metrics through sink to instrument the application.
func NewNoopMetrics ¶
func NewNoopMetrics() Metrics
NewNoopMetrics return a helper that implements the Metrics interface, but does nothing.
type Observer ¶
type Observer interface {
Observe(float64)
}
Observer captures individual observations.
type Pullthrough ¶
type Pullthrough interface {
// RepositoryRetriever wraps RepositoryRetriever to collect statistics.
RepositoryRetriever(retriever registryclient.RepositoryRetriever) registryclient.RepositoryRetriever
// DigestBlobStoreCache() returns an interface to count cache hits/misses
// for pullthrough blobstores.
DigestBlobStoreCache() Cache
}
Pullthrough is a set of metrics for the pullthrough subsystem.
type Sink ¶
type Sink interface {
RequestDuration(funcname string) Observer
PullthroughBlobstoreCacheRequests(resultType string) Counter
PullthroughRepositoryDuration(registry, funcname string) Observer
PullthroughRepositoryErrors(registry, funcname, errcode string) Counter
StorageDuration(funcname string) Observer
StorageErrors(funcname, errcode string) Counter
DigestCacheRequests(resultType string) Counter
DigestCacheScopedRequests(resultType string) Counter
}
Sink provides an interface for exposing metrics.
func NewPrometheusSink ¶
func NewPrometheusSink() Sink
NewPrometheusSink returns a sink for exposing Prometheus metrics.
type Storage ¶
type Storage interface {
// StorageDriver wraps distribution/registry/storage/driver.StorageDriver
// to collect statistics.
StorageDriver(driver storagedriver.StorageDriver) storagedriver.StorageDriver
}
Storage is a set of metrics for the storage subsystem.