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"
)

Well-known metric names.

Types

type Metrics

type Metrics interface {
	Timer(name string) Timer
	All() map[string]interface{}
	Clear()
}

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

func New

func New() Metrics

New returns a new Metrics object.

type Sample

type Sample interface {
	Value() interface{}
}

Sample defines a common interface to obtain a single metric value.

type Timer

type Timer interface {
	Sample
	Start()
	Stop()
}

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

Source Files

metrics.go

Version
v0.5.12
Published
Nov 22, 2017
Platform
js/wasm
Imports
1 packages
Last checked
2 minutes ago

Tools for package owners.