From d81e996ccad164ec9d285982c7b5fcf3f8ad8fd8 Mon Sep 17 00:00:00 2001 From: Nic Pottier Date: Mon, 28 Aug 2017 10:37:42 -0500 Subject: [PATCH] add measure time back in, problem was on librato side --- librato/librato.go | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/librato/librato.go b/librato/librato.go index c298e4335..21f76c78b 100644 --- a/librato/librato.go +++ b/librato/librato.go @@ -42,7 +42,7 @@ func (c *Sender) AddGauge(name string, value float64) { return } - c.buffer <- gauge{Name: strings.ToLower(name), Value: value} + c.buffer <- gauge{Name: strings.ToLower(name), Value: value, MeasureTime: time.Now().Unix()} } // Start starts our librato sender, callers can use Stop to stop it @@ -81,8 +81,9 @@ func (c *Sender) flush(count int) { // build our payload reqPayload := &payload{ - Source: c.source, - Gauges: make([]gauge, 0, len(c.buffer)), + MeasureTime: time.Now().Unix(), + Source: c.source, + Gauges: make([]gauge, 0, len(c.buffer)), } // read up to our count of gauges @@ -116,7 +117,7 @@ func (c *Sender) flush(count int) { return } - logrus.WithField("comp", "librato").WithField("count", len(reqPayload.Gauges)).Debug("flushed to librato") + logrus.WithField("comp", "librato").WithField("count", len(reqPayload.Gauges)).Info("flushed to librato") } // Stop stops our sender, callers can use the WaitGroup used during initialization to block for stop @@ -128,13 +129,15 @@ func (c *Sender) Stop() { } type gauge struct { - Name string `json:"name"` - Value float64 `json:"value"` + Name string `json:"name"` + Value float64 `json:"value"` + MeasureTime int64 `json:"measure_time"` } type payload struct { - Source string `json:"source"` - Gauges []gauge `json:"gauges"` + MeasureTime int64 `json:"measure_time"` + Source string `json:"source"` + Gauges []gauge `json:"gauges"` } // Sender is responsible for collecting gauges and sending them in batches to our librato server