client

package
v1.6.3 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrJavaScriptReturnedNoData = errors.New("javascript did not return any dashboard data")
	ErrDashboardHTTPError       = errors.New("dashboard request does not return 200 OK")
	ErrEmptyBlobURL             = errors.New("empty blob URL")
	ErrEmptyCSVData             = errors.New("empty csv data")
)

Functions

This section is empty.

Types

type Credential

type Credential struct {
	HeaderName  string
	HeaderValue string
}

type Grafana

type Grafana interface {
	Dashboard(ctx context.Context, dashUID string) (dashboard.Dashboard, error)
	PanelPNG(ctx context.Context, dashUID string, p dashboard.Panel, t dashboard.TimeRange) (dashboard.PanelImage, error)
	PanelCSV(ctx context.Context, dashUID string, p dashboard.Panel, t dashboard.TimeRange) (dashboard.CSVData, error)
}

Grafana is a Grafana API httpClient.

type GrafanaClient

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

GrafanaClient is the struct that will implement required interfaces.

func New

func New(
	logger log.Logger,
	conf config.Config,
	httpClient *http.Client,
	chromeInstance chrome.Instance,
	workerPools worker.Pools,
	appURL string,
	credential Credential,
	queryParams url.Values,
) GrafanaClient

New creates a new Grafana Client. Cookies and Authorization headers, if found, will be forwarded in the requests queryParams are Grafana template variable url values of the form var-{name}={value}, e.g. var-host=dev.

func (GrafanaClient) Dashboard

func (g GrafanaClient) Dashboard(ctx context.Context, dashUID string) (dashboard.Dashboard, error)

Dashboard fetches dashboard from Grafana.

func (GrafanaClient) PanelCSV added in v1.6.3

PanelCSV returns CSV data of a given panel.

func (GrafanaClient) PanelPNG

PanelPNG returns encoded PNG image of a given panel.

Jump to

Keyboard shortcuts

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