juju: github.com/juju/juju/apiserver/observer/metricobserver Index | Files | Directories

package metricobserver

import "github.com/juju/juju/apiserver/observer/metricobserver"

Package metricobserver provides an implementation of apiserver/observer.ObserverFactory that maintains Prometheus metrics.

Index

Package Files

doc.go metricobserver.go

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.

func NewObserverFactory Uses

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.

type Config Uses

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.

func (Config) Validate Uses

func (cfg Config) Validate() error

Validate validates the observer factory configuration.

type CounterVec Uses

type CounterVec interface {
    // With returns a Counter for a given labels slice
    With(prometheus.Labels) prometheus.Counter
}

CounterVec is a Collector that bundles a set of Counters that all share the same description.

type MetricsCollector Uses

type MetricsCollector interface {
    // APIRequestDuration returns a SummaryVec for updating the duration of
    // api request duration.
    APIRequestDuration() SummaryVec

    // DeprecatedAPIRequestsTotal returns a CounterVec for updating the number of
    // api requests total.
    // The following is obsolete and should be removed for 2.6 release
    DeprecatedAPIRequestsTotal() CounterVec

    // DeprecatedAPIRequestDuration returns a SummaryVec for updating the duration of
    // api request duration.
    // The following is obsolete and should be removed for 2.6 release
    DeprecatedAPIRequestDuration() SummaryVec
}

MetricsCollector represents a bundle of metrics that is used by the observer factory. go:generate mockgen -package mocks -destination mocks/metrics_collector_mock.go github.com/juju/juju/apiserver/observer/metricobserver MetricsCollector,CounterVec,SummaryVec go:generate mockgen -package mocks -destination mocks/metrics_mock.go github.com/prometheus/client_golang/prometheus Counter,Summary

type Observer Uses

type Observer struct {
    // contains filtered or unexported fields
}

Observer is an API server request observer that collects Prometheus metrics.

func (*Observer) Join Uses

func (*Observer) Join(req *http.Request, connectionID uint64)

Join is part of the observer.Observer interface.

func (*Observer) Leave Uses

func (*Observer) Leave()

Leave is part of the observer.Observer interface.

func (*Observer) Login Uses

func (*Observer) Login(entity names.Tag, _ names.ModelTag, _ bool, _ string)

Login is part of the observer.Observer interface.

func (*Observer) RPCObserver Uses

func (o *Observer) RPCObserver() rpc.Observer

RPCObserver is part of the observer.Observer interface.

type SummaryVec Uses

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.

Directories

PathSynopsis
mocksPackage mocks is a generated GoMock package.

Package metricobserver imports 9 packages (graph) and is imported by 13 packages. Updated 2019-09-19. Refresh now. Tools for package owners.