metrics

package
v0.0.0-...-e3e94bd Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2024 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Counter

type Counter interface {
	// 调用 With 方法后,statsd.Counter 会被重新实例化,原来的 Namer 和 Statsd 就都没了。
	// type Counter struct {
	//	Counter        *statsd.Counter
	//	namer          *internal.Namer
	//	statsdProvider *statsd.Statsd
	// }
	// func (c *Counter) With(labelValues ...string) metrics.Counter {
	//	name := c.namer.Format(labelValues...)
	//	return &Counter{Counter: c.statsdProvider.NewCounter(name, 1)}
	// }
	With(labelValues ...string) Counter
	Add(delta float64)
}

type CounterOpts

type CounterOpts struct {
	Namespace    string
	Subsystem    string
	Name         string
	Help         string
	LabelNames   []string
	LabelHelp    map[string]string
	StatsdFormat string
}

type Gauge

type Gauge interface {
	// 调用 With 方法后,statsd.Gauge 会被重新实例化,原来的 Namer 和 Statsd 就都没了。
	// type Gauge struct {
	// 	Gauge          *statsd.Gauge
	// 	namer          *internal.Namer
	//	statsdProvider *statsd.Statsd
	// }
	// func (g *Gauge) With(labelValues ...string) metrics.Gauge {
	//	name := g.namer.Format(labelValues...)
	//	return &Gauge{Gauge: g.statsdProvider.NewGauge(name)}
	// }
	With(labelValues ...string) Gauge
	Add(delta float64)
	Set(value float64)
}

Gauge 量表

type GaugeOpts

type GaugeOpts struct {
	Namespace    string
	Subsystem    string
	Name         string
	Help         string
	LabelNames   []string
	LabelHelp    map[string]string
	StatsdFormat string
}

type Histogram

type Histogram interface {
	// 调用 With 方法后,statsd.Timing 会被重新实例化,原来的 Namer 和 Statsd 就都没了。
	// type Histogram struct {
	// 	Timing         *statsd.Timing
	// 	namer          *internal.Namer
	// 	statsdProvider *statsd.Statsd
	// }
	// func (h *Histogram) With(labelValues ...string) metrics.Histogram {
	// 	name := h.namer.Format(labelValues...)
	//	return &Histogram{Timing: h.statsdProvider.NewTiming(name, 1)}
	// }
	With(labelValues ...string) Histogram
	Observe(value float64)
}

Histogram 柱状图

type HistogramOpts

type HistogramOpts struct {
	Namespace    string
	Subsystem    string
	Name         string
	Help         string
	Buckets      []float64
	LabelNames   []string
	LabelHelp    map[string]string
	StatsdFormat string // statsd:统计
}

type Provider

type Provider interface {
	NewCounter(CounterOpts) Counter
	NewGauge(GaugeOpts) Gauge
	NewHistogram(HistogramOpts) Histogram
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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