graphite

package
v0.0.0-...-82de52e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 2, 2022 License: BSD-3-Clause Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainsCurlyBrackets

func ContainsCurlyBrackets(query string) bool

ContainsCurlyBrackets detect if the query contains curly brackets

func ContainsFunction

func ContainsFunction(query string) bool

ContainsFunction detect if the query contains a function

func ContainsNameWithCurlyBrackets

func ContainsNameWithCurlyBrackets(query string) bool

ContainsNameWithCurlyBrackets detect if the query contains a name with curly brackets

func ContainsSerie

func ContainsSerie(query string) bool

ContainsSerie detect if the query contains a serie

func ContainsString

func ContainsString(query string) bool

ContainsString detect if the query contains a string

func CreateExpandRequest

func CreateExpandRequest(query string) (*core.Node, error)

CreateExpandRequest return children of a serie given in parameter as mc2 tree

func CreateFindRequest

func CreateFindRequest(query string, wildcards bool) (*core.Node, error)

CreateFindRequest return children of a serie given in parameter as mc2 tree

func CreateRenderRequest

func CreateRenderRequest(target, from, until string) (*core.Node, error)

CreateRenderRequest return what you ask for as mc2 tree

func Format

func Format(gtss []GTS, format string) ([]byte, error)

Format GTS to desire format nolint: gocyclo

func GetFunction

func GetFunction(name string) (func(*core.Node, []string, map[string]string) (*core.Node, error), error)

GetFunction return the function if exists

func Parse

func Parse(target, from, until string, node *core.Node) (*core.Node, error)

Parse a graphite query

func ParseSerie

func ParseSerie(serie string) (string, map[string]string, error)

ParseSerie return the node corresponding to the query

func ParseTime

func ParseTime(t []byte) (*time.Time, error)

ParseTime provided in the query

Types

type Dygraph

type Dygraph struct {
	Labels []string    `json:"labels"`
	Data   [][]float64 `json:"data"`
}

Dygraph structure definition

type ExpandQuery

type ExpandQuery struct {
	Query       []string `json:"query" description:"The metrics query. Can be specified multiple times."`
	GroupByExpr int      `json:"groupByExpr" description:"Whether to return a flat list of results or group them by query."`
	LeavesOnly  int      `json:"leavesOnly" description:"Whether to only return leaves or both branches and leaves."`
	JSONP       string   `json:"jsonp" description:"Wraps the response in a JSONP callback"`
}

ExpandQuery which is used by the /metrics/expand path http://graphite-api.readthedocs.io/en/latest/api.html#metrics-expand

func (*ExpandQuery) Parse

func (s *ExpandQuery) Parse(req *http.Request) error

Parse method is an implementation of Parser nolint: gocyclo

type FindQuery

type FindQuery struct {
	Query     string `json:"query" description:"The query to search for."`
	Format    string `json:"format" description:"The output format to use."`
	Wildcards int    `json:"wildcards" description:"Whether to add a wildcard result at the end or no."`
	From      int64  `json:"from" description:"Epoch timestamp from which to consider metrics."`
	Until     int64  `json:"until" description:"Epoch timestamp until which to consider metrics."`
	JSONP     string `json:"jsonp" description:"Wraps the response in a JSONP callback"`
}

FindQuery which is used by the /metrics/find path http://graphite-api.readthedocs.io/en/latest/api.html#metrics-find

func (*FindQuery) Parse

func (s *FindQuery) Parse(req *http.Request) error

Parse method is an implementation of Parser nolint: gocyclo

type Function

type Function struct {
	Name       string
	Arguments  []string
	Parameters map[string]string
}

Function structure using to describe a graphite function call

func ParseFunction

func ParseFunction(function string) Function

ParseFunction transform a graphite function into a struct

func ParseQuery

func ParseQuery(query string) ([]Function, error)

ParseQuery and transform it into a call stack

type GTS

type GTS struct {
	ClassName string            `json:"c"`
	Labels    map[string]string `json:"l"`
	Values    [][]float64       `json:"v"`
}

GTS is the format which is returned by warp10

func (*GTS) ToCSV

func (s *GTS) ToCSV() []string

ToCSV convert GTS to graphite csv format http://graphite-api.readthedocs.io/en/latest/api.html#csv

func (*GTS) ToDygraph

func (s *GTS) ToDygraph() Dygraph

ToDygraph convert GTS to graphite dygraph format http://graphite-api.readthedocs.io/en/latest/api.html#dygraph

func (*GTS) ToJSON

func (s *GTS) ToJSON() JSON

ToJSON convert GTS to graphite JSON format http://graphite-api.readthedocs.io/en/latest/api.html#json

func (*GTS) ToRaw

func (s *GTS) ToRaw() string

ToRaw convert GTS to graphite raw format http://graphite-api.readthedocs.io/en/latest/api.html#raw

func (*GTS) ToRicksaw

func (s *GTS) ToRicksaw() Ricksaw

ToRicksaw convert GTS to graphite ricksaw format http://graphite-api.readthedocs.io/en/latest/api.html#rickshaw

type IndexQuery

type IndexQuery struct {
	JSONP string `json:"jsonp" description:"Wraps the response in a JSONP callback"`
}

IndexQuery which is used by the /metrics/index.json path http://graphite-api.readthedocs.io/en/latest/api.html#metrics-index-json

func (*IndexQuery) Parse

func (s *IndexQuery) Parse(req *http.Request) error

Parse method is an implementation of Parser

type JSON

type JSON struct {
	Target     string      `json:"target"`
	DataPoints [][]float64 `json:"datapoints"`
}

JSON structure definition

type Parser

type Parser interface {
	Parse(*http.Request) error
}

Parser interface in order to mutualize development

type RenderQuery

type RenderQuery struct {
	Target []string `` /* 151-byte string literal not displayed */
	From   string   `json:"from" description:"time period to graph from specifies the beginning, ..."`
	Until  string   `json:"until" description:"... until specifies the end"`
	Format string   `json:"format" description:"Controls the format of data returned Affects all targets passed in the URL."`
	JSONP  string   `json:"jsonp" description:"Wraps the response in a JSONP callback"`
}

RenderQuery which is used by the /render path http://graphite-api.readthedocs.io/en/latest/api.html#the-render-api-render

func (*RenderQuery) Parse

func (s *RenderQuery) Parse(req *http.Request) error

Parse method is an implementation of Parser nolint: gocyclo

type Ricksaw

type Ricksaw struct {
	Target     string           `json:"target"`
	DataPoints []RicksawElement `json:"datapoints"`
}

Ricksaw structure definition

type RicksawElement

type RicksawElement struct {
	X int64   `json:"x"`
	Y float64 `json:"y"`
}

RicksawElement structure definition

type TreeJSON

type TreeJSON struct {
	Text          string `json:"text"`
	Expandable    int    `json:"expandable"`
	Leaf          int    `json:"leaf"`
	ID            string `json:"id"`
	AllowChildren int    `json:"allowChildren"`
}

TreeJSON graphite response format

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL