Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SquareMetrics ¶
type SquareMetrics struct { Registry metrics.Registry // contains filtered or unexported fields }
SquareMetrics posts metrics to an HTTP/JSON bridge endpoint
func NewMetrics ¶
func NewMetrics(metricsURL, metricsPrefix string, client *http.Client, interval time.Duration, registry metrics.Registry, logger *log.Logger) *SquareMetrics
NewMetrics is the entry point for this code
func (*SquareMetrics) AddGauge ¶
func (mb *SquareMetrics) AddGauge(name string, callback func() int64)
AddGauge installs a callback for a gauge with the given name. The callback will be called every metrics collection interval, and should provide an updated value for the gauge.
func (*SquareMetrics) SerializeMetrics ¶
func (mb *SquareMetrics) SerializeMetrics() []map[string]interface{}
SerializeMetrics returns a map of the collected metrics, suitable for JSON marshalling
func (*SquareMetrics) ServeHTTP ¶
func (mb *SquareMetrics) ServeHTTP(w http.ResponseWriter, r *http.Request)
Click to show internal directories.
Click to hide internal directories.