analytics

package
v1.60.5 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: AGPL-3.0, AGPL-3.0-or-later Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Gauge

func Gauge(name string, value float64)

Gauge records a gauge value on all backends

func RegisterBackend

func RegisterBackend(b Backend)

RegisterBackend registers a new backend

func Start

func Start() error

Start starts all backends

func Stop

func Stop() error

Stop stops all backends

Types

type Backend

type Backend interface {
	Name() string
	Start() error
	Gauge(string, float64)
	Stop() error
}

Backend is the interface for backends

type ConsoleBackend

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

ConsoleBackend is a backend which prints to the console or any output stream

func NewConsole

func NewConsole(out io.Writer) *ConsoleBackend

NewConsole creates a new console backend

func (*ConsoleBackend) Gauge

func (b *ConsoleBackend) Gauge(name string, value float64)

func (*ConsoleBackend) Name

func (b *ConsoleBackend) Name() string

func (*ConsoleBackend) Start

func (b *ConsoleBackend) Start() error

func (*ConsoleBackend) Stop

func (b *ConsoleBackend) Stop() error

type LibratoBackend

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

LibratoBackend is a backend which sends analytics to Librato

func NewLibrato

func NewLibrato(username, token, source string, timeout time.Duration, waitGroup *sync.WaitGroup) *LibratoBackend

func (*LibratoBackend) Gauge

func (b *LibratoBackend) Gauge(name string, value float64)

func (*LibratoBackend) Name

func (b *LibratoBackend) Name() string

func (*LibratoBackend) Start

func (b *LibratoBackend) Start() error

func (*LibratoBackend) Stop

func (b *LibratoBackend) Stop() error

type MockBackend added in v1.22.3

type MockBackend struct {
	Gauges map[string][]float64
}

MockBackend is a backend which records values for testing

func NewMock added in v1.22.3

func NewMock() *MockBackend

NewMock creates a new mock backend

func (*MockBackend) Gauge added in v1.22.3

func (b *MockBackend) Gauge(name string, value float64)

func (*MockBackend) Name added in v1.22.3

func (b *MockBackend) Name() string

func (*MockBackend) Start added in v1.22.3

func (b *MockBackend) Start() error

func (*MockBackend) Stop added in v1.22.3

func (b *MockBackend) Stop() error

Jump to

Keyboard shortcuts

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