vmetrics

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2022 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultRegistry = NewRegistry(&RegistryConfig{}, log.New(os.Stdout, "v-metric ", log.LstdFlags))
)

Functions

func Register

func Register(metric Metric)

Types

type KafkaConfig

type KafkaConfig struct {
	BrokerList []string
	Config     *sarama.Config
	Topic      string
}

type Message

type Message struct {
	Namespace string
	Subsystem string
	Name      string
	// contains filtered or unexported fields
}

func NewMessage

func NewMessage(namespace, subsystem, name string) *Message

func (*Message) Clear

func (m *Message) Clear()

func (*Message) Consume

func (m *Message) Consume() []string

func (*Message) GetName

func (m *Message) GetName() string

func (*Message) Record

func (m *Message) Record(inf interface{})

type Metric

type Metric interface {
	Record(inf interface{})
	Consume() []string
	Clear()
	GetName() string
}

type Registry

type Registry struct {
	Metrics  []Metric
	Config   *RegistryConfig
	Producer sarama.SyncProducer
	Logger   *log.Logger
}

func NewRegistry

func NewRegistry(config *RegistryConfig, logger *log.Logger) *Registry

func (*Registry) Register

func (r *Registry) Register(metric Metric)

func (*Registry) Start

func (r *Registry) Start()

type RegistryConfig

type RegistryConfig struct {
	KafkaConfig
	Cycle time.Duration
}

Jump to

Keyboard shortcuts

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