package prometheus
import "github.com/open-policy-agent/opa/internal/prometheus"
Index ¶
- type Provider
- func New(inner metrics.Metrics, logger func(attrs map[string]interface{}, f string, a ...interface{})) *Provider
- func (p *Provider) All() map[string]interface{}
- func (p *Provider) Clear()
- func (p *Provider) Counter(name string) metrics.Counter
- func (p *Provider) Histogram(name string) metrics.Histogram
- func (p *Provider) Info() metrics.Info
- func (p *Provider) InstrumentHandler(handler http.Handler, label string) http.Handler
- func (p *Provider) MarshalJSON() ([]byte, error)
- func (p *Provider) RegisterEndpoints(registrar func(path, method string, handler http.Handler))
- func (p *Provider) Timer(name string) metrics.Timer
Types ¶
type Provider ¶
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 ¶
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 ¶
All returns the union of the inner metric provider and the underlying prometheus registry.
func (*Provider) Clear ¶
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 ¶
Counter returns a named counter.
func (*Provider) Histogram ¶
Histogram returns a named histogram.
func (*Provider) Info ¶
Info returns attributes that describe the metric provider.
func (*Provider) InstrumentHandler ¶
InstrumentHandler returned wrapped HTTP handler with added prometheus instrumentation
func (*Provider) MarshalJSON ¶
MarshalJSON returns a JSON representation of the unioned metrics.
func (*Provider) RegisterEndpoints ¶
RegisterEndpoints registers `/metrics` endpoint
func (*Provider) Timer ¶
Timer returns a named timer.
Source Files ¶
- Version
- v0.35.0-rc1
- Published
- Nov 5, 2021
- Platform
- js/wasm
- Imports
- 9 packages
- Last checked
- 29 seconds ago –
Tools for package owners.