0.3.0 output: librato

This commit is contained in:
Cameron Sparr
2015-12-19 14:19:43 -07:00
parent ec39d10695
commit 2611931f82
3 changed files with 40 additions and 30 deletions

View File

@@ -67,8 +67,8 @@ func (d *Datadog) Write(points []*client.Point) error {
return nil
}
ts := TimeSeries{}
var tempSeries = make([]*Metric, len(points))
var acceptablePoints = 0
tempSeries := []*Metric{}
metricCounter := 0
for _, pt := range points {
mname := strings.Replace(pt.Name(), "_", ".", -1)
@@ -78,15 +78,15 @@ func (d *Datadog) Write(points []*client.Point) error {
Metric: mname + strings.Replace(fieldName, "_", ".", -1),
}
metric.Points[0] = amonPt
tempSeries[acceptablePoints] = metric
acceptablePoints += 1
tempSeries = append(tempSeries, metric)
metricCounter++
}
} else {
log.Printf("unable to build Metric for %s, skipping\n", pt.Name())
}
}
ts.Series = make([]*Metric, acceptablePoints)
ts.Series = make([]*Metric, metricCounter)
copy(ts.Series, tempSeries[0:])
tsBytes, err := json.Marshal(ts)
if err != nil {