metrics

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2021 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GraphiteTimeout = 1 * time.Minute

Functions

This section is empty.

Types

type AtomicFloat64

type AtomicFloat64 uint64

func (*AtomicFloat64) Add

func (f *AtomicFloat64) Add(delta float64)

func (*AtomicFloat64) Get

func (f *AtomicFloat64) Get() float64

func (*AtomicFloat64) Set

func (f *AtomicFloat64) Set(value float64)

func (*AtomicFloat64) Swap

func (f *AtomicFloat64) Swap(value float64) float64

type Counter

type Counter interface {
	Inc()
	Add(delta float64)
}

type DummyRegistry

type DummyRegistry struct {
	Prefix string
	Log    bool
}

func (DummyRegistry) Counter

func (d DummyRegistry) Counter(name string, labels Labels) Counter

func (DummyRegistry) Gauge

func (d DummyRegistry) Gauge(name string, labels Labels) Gauge

func (DummyRegistry) Histogram

func (d DummyRegistry) Histogram(name string, labels Labels, buckets []float64) Histogram

func (DummyRegistry) WithPrefix

func (d DummyRegistry) WithPrefix(prefix string) Registry

type Gauge

type Gauge interface {
	Set(value float64)
	Inc()
	Dec()
	Add(delta float64)
	Sub(delta float64)
}

type GraphiteClient

type GraphiteClient struct {
	Address string
	HGBF    string
	Metrics map[string]GraphiteMetric
	Mutex   *flu.RWMutex
	// contains filtered or unexported fields
}

func (*GraphiteClient) Close

func (c *GraphiteClient) Close() error

func (*GraphiteClient) Counter

func (c *GraphiteClient) Counter(name string, labels Labels) Counter

func (*GraphiteClient) Flush

func (c *GraphiteClient) Flush(now time.Time) error

func (*GraphiteClient) FlushInBackground

func (c *GraphiteClient) FlushInBackground(ctx context.Context, flushEvery time.Duration)

func (*GraphiteClient) Gauge

func (c *GraphiteClient) Gauge(name string, labels Labels) Gauge

func (*GraphiteClient) Histogram

func (c *GraphiteClient) Histogram(name string, labels Labels, buckets []float64) Histogram

func (*GraphiteClient) WithPrefix

func (c *GraphiteClient) WithPrefix(prefix string) Registry

type GraphiteCounter

type GraphiteCounter AtomicFloat64

func (*GraphiteCounter) Add

func (c *GraphiteCounter) Add(delta float64)

func (*GraphiteCounter) Inc

func (c *GraphiteCounter) Inc()

func (*GraphiteCounter) Reset

func (c *GraphiteCounter) Reset() (float64, bool)

func (*GraphiteCounter) Write

func (c *GraphiteCounter) Write(b *strings.Builder, now string, key string)

type GraphiteGauge

type GraphiteGauge AtomicFloat64

func (*GraphiteGauge) Add

func (g *GraphiteGauge) Add(delta float64)

func (*GraphiteGauge) Dec

func (g *GraphiteGauge) Dec()

func (*GraphiteGauge) Inc

func (g *GraphiteGauge) Inc()

func (*GraphiteGauge) Reset

func (g *GraphiteGauge) Reset() (float64, bool)

func (*GraphiteGauge) Set

func (g *GraphiteGauge) Set(value float64)

func (*GraphiteGauge) Sub

func (g *GraphiteGauge) Sub(delta float64)

func (*GraphiteGauge) Write

func (g *GraphiteGauge) Write(b *strings.Builder, now string, key string)

type GraphiteHistogram

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

func (GraphiteHistogram) Observe

func (h GraphiteHistogram) Observe(value float64)

func (GraphiteHistogram) Write

func (h GraphiteHistogram) Write(b *strings.Builder, now string, key string)

type GraphiteMetric

type GraphiteMetric interface {
	Write(b *strings.Builder, now string, key string)
}

type Histogram

type Histogram interface {
	Observe(value float64)
}

type Label

type Label struct {
	Key   string
	Value interface{}
}

type Labeled

type Labeled interface {
	Labels() Labels
}

type Labels

type Labels []Label

func (Labels) Add

func (l Labels) Add(key string, value interface{}) Labels

func (Labels) AddAll

func (l Labels) AddAll(labels Labels) Labels

func (Labels) Key

func (l Labels) Key(key string) Labels

func (Labels) Keys

func (l Labels) Keys() []string

func (Labels) Map

func (l Labels) Map() map[string]interface{}

func (Labels) Path

func (l Labels) Path(sep, esc string) string

func (Labels) StringMap

func (l Labels) StringMap() map[string]string

type PrometheusListener

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

func NewPrometheusListener

func NewPrometheusListener(address string) *PrometheusListener

func (*PrometheusListener) Close

func (p *PrometheusListener) Close() error

func (*PrometheusListener) CloseWithContext

func (p *PrometheusListener) CloseWithContext(ctx context.Context) error

func (*PrometheusListener) Counter

func (p *PrometheusListener) Counter(name string, labels Labels) Counter

func (*PrometheusListener) Gauge

func (p *PrometheusListener) Gauge(name string, labels Labels) Gauge

func (*PrometheusListener) Histogram

func (p *PrometheusListener) Histogram(name string, labels Labels, buckets []float64) Histogram

func (*PrometheusListener) MustRegister

func (*PrometheusListener) WithPrefix

func (p *PrometheusListener) WithPrefix(prefix string) Registry

type Registry

type Registry interface {
	WithPrefix(prefix string) Registry
	Counter(name string, labels Labels) Counter
	Gauge(name string, labels Labels) Gauge
	Histogram(name string, labels Labels, buckets []float64) Histogram
}

Jump to

Keyboard shortcuts

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