Documentation ¶
Overview ¶
Package Warp10Exporter is an helper to create GTS for Warp10 Example:
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) } } }
For a full guide visit https://github.com/PierreZ/Warp10Exporter
Index ¶
- Variables
- func ChangePrefix(newprefix string)
- func SetHeader(header string)
- func SetURI(uri string)
- type Batch
- type Datapoint
- type Datapoints
- type GTS
- func (gts *GTS) AddDatapoint(ts time.Time, value interface{}) *GTS
- func (gts *GTS) AddLabel(key string, value string) *GTS
- func (gts *GTS) FlushOnDisk(path string) error
- func (gts *GTS) GetIdentifier() string
- func (gts *GTS) Print(b *bytes.Buffer)
- func (gts *GTS) Push(warp10Endpoint string, warp10Token string) error
- func (gts *GTS) WithLabels(labels Labels) *GTS
- type Labels
Constants ¶
This section is empty.
Variables ¶
var ErrEmptyBatch = errors.New("Empty Batch")
ErrEmptyBatch is the error thrown when trying to push or write an empty batch of GTS
var ErrEmptyGTS = errors.New("Empty GTS")
ErrEmptyGTS is the error thrown when trying to push or write an empty GTS
Functions ¶
func ChangePrefix ¶
func ChangePrefix(newprefix string)
ChangePrefix is changing the prefix for metrics files.
Types ¶
type Batch ¶
Batch is allowing you to push multiples GTS in a single push
func (*Batch) FlushOnDisk ¶
FlushOnDisk is flushing the metrics into a file compatible with the Warp10 Input format. You can then use Beamium to handle the push.
type Datapoint ¶
Datapoint are datapoint in a GTS
func (*Datapoint) PrintValue ¶
PrintValue is Printing the value It's supporting string
type GTS ¶
type GTS struct { Classname string Labels map[string]string Datapoints Datapoints }
GTS are GeoTimeSeries
func (*GTS) AddDatapoint ¶
AddDatapoint is adding a datapoint to a GTS
func (*GTS) FlushOnDisk ¶
FlushOnDisk is flushing the metrics into a file compatible with the Warp10 Input format. You can then use Beamium to handle the push.
func (*GTS) GetIdentifier ¶
GetIdentifier is returning an identifier for a GTS The identifier is useful to handle a map of GTS
func (*GTS) Print ¶
Print is printing the Warp10 Input Format it respects the following format: TS// NAME{LABELS} VALUE