Categorygithub.com/armandocerna/graphite-api-client
modulepackage
0.0.0-20190712030642-b48a0e1f8608
Repository: https://github.com/armandocerna/graphite-api-client.git
Documentation: pkg.go.dev

# README

About

Client for graphite web api. Full documentation with other examples could be found on godoc.

Example

	package main
	
	import (
		"github.com/lorehov/graphite-api-client"
		"log"
		"fmt"
	)

	func main() {
		client, err := NewFromString("https://my-graphite.tld")
		if err != nil {
			log.Fatalf("Couldn't parse url")
		}

		res, err := client.QueryRender(
			RenderRequest{
				From: time.Unix(1468339853, 0),
				Until: time.Unix(1568339853, 0),
				MaxDataPoints: 1000,
				Targets: []string{"main"},
			},
		)

		if err != nil {
			log.Fatalf("Error %s while performing query %s", err.Error(), err.Query)
		}
		
		for _, series := range res {
			fmt.Printf("Processing target %s", series.Target)
			for _, dp := range series.Datapoints {
				fmt.Printf("Datapoint %+v", dp)
			}
		}
	}

# Functions

NewFromString is a convenient function for constructing `graphite.Client` from url string.

# Variables

No description provided by the author

# Structs

Client is client to `graphite web api` (http://graphite-api.readthedocs.io/en/latest/api.html).
DataPoint describes concrete point of time series.
No description provided by the author
Results is a list of metric ids.
FindMetricRequest is struct describing request to /metrics/find api.
No description provided by the author
RenderRequest is struct, describing request to graphite `/render/` api.
RequestError is special error, which not only implements an error interface, but also provides access to `Query` field, containing original query which cause an error.
Series describes time series data for given target.