metrics

package
v0.1.73 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package metrics holds the rules for the metrics a mod declares in its manifest: which declarations a build may carry, which labels a call may name, and how each kind combines the values added to it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Find

func Find(manifest *manifestpb.Manifest, name string) *metricspb.Metric

Find returns the metric named name that manifest declares, or nil.

func Labeled

func Labeled(metric *metricspb.Metric, label string) bool

Labeled reports whether a call may label metric with label: one of its labels, or empty for a metric without labels.

func Validate

func Validate(manifest *manifestpb.Manifest) error

Validate checks the metrics manifest declares.

Types

type Tally

type Tally struct {
	// contains filtered or unexported fields
}

Tally keeps one player's totals of one mod's metrics.

func (*Tally) Add

func (t *Tally) Add(metric *metricspb.Metric, label string, value float64)

Add adds value to metric's total under label.

func (*Tally) Text

func (t *Tally) Text() string

Text describes the totals in one line, such as "hud.opened[compact] 3".

func (*Tally) Totals

func (t *Tally) Totals() *metricspb.MetricTotals

Totals returns the totals in name and label order.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL