package metrics

Import Path
	github.com/tmc/go-iroh/metrics (on go.dev)

Dependency Relation
	imports 12 packages, and imported by one package

Involved Source Files Package metrics provides a small OpenMetrics registry for go-iroh metrics. The Go API is not stable before v1 and may change in any v0 release. family.go metrics.go server.go
Package-Level Type Names (total 12)
/* sort by: | */
Family is a metric vector keyed by a fixed label set. StructuredSnapshot returns all children in f. With returns the child metric for labelValues. *Family : StructuredSource func NewFamily(name string, typ MetricType, labelNames ...string) *Family
FamilyMetric is one labeled metric in a [Family]. Add adds delta to m. Use it for counter families. Set sets m to value. Use it for gauge families. func (*Family).With(labelValues ...string) (*FamilyMetric, error)
HistogramBucket is one cumulative histogram bucket. Count is the cumulative count for this bucket. Le is the inclusive upper bound. Use math.Inf(1) for +Inf. func Histogram(sum float64, count uint64, buckets []HistogramBucket) MetricValue
Label is one OpenMetrics label on a sample. Name string Value string
MetricType is the OpenMetrics type of a metric value. func NewFamily(name string, typ MetricType, labelNames ...string) *Family const CounterMetric const GaugeMetric const HistogramMetric
MetricValue is one metric sample in a [StructuredSnapshot]. Buckets []HistogramBucket Count uint64 Counter uint64 Gauge float64 Labels []Label Name string Sum float64 Type MetricType func Counter(v uint64) MetricValue func Gauge(v float64) MetricValue func Histogram(sum float64, count uint64, buckets []HistogramBucket) MetricValue
Registry collects named metric sources. Register adds source under prefix. Prefix must be non-empty and unique. WriteOpenMetrics writes all registered counter snapshots in OpenMetrics text format. func NewRegistry() *Registry func Handler(r *Registry) http.Handler func NewServer(addr string, r *Registry) *Server
Server is a small HTTP server for OpenMetrics scraping. ListenAndServe serves metrics until the server is shut down. Serve serves metrics on l until the server is shut down. Shutdown gracefully shuts down the metrics server. func NewServer(addr string, r *Registry) *Server
Snapshot is a point-in-time set of unsigned counter values. String implements expvar.Var, returning the snapshot as JSON. Snapshot : expvar.Var Snapshot : fmt.Stringer func Source.Snapshot() Snapshot func github.com/tmc/go-iroh/iroh.Metrics.Snapshot() Snapshot
Source returns a point-in-time metrics snapshot. ( Source) Snapshot() Snapshot github.com/tmc/go-iroh/iroh.Metrics
StructuredSnapshot is a point-in-time set of typed metric values. func (*Family).StructuredSnapshot() StructuredSnapshot func StructuredSource.StructuredSnapshot() StructuredSnapshot
StructuredSource returns a point-in-time typed metrics snapshot. ( StructuredSource) StructuredSnapshot() StructuredSnapshot *Family
Package-Level Functions (total 7)
Counter returns a counter metric value.
Gauge returns a gauge metric value.
Handler returns an HTTP handler serving r at /metrics.
Histogram returns a histogram metric value. Buckets are copied and sorted by upper bound before OpenMetrics output.
NewFamily returns a metric family with labelNames in output order.
NewRegistry returns an empty registry.
NewServer returns a metrics HTTP server bound to addr.
Package-Level Constants (total 3)
CounterMetric is a monotonically increasing counter.
GaugeMetric is a point-in-time value that may increase or decrease.
HistogramMetric is a cumulative histogram.