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 ¶
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config represents the Registry's configuration.
func NewConfig ¶
func NewConfig( location string, commonTags map[string]string, log logger.Logger, ) (*Config, error)
NewConfig creates a new configuration with the provided location, common tags, and logger. All fields are optional. Possible values for location are:
- `none`: Configures a no-op writer that does nothing. Can be used to disable metrics collection.
- `stdout`: Writes metrics to stdout.
- `stderr`: Writes metrics to stderr.
- `memory`: Writes metrics to memory. Useful for testing.
- `file:///path/to/file`: Writes metrics to a file.
- `unix:///path/to/socket`: Writes metrics to a Unix domain socket.
- `udp://host:port`: Writes metrics to a UDP socket.
If location is not provided, the default value `udp://127.0.0.1:1234` will be used
type Registry ¶
type Registry interface { GetLogger() 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() }
Registry is the main entry point for interacting with the Spectator library.
func NewRegistry ¶
NewRegistry generates a new registry from a passed Config created through NewConfig.