Documentation ¶
Index ¶
- Constants
- Variables
- type Component
- type Config
- type CountAggregator
- func (ca *CountAggregator) AddTags(tags ...string)
- func (ca *CountAggregator) Count(stat string, count float64, tags ...string)
- func (ca *CountAggregator) Gauge(stat string, value float64, tags ...string)
- func (ca *CountAggregator) GetTags() []string
- func (ca *CountAggregator) Histogram(stat string, value float64, tags ...string)
- func (ca *CountAggregator) Timing(stat string, duration time.Duration, tags ...string)
- type CountAggregatorComponent
- type CountAggregatorConfig
- type DatadogComponent
- type DatadogConfig
- type NullComponent
- type NullConfig
- type Stat
- type StatFn
- type StatTagKey
Constants ¶
const ( // OutputNull is the selection for no metrics. OutputNull = "NULL" // OutputDatadog selects the datadog/extended-statsd driver. OutputDatadog = "DATADOG" )
Variables ¶
var StatFromContext = xstats.FromContext
StatFromContext is the concrete implementation of StatFn that should be used at runtime.
Functions ¶
This section is empty.
Types ¶
type Component ¶
type Component struct { NullStat *NullComponent Datadog *DatadogComponent }
Component enables creating configured loggers.
func NewComponent ¶
func NewComponent() *Component
NewComponent populates an StatComponent with defaults.
type Config ¶
type Config struct { Output string `description:"Destination stream of the stats. One of NULLSTAT, DATADOG."` NullStat *NullConfig Datadog *DatadogConfig }
Config contains all configuration values for creating a system stat client.
type CountAggregator ¶ added in v0.3.0
type CountAggregator struct { Stater xstats.XStater Bucket map[StatTagKey]float64 FlushInterval time.Duration // contains filtered or unexported fields }
CountAggregator is a wrapper around xstats.XStater, that aggregates Count metrics on a time interval before sending them through Stater
func (*CountAggregator) AddTags ¶ added in v0.3.0
func (ca *CountAggregator) AddTags(tags ...string)
AddTags implements XStater interface
func (*CountAggregator) Count ¶ added in v0.3.0
func (ca *CountAggregator) Count(stat string, count float64, tags ...string)
Count implements XStater interface. This Count in particular inserts a stat, then proceeds to try to flush the Bucket. If there exists a flush in progress, we proceed to overflow on the channel and return by default
func (*CountAggregator) Gauge ¶ added in v0.3.0
func (ca *CountAggregator) Gauge(stat string, value float64, tags ...string)
Gauge implements XStater interface
func (*CountAggregator) GetTags ¶ added in v0.3.0
func (ca *CountAggregator) GetTags() []string
GetTags implements XStater interface
type CountAggregatorComponent ¶ added in v0.3.0
type CountAggregatorComponent struct {
StatComponent *DatadogComponent
}
CountAggregatorComponent implements the settings.Component interface for a countaggregator.
func (*CountAggregatorComponent) New ¶ added in v0.3.0
func (c *CountAggregatorComponent) New(ctx context.Context, conf *CountAggregatorConfig) (xstats.XStater, error)
New creates a configured countaggregator that wraps around a stats client.
func (*CountAggregatorComponent) Settings ¶ added in v0.3.0
func (c *CountAggregatorComponent) Settings() *CountAggregatorConfig
Settings generates a config with default values applied.
type CountAggregatorConfig ¶ added in v0.3.0
type CountAggregatorConfig struct { FlushInterval time.Duration `description:"Frequency of when to send aggregated metrics."` StatConfig *DatadogConfig }
CountAggregatorConfig is the configuration for a CountAggregator.
func (*CountAggregatorConfig) Name ¶ added in v0.3.0
func (*CountAggregatorConfig) Name() string
Name of the configuration as it might appear in config files.
type DatadogComponent ¶
type DatadogComponent struct{}
DatadogComponent implements the settings.Component interface for a datadog stats client.
func (*DatadogComponent) New ¶
func (*DatadogComponent) New(_ context.Context, conf *DatadogConfig) (Stat, error)
New creates a configured stats client.
func (*DatadogComponent) Settings ¶
func (*DatadogComponent) Settings() *DatadogConfig
Settings generates a config with default values applied.
type DatadogConfig ¶
type DatadogConfig struct { Address string `description:"Listener address to use when sending metrics."` FlushInterval time.Duration `description:"Frequencing of sending metrics to listener."` Tags []string `description:"Any static tags for all metrics."` PacketSize int `description:"Max packet size to send."` }
DatadogConfig is for configuration a datadog client.
func (*DatadogConfig) Name ¶
func (*DatadogConfig) Name() string
Name of the configuration as it might appear in config files.
type NullComponent ¶
type NullComponent struct{}
NullComponent implements the settings.Component interface for a NOP stat client.
func (*NullComponent) New ¶
func (*NullComponent) New(_ context.Context, conf *NullConfig) (Stat, error)
New creates a configured stats client.
func (*NullComponent) Settings ¶
func (*NullComponent) Settings() *NullConfig
Settings generates a config with default values applied.
type NullConfig ¶
type NullConfig struct{}
NullConfig is empty. There are no options for NULL.
func (*NullConfig) Name ¶
func (*NullConfig) Name() string
Name of the configuration as it might appear in config files.
type Stat ¶
Stat is the project metrics client interface. it is currently an alias for xstats.XStater.
type StatFn ¶
StatFn is the type that should be accepted by code that intend to emit custom metrics using the context stat client.
type StatTagKey ¶ added in v0.3.0
StatTagKey is a struct that represents a composite key for storing aggregated stats