Documentation
¶
Overview ¶
Package metricobserver provides an implementation of apiserver/observer.ObserverFactory that maintains Prometheus metrics.
Index ¶
Constants ¶
const ( MetricLabelFacade = "facade" MetricLabelVersion = "version" MetricLabelMethod = "method" MetricLabelErrorCode = "error_code" )
MetricLabels used for setting labels for the Counter and Summary vectors.
Variables ¶
var MetricLabelNames = []string{ MetricLabelFacade, MetricLabelVersion, MetricLabelMethod, MetricLabelErrorCode, }
MetricLabelNames holds the names for reporting the names of the metric types when calling the observers.
Functions ¶
func NewObserverFactory ¶
func NewObserverFactory(config Config) (observer.ObserverFactory, error)
NewObserverFactory returns a function that, when called, returns a new Observer. NewObserverFactory registers the API request metrics, and each Observer updates those metrics.
Types ¶
type Config ¶
type Config struct { // Clock is the clock to use for all time-related operations. Clock clock.Clock // MetricsCollector defines . MetricsCollector MetricsCollector }
Config contains the configuration for an Observer.
type MetricsCollector ¶
type MetricsCollector interface { // APIRequestDuration returns a SummaryVec for updating the duration of // api request duration. APIRequestDuration() SummaryVec }
MetricsCollector represents a bundle of metrics that is used by the observer factory.
type Observer ¶
type Observer struct {
// contains filtered or unexported fields
}
Observer is an API server request observer that collects Prometheus metrics.
func (*Observer) RPCObserver ¶
RPCObserver is part of the observer.Observer interface.
type SummaryVec ¶
type SummaryVec interface { // With returns a Summary for a given labels slice With(prometheus.Labels) prometheus.Observer }
SummaryVec is a Collector that bundles a set of Summaries that all share the same description.