Documentation
¶
Overview ¶
Package promexporter exports Prometheus metrics for groupcache.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Exporter ¶
type Exporter struct {
// contains filtered or unexported fields
}
Exporter implements interface prometheus.Collector to extract metrics from groupcache.
func NewExporter ¶
NewExporter creates Exporter. namespace is usually the empty string.
func (*Exporter) Collect ¶
func (e *Exporter) Collect(ch chan<- prometheus.Metric)
Collect is called by the Prometheus registry when collecting metrics.
func (*Exporter) Describe ¶
func (e *Exporter) Describe(ch chan<- *prometheus.Desc)
Describe sends metrics descriptors.
type GroupProvider ¶
type GroupProvider interface {
Groups() []*groupcache.Group
}
type GroupStatistics ¶
type GroupStatistics interface {
// Name returns the group's name
Name() string
// Gets represents any Get request, including from peers
Gets() int64
// CacheHits represents either cache was good
CacheHits() int64
// GetFromPeersLatencyLower represents slowest duration to request value from peers
GetFromPeersLatencyLower() float64
// PeerLoads represents either remote load or remote cache hit (not an error)
PeerLoads() int64
// PeerErrors represents a count of errors from peers
PeerErrors() int64
// Loads represents (gets - cacheHits)
Loads() int64
// LoadsDeduped represents after singleflight
LoadsDeduped() int64
// LocalLoads represents total good local loads
LocalLoads() int64
// LocalLoadErrs represents total bad local loads
LocalLoadErrs() int64
// ServerRequests represents gets that came over the network from peers
ServerRequests() int64
MainCacheItems() int64
MainCacheBytes() int64
MainCacheGets() int64
MainCacheHits() int64
MainCacheEvictions() int64
MainCacheEvictionsNonExpired() int64
HotCacheItems() int64
HotCacheBytes() int64
HotCacheGets() int64
HotCacheHits() int64
HotCacheEvictions() int64
HotCacheEvictionsNonExpired() int64
}
GroupStatistics is a plugable interface to extract metrics from a groupcache implementation. GroupStatistics is used by Exporter to collect the group statistics. The user must provide a concrete implementation of this interface that knows how to extract group statistics from the actual groupcache implementation.
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
func WithGroups ¶
func WithGroups(groups GroupProvider) Option
Set function used to get groups to export. Called on every scrape.
func WithLabels ¶
Set labels added to exported metrics.
func WithNamespace ¶
Set namespace of exported metrics. Namespace serves as the prefix to metric names, like: `<namespace>_groupcache_cache_bytes`.