package metrics

import "github.com/open-policy-agent/opa/metrics"

Package metrics contains helpers for performance metric management inside the policy engine.

Index

Constants

const (
	RegoQueryCompile  = "rego_query_compile"
	RegoQueryEval     = "rego_query_eval"
	RegoQueryParse    = "rego_query_parse"
	RegoModuleParse   = "rego_module_parse"
	RegoModuleCompile = "rego_module_compile"
	RegoPartialEval   = "rego_partial_eval"
)

Well-known metric names.

Types

type Counter

type Counter interface {
	Value() interface{}
	Incr()
}

Counter defines the interface for a monotonic increasing counter.

type Histogram

type Histogram interface {
	Value() interface{}
	Update(int64)
}

Histogram defines the interface for a histogram with hardcoded percentiles.

type Metrics

type Metrics interface {
	Timer(name string) Timer
	Histogram(name string) Histogram
	Counter(name string) Counter
	All() map[string]interface{}
	Clear()
	json.Marshaler
}

Metrics defines the interface for a collection of performance metrics in the policy engine.

func New

func New() Metrics

New returns a new Metrics object.

type Timer

type Timer interface {
	Value() interface{}
	Int64() int64
	Start()
	Stop() int64
}

Timer defines the interface for a restartable timer that accumulates elapsed time.

Source Files

metrics.go

Version
v0.10.2
Published
Dec 10, 2018
Platform
js/wasm
Imports
6 packages
Last checked
2 minutes ago

Tools for package owners.