Documentation ¶
Index ¶
- func RegGrafanaRestHandler(router *fasthttprouter.Router)
- type Annotation
- type AnnotationsArguments
- type Annotator
- type AppmeshGrafanaJson
- func (AppmeshGrafanaJson) GrafanaAdhocFilterTagValues(ctx context.Context, key string) ([]TagValuer, error)
- func (AppmeshGrafanaJson) GrafanaAdhocFilterTags(ctx context.Context) ([]TagInfoer, error)
- func (AppmeshGrafanaJson) GrafanaAnnotations(ctx context.Context, query string, args AnnotationsArguments) ([]Annotation, error)
- func (AppmeshGrafanaJson) GrafanaQuery(ctx context.Context, target string, args QueryArguments) ([]DataPoint, error)
- func (AppmeshGrafanaJson) GrafanaQueryTable(ctx context.Context, target string, args TableQueryArguments) ([]TableColumn, error)
- func (AppmeshGrafanaJson) GrafanaSearch(ctx context.Context, target string) ([]string, error)
- type DataPoint
- type GrafanaHandler
- func (h *GrafanaHandler) HandleAnnotations(ctx *fasthttp.RequestCtx)
- func (h *GrafanaHandler) HandleQuery(ctx *fasthttp.RequestCtx)
- func (h *GrafanaHandler) HandleRoot(ctx *fasthttp.RequestCtx)
- func (h *GrafanaHandler) HandleSearch(ctx *fasthttp.RequestCtx)
- func (h *GrafanaHandler) HandleTagKeys(ctx *fasthttp.RequestCtx)
- func (h *GrafanaHandler) HandleTagValues(ctx *fasthttp.RequestCtx)
- type Opt
- type Querier
- type QueryAdhocFilter
- type QueryArguments
- type QueryCommonArguments
- type Searcher
- type TableColumn
- type TableColumnData
- type TableNumberColumn
- type TableQuerier
- type TableQueryArguments
- type TableStringColumn
- type TableTimeColumn
- type TagInfoer
- type TagSearcher
- type TagStringKey
- type TagStringValue
- type TagValuer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegGrafanaRestHandler ¶
func RegGrafanaRestHandler(router *fasthttprouter.Router)
Types ¶
type Annotation ¶
type Annotation struct { Time time.Time `json:"time"` TimeEnd time.Time `json:"timeEnd,omitempty"` Title string `json:"title"` Text string `json:"text"` Tags []string `json:"tags"` }
Annotation represents an annotation that can be displayed on a graph, or in a table.
type AnnotationsArguments ¶
type AnnotationsArguments struct {
QueryCommonArguments
}
AnnotationsArguments defines the options to a annotations query.
type Annotator ¶
type Annotator interface {
GrafanaAnnotations(ctx context.Context, query string, args AnnotationsArguments) ([]Annotation, error)
}
An Annotator responds to queries for annotations from Grafana
type AppmeshGrafanaJson ¶
type AppmeshGrafanaJson struct{}
https://grafana.com/grafana/plugins/grafana-simple-json-datasource/
func (AppmeshGrafanaJson) GrafanaAdhocFilterTagValues ¶
func (AppmeshGrafanaJson) GrafanaAdhocFilterTags ¶
func (AppmeshGrafanaJson) GrafanaAdhocFilterTags(ctx context.Context) ([]TagInfoer, error)
func (AppmeshGrafanaJson) GrafanaAnnotations ¶
func (AppmeshGrafanaJson) GrafanaAnnotations(ctx context.Context, query string, args AnnotationsArguments) ([]Annotation, error)
func (AppmeshGrafanaJson) GrafanaQuery ¶
func (AppmeshGrafanaJson) GrafanaQuery(ctx context.Context, target string, args QueryArguments) ([]DataPoint, error)
GrafanaQuery handles timeserie type queries.
func (AppmeshGrafanaJson) GrafanaQueryTable ¶
func (AppmeshGrafanaJson) GrafanaQueryTable(ctx context.Context, target string, args TableQueryArguments) ([]TableColumn, error)
func (AppmeshGrafanaJson) GrafanaSearch ¶
type GrafanaHandler ¶
type GrafanaHandler struct {
// contains filtered or unexported fields
}
GrafanaHandler Is an opaque type that supports the required HTTP handlers for the Simple JSON plugin
func New ¶
func New(opts ...Opt) *GrafanaHandler
New creates a new http.Handler that will answer to the required endpoint for a SimpleJSON source. You should use WithQuerier, WithTableQuerier, WithAnnotator and WithSearch to set handlers for each of the endpionts.
func (*GrafanaHandler) HandleAnnotations ¶
func (h *GrafanaHandler) HandleAnnotations(ctx *fasthttp.RequestCtx)
HandleAnnotations responds to the /annotation requests.
func (*GrafanaHandler) HandleQuery ¶
func (h *GrafanaHandler) HandleQuery(ctx *fasthttp.RequestCtx)
HandleQuery hands the /query endpoint, calling the appropriate timeserie or table handler.
func (*GrafanaHandler) HandleRoot ¶
func (h *GrafanaHandler) HandleRoot(ctx *fasthttp.RequestCtx)
HandleRoot serves a plain 200 OK for /, required by Grafana
func (*GrafanaHandler) HandleSearch ¶
func (h *GrafanaHandler) HandleSearch(ctx *fasthttp.RequestCtx)
HandleSearch implements the /search endpoint.
func (*GrafanaHandler) HandleTagKeys ¶
func (h *GrafanaHandler) HandleTagKeys(ctx *fasthttp.RequestCtx)
HandleTagKeys implements the /tag-keys endpoint.
func (*GrafanaHandler) HandleTagValues ¶
func (h *GrafanaHandler) HandleTagValues(ctx *fasthttp.RequestCtx)
HandleTagValues implements the /tag-values endpoint.
type Opt ¶
type Opt func(*GrafanaHandler) error
Opt provides configurable options for the Handler
func WithSource ¶
func WithSource(src interface{}) Opt
WithSource will attempt to use the datasource provided as a Querier, TableQuerier, Annotator, Searcher and TagSearch if it supports the required interface.
func WithTableQuerier ¶
func WithTableQuerier(q TableQuerier) Opt
WithTableQuerier adds a table query handler.
func WithTagSearcher ¶
func WithTagSearcher(s TagSearcher) Opt
WithTagSearcher adds adhoc filter tag search handlers.
type Querier ¶
type Querier interface {
GrafanaQuery(ctx context.Context, target string, args QueryArguments) ([]DataPoint, error)
}
A Querier responds to timeseri queries from Grafana
type QueryAdhocFilter ¶
type QueryAdhocFilter struct { Key string `json:"key"` Operator string `json:"operator"` Value string `json:"value"` }
QueryAdhocFilter describes a user supplied filter to be added to each query target.
type QueryArguments ¶
type QueryArguments struct { QueryCommonArguments Interval time.Duration MaxDPs int }
QueryArguments defines the options to a timeserie query.
type QueryCommonArguments ¶
type QueryCommonArguments struct {
From, To time.Time
Filters []QueryAdhocFilter
}
QueryCommonArguments describes the arguments common to timeserie and table queries.
type TableColumn ¶
type TableColumn struct { Text string Data TableColumnData }
TableColumn represents a single table column. Data should be one the TableNumberColumn, TableStringColumn or TableTimeColumn types.
type TableColumnData ¶
type TableColumnData interface {
// contains filtered or unexported methods
}
TableColumnData is a private interface to this package, you should use one of TableStringColumn, TableNumberColumn, or TableTimeColumn
type TableNumberColumn ¶
type TableNumberColumn []float64
A TableNumberColumn holds values for a "number" column in a table.
type TableQuerier ¶
type TableQuerier interface {
GrafanaQueryTable(ctx context.Context, target string, args TableQueryArguments) ([]TableColumn, error)
}
A TableQuerier responds to table queries from Grafana
type TableQueryArguments ¶
type TableQueryArguments struct {
QueryCommonArguments
}
TableQueryArguments defines the options to a table query.
type TableStringColumn ¶
type TableStringColumn []string
A TableStringColumn holds values for a "string" column in a table.
type TableTimeColumn ¶
A TableTimeColumn holds values for a "time" column in a table.
type TagInfoer ¶
type TagInfoer interface {
// contains filtered or unexported methods
}
TagInfoer is an internal interface to describe difference types of tag.
type TagSearcher ¶
type TagSearcher interface { GrafanaAdhocFilterTags(ctx context.Context) ([]TagInfoer, error) GrafanaAdhocFilterTagValues(ctx context.Context, key string) ([]TagValuer, error) }
A TagSearcher allows the querying of tag keys and values for adhoc filters.
type TagStringValue ¶
type TagStringValue string
TagStringValue represent an adhoc query string key.