Documentation ¶
Overview ¶
Package metrics provides Etre metrics.
Index ¶
Constants ¶
const ( Query byte = iota // counter (group and system) SetOp // counter Labels // histogram LatencyMs // histogram MissSLA // counter Read // counter ReadQuery // counter ReadId // counter ReadMatch // histogram ReadLabels // counter Write // counter CreateOne // counter CreateMany // counter CreateBulk // histogram UpdateId // counter UpdateQuery // counter UpdateBulk // histogram DeleteId // counter DeleteQuery // counter DeleteBulk // histogram DeleteLabel // counter LabelRead // counter (per-label) LabelUpdate // counter (per-label) LabelDelete // counter (per-label) DbError // counter (global) APIError // counter (global) ClientError // counter (global) CDCClients // counter (global) Created // counter Updated // counter Deleted // counter AuthenticationFailed // counter (system) AuthorizationFailed // counter InvalidEntityType // counter QueryTimeout // counter Load // gauge (system) Error // counter (system) )
See ../metrics.go for docs of each metric. The number/order of these does not matter. They are const numbers only to avoid typos and enable compile-time checking, e.g. m.Inc(metrics.Reed, 1) will cause error "undefined: metrics.Reed". Implementations of Metrics must ensure that metric X = etre.MetricReport.X.
Variables ¶
This section is empty.
Functions ¶
func NewGroupEntityMetrics ¶ added in v0.9.2
func NewGroupEntityMetrics(gm *groupMetrics) *groupEntityMetrics
func NewGroupMetrics ¶ added in v0.9.2
func NewGroupMetrics() *groupMetrics
func NewSystemMetrics ¶ added in v0.9.2
func NewSystemMetrics() *systemMetrics
Types ¶
type Group ¶
type Group struct {
// contains filtered or unexported fields
}
Group is a one-to-many proxy for setting metrics in multiple metric groups. Group implements the Metrics inteface. The API uses a single Group for all the auth.Caller.MetricGroups. The API can make a single call to Inc(), for example, and Group calls Inc() for every metric group.
func (Group) EntityType ¶
type GroupFactory ¶
type GroupFactory struct {
Store Store
}
GroupFactory implements Factory to make Group metrics in the API.
func (GroupFactory) Make ¶
func (f GroupFactory) Make(groupNames []string) Metrics
type Metrics ¶
type Metrics interface { // EntityType binds the Metrics instance to an entity type before calling // other methods. This method must be called first. // // The caller is responsible for validating the entity type. // // This is only valid for group metrics. EntityType(string) // Inc increments the metric name (mn) by n. The metric must be a counter. Inc(mn byte, n int64) // IncLabel increments the metric name (mn) counter for the label by 1. // The metric must be LabelRead, LabelUpdate, or LabelDelete. // // This is only valid for group metrics. IncLabel(mn byte, label string) // Val records one measurement (n) for the metric name (mn). The metric // must be a gauge. Val(mn byte, n int64) // Trace increments trace value counters by 1. Trace(map[string]string) // Report returns a snapshot of all metrics, calculating stats like average // and percentiles. Report(reset bool) etre.Metrics }
Metrics abstracts how metrics are stored and sampled.