opa: github.com/open-policy-agent/opa/internal/prometheus Index | Files

package prometheus

import "github.com/open-policy-agent/opa/internal/prometheus"


Package Files


type Provider Uses

type Provider struct {
    // contains filtered or unexported fields

Provider wraps a metrics.Metrics provider with a Prometheus registry that can instrument the HTTP server's handlers.

func New Uses

func New(inner metrics.Metrics, logger func(attrs map[string]interface{}, f string, a ...interface{})) *Provider

New returns a new Provider object.

func (*Provider) All Uses

func (p *Provider) All() map[string]interface{}

All returns the union of the inner metric provider and the underlying prometheus registry.

func (*Provider) Clear Uses

func (p *Provider) Clear()

Clear resets the inner metric provider. The Prometheus registry does not expose an interface to clear the metrics so this call has no affect on metrics tracked by Prometheus.

func (*Provider) Counter Uses

func (p *Provider) Counter(name string) metrics.Counter

Counter returns a named counter.

func (*Provider) Histogram Uses

func (p *Provider) Histogram(name string) metrics.Histogram

Histogram returns a named histogram.

func (*Provider) Info Uses

func (p *Provider) Info() metrics.Info

Info returns attributes that describe the metric provider.

func (*Provider) InstrumentHandler Uses

func (p *Provider) InstrumentHandler(handler http.Handler, label string) http.Handler

InstrumentHandler returned wrapped HTTP handler with added prometheus instrumentation

func (*Provider) MarshalJSON Uses

func (p *Provider) MarshalJSON() ([]byte, error)

MarshalJSON returns a JSON representation of the unioned metrics.

func (*Provider) RegisterEndpoints Uses

func (p *Provider) RegisterEndpoints(registrar func(path, method string, handler http.Handler))

RegisterEndpoints registers `/metrics` endpoint

func (*Provider) Timer Uses

func (p *Provider) Timer(name string) metrics.Timer

Timer returns a named timer.

Package prometheus imports 8 packages (graph) and is imported by 2 packages. Updated 2019-10-03. Refresh now. Tools for package owners.