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, extra common tags, and logger. All fields are optional. The extra common tags are added to every metric, outside the common tags provided by spectatord.
Possible values for location are:
- `""` - Empty string will default to `udp`.
- `none` - Configure a no-op writer that does nothing. Can be used to disable metrics collection.
- `memory` - Write metrics to memory. Useful for testing.
- `stderr` - Write metrics to standard error.
- `stdout` - Write metrics to standard output.
- `udp` - Write metrics to the default spectatord UDP port. This is the default value.
- `unix` - Write metrics to the default spectatord Unix Domain Socket. Useful for high-volume scenarios.
- `file:///path/to/file` - Write metrics to a file.
- `udp://host:port` - Write metrics to a UDP socket.
- `unix:///path/to/socket` - Write metrics to a Unix Domain Socket.
The output location can be overridden by configuring an environment variable SPECTATOR_OUTPUT_LOCATION with one of the values listed above. Overriding the output location may be useful for integration testing.
type Registry ¶
type Registry interface { GetLogger() logger.Logger NewId(name string, tags map[string]string) *meter.Id AgeGauge(name string, tags map[string]string) *meter.AgeGauge AgeGaugeWithId(id *meter.Id) *meter.AgeGauge Counter(name string, tags map[string]string) *meter.Counter CounterWithId(id *meter.Id) *meter.Counter DistributionSummary(name string, tags map[string]string) *meter.DistributionSummary DistributionSummaryWithId(id *meter.Id) *meter.DistributionSummary 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 MaxGauge(name string, tags map[string]string) *meter.MaxGauge MaxGaugeWithId(id *meter.Id) *meter.MaxGauge MonotonicCounter(name string, tags map[string]string) *meter.MonotonicCounter MonotonicCounterWithId(id *meter.Id) *meter.MonotonicCounter MonotonicCounterUint(name string, tags map[string]string) *meter.MonotonicCounterUint MonotonicCounterUintWithId(id *meter.Id) *meter.MonotonicCounterUint 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 Timer(name string, tags map[string]string) *meter.Timer TimerWithId(id *meter.Id) *meter.Timer 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.