spectator

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Overview

Package spectator provides a minimal Go implementation of the Netflix Java Spectator library. The goal of this package is to allow Go programs to emit metrics to Atlas.

Please refer to the Java Spectator documentation for information on spectator / Atlas fundamentals: https://netflix.github.io/spectator/en/latest/

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseProtocolLine added in v1.3.2

func ParseProtocolLine(line string) (string, *meter.Id, string, error)

ParseProtocolLine parses a line of the spectator protocol. Utility exposed for testing.

Types

type Config

type Config struct {
	Location   string            `json:"sidecar.output-location"`
	CommonTags map[string]string `json:"sidecar.common-tags"`
	Log        logger.Logger
}

Config represents the Registry's configuration.

func (*Config) GetLocation

func (c *Config) GetLocation() string

GetLocation Checks the location provided in the config and the environment variable SPECTATOR_OUTPUT_LOCATION. If neither are valid, returns the default UDP address.

type Meter

type Meter interface {
	MeterId() *meter.Id
}

Meter represents the functionality presented by the individual meter types.

type Registry

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

Registry is the collection of meters being reported.

func NewRegistry

func NewRegistry(config *Config) (*Registry, error)

NewRegistry generates a new registry from the config.

If config.Log is unset, it defaults to using the default logger.

func NewRegistryConfiguredBy

func NewRegistryConfiguredBy(filePath string) (*Registry, error)

NewRegistryConfiguredBy loads a new Config JSON file from disk at the path specified.

func (*Registry) AgeGauge added in v1.1.1

func (r *Registry) AgeGauge(name string, tags map[string]string) *meter.AgeGauge

func (*Registry) AgeGaugeWithId added in v1.1.1

func (r *Registry) AgeGaugeWithId(id *meter.Id) *meter.AgeGauge

func (*Registry) Close

func (r *Registry) Close()

func (*Registry) Counter

func (r *Registry) Counter(name string, tags map[string]string) *meter.Counter

Counter calls NewId() with the name and tags, and then calls r.CounterWithId() using that *Id.

func (*Registry) CounterWithId

func (r *Registry) CounterWithId(id *meter.Id) *meter.Counter

func (*Registry) DistributionSummary

func (r *Registry) DistributionSummary(name string, tags map[string]string) *meter.DistributionSummary

func (*Registry) DistributionSummaryWithId

func (r *Registry) DistributionSummaryWithId(id *meter.Id) *meter.DistributionSummary

func (*Registry) Gauge

func (r *Registry) Gauge(name string, tags map[string]string) *meter.Gauge

func (*Registry) GaugeWithId

func (r *Registry) GaugeWithId(id *meter.Id) *meter.Gauge

func (*Registry) GaugeWithIdWithTTL

func (r *Registry) GaugeWithIdWithTTL(id *meter.Id, duration time.Duration) *meter.Gauge

func (*Registry) GaugeWithTTL

func (r *Registry) GaugeWithTTL(name string, tags map[string]string, duration time.Duration) *meter.Gauge

func (*Registry) GetLogger

func (r *Registry) GetLogger() logger.Logger

GetLogger returns the internal logger.

func (*Registry) GetWriter added in v1.3.0

func (r *Registry) GetWriter() writer.Writer

func (*Registry) MaxGauge

func (r *Registry) MaxGauge(name string, tags map[string]string) *meter.MaxGauge

func (*Registry) MaxGaugeWithId

func (r *Registry) MaxGaugeWithId(id *meter.Id) *meter.MaxGauge

func (*Registry) MonotonicCounter added in v1.1.1

func (r *Registry) MonotonicCounter(name string, tags map[string]string) *meter.MonotonicCounter

MonotonicCounter calls NewId() with the name and tags, and then calls r.MonotonicCounterWithId() using that *Id.

func (*Registry) MonotonicCounterWithId added in v1.1.1

func (r *Registry) MonotonicCounterWithId(id *meter.Id) *meter.MonotonicCounter

func (*Registry) NewId

func (r *Registry) NewId(name string, tags map[string]string) *meter.Id

NewId calls meters.NewId() and adds the CommonTags registered in the config.

func (*Registry) PercentileDistributionSummary

func (r *Registry) PercentileDistributionSummary(name string, tags map[string]string) *meter.PercentileDistributionSummary

func (*Registry) PercentileDistributionSummaryWithId

func (r *Registry) PercentileDistributionSummaryWithId(id *meter.Id) *meter.PercentileDistributionSummary

func (*Registry) PercentileTimer

func (r *Registry) PercentileTimer(name string, tags map[string]string) *meter.PercentileTimer

func (*Registry) PercentileTimerWithId

func (r *Registry) PercentileTimerWithId(id *meter.Id) *meter.PercentileTimer

func (*Registry) SetLogger

func (r *Registry) SetLogger(logger logger.Logger)

func (*Registry) Timer

func (r *Registry) Timer(name string, tags map[string]string) *meter.Timer

Timer calls NewId() with the name and tags, and then calls r.TimerWithId() using that *Id.

func (*Registry) TimerWithId

func (r *Registry) TimerWithId(id *meter.Id) *meter.Timer

TimerWithId returns a new *Timer, using the provided meter identifier.

type RegistryInterface

type RegistryInterface interface {
	GetLogger() logger.Logger
	SetLogger(logger logger.Logger)
	NewId(name string, tags map[string]string) *meter.Id
	Counter(name string, tags map[string]string) *meter.Counter
	CounterWithId(id *meter.Id) *meter.Counter
	MonotonicCounter(name string, tags map[string]string) *meter.MonotonicCounter
	MonotonicCounterWithId(id *meter.Id) *meter.MonotonicCounter
	Timer(name string, tags map[string]string) *meter.Timer
	TimerWithId(id *meter.Id) *meter.Timer
	Gauge(name string, tags map[string]string) *meter.Gauge
	GaugeWithId(id *meter.Id) *meter.Gauge
	GaugeWithTTL(name string, tags map[string]string, ttl time.Duration) *meter.Gauge
	GaugeWithIdWithTTL(id *meter.Id, ttl time.Duration) *meter.Gauge
	AgeGauge(name string, tags map[string]string) *meter.AgeGauge
	AgeGaugeWithId(id *meter.Id) *meter.AgeGauge
	MaxGauge(name string, tags map[string]string) *meter.MaxGauge
	MaxGaugeWithId(id *meter.Id) *meter.MaxGauge
	DistributionSummary(name string, tags map[string]string) *meter.DistributionSummary
	DistributionSummaryWithId(id *meter.Id) *meter.DistributionSummary
	PercentileDistributionSummary(name string, tags map[string]string) *meter.PercentileDistributionSummary
	PercentileDistributionSummaryWithId(id *meter.Id) *meter.PercentileDistributionSummary
	PercentileTimer(name string, tags map[string]string) *meter.PercentileTimer
	PercentileTimerWithId(id *meter.Id) *meter.PercentileTimer
	GetWriter() writer.Writer
	Close()
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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