grafana

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2018 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package grafana provides integrations required by Chronologist to operate on Grafana.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Annotation

type Annotation struct {
	ID         int      `json:"id,omitempty"`
	UNIXMillis int64    `json:"time"`
	Tags       []string `json:"tags"`
	Text       string   `json:"text"`
}

Annotation represents grafana annotation.

func AnnotationFromChronologistAnnotation

func AnnotationFromChronologistAnnotation(ca chronologist.Annotation) Annotation

AnnotationFromChronologistAnnotation makes a grafana annotation from chronologist annotation.

func (Annotation) ToChronologistAnnotation

func (ga Annotation) ToChronologistAnnotation() (chronologist.Annotation, error)

ToChronologistAnnotation converts grafana annotation to chronologist annotation. This function always returns the same chronologist annotation for the same grafana annotation.

type Annotations

type Annotations []Annotation

Annotations is a set of grafana annotations.

type Annotator

type Annotator interface {
	// SaveAnnotation saves annotation, either creating or updating it.
	SaveAnnotation(ctx context.Context, annotation Annotation) error

	// GetAnnotations returns annotations using optional query params.
	GetAnnotations(ctx context.Context, in GetAnnotationsParams) (Annotations, error)

	// DeleteAnnotation deletes annotation by its id.
	DeleteAnnotation(ctx context.Context, id int) error
}

Annotator can manage annotations.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a grafana HTTP API client.

Client implements Annotator interface using grafana HTTP API.

func NewClient

func NewClient(host, apiKey string) *Client

NewClient returns a new grafana client.

func (*Client) DeleteAnnotation

func (c *Client) DeleteAnnotation(ctx context.Context, id int) error

DeleteAnnotation deletes annotation from grafana by its id.

See: http://docs.grafana.org/v4.6/http_api/annotations/#delete-annotation-by-id

func (*Client) GetAnnotations

func (c *Client) GetAnnotations(ctx context.Context, in GetAnnotationsParams) (Annotations, error)

GetAnnotations fetches annotations from grafana using optional query params.

See: http://docs.grafana.org/v4.6/http_api/annotations/#find-annotations

func (*Client) SaveAnnotation

func (c *Client) SaveAnnotation(ctx context.Context, annotation Annotation) error

SaveAnnotation saves annotation to grafana, either creating or updating it.

See: - http://docs.grafana.org/v4.6/http_api/annotations/#create-annotation - http://docs.grafana.org/v4.6/http_api/annotations/#update-annotation

type GetAnnotationsParams

type GetAnnotationsParams struct {
	Tags []string
}

GetAnnotationsParams represent query parameters for GetAnnotations.

func (*GetAnnotationsParams) ByRelease

func (p *GetAnnotationsParams) ByRelease(name, revision string)

ByRelease modifies the params to add a filter by specific release name and revision.

Jump to

Keyboard shortcuts

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