A Go framework to generate and push metrics to The Warp 10 Platform.
package main
import (
"time"
warp "github.com/PierreZ/Warp10Exporter"
)
func main() {
gts := warp.NewGTS("metrics.test").WithLabels(warp.Labels{
"ip": "1.2.3.4",
}).AddDatapoint(time.Now(), "42")
// Not checking the error
gts.Push("http://localhost:8080", "WRITE_TOKEN")
// You can also create batchs
batch := warp.NewBatch()
batch.Register(gts)
gts.AddDatapoint(ts, 42)
err := batch.Push("http://localhost:8080", "WRITE_TOKEN")
if err != nil {
// You can also write metrics to a file, to use
// https://github.com/ovh/beamium for example
err = batch.FlushOnDisk("/opt/beamium/sink")
if err != nil {
panic(err)
}
}
}
- Order Datapoints before writing into buffer to optimize parsing on Warp10 side
- Add Geo on Datapoints by creating NewGeoDatapoints(...)