grafana

package
v0.0.0-...-bb60f61 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package grafana contains a client implementation for obtaining data sources and dashboards from a grafana instance.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

The Client type contains methods for interacting with the grafana instance.

func NewClient

func NewClient(url, apiKey string) (*Client, error)

NewClient creates a new grafana client for the given url that authenticates using the given API key, returns an error if the health check fails.

func (*Client) IterateDashboards

func (cl *Client) IterateDashboards(ctx context.Context, fn DashboardIterator) error

IterateDashboards searches for all dashboards in the grafana instance and invokes fn for each one. If fn returns an error or the context is cancelled iteration will stop.

func (*Client) IterateDataSources

func (cl *Client) IterateDataSources(ctx context.Context, fn DataSourceIterator) error

IterateDataSources searches for all data sources in the grafana instance and invokes fn for each one. If fn returns an error or the context is cancelled iteration will stop.

func (*Client) Ping

func (cl *Client) Ping() error

Ping returns a non-nil error if the grafana instance is deemed unhealthy.

type Dashboard

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

The Dashboard type is an io.Reader implementation that contains raw JSON representing the dashboard.

func (*Dashboard) Read

func (d *Dashboard) Read(p []byte) (int, error)

Read the content of the dashboard JSON, copying it to p.

func (Dashboard) UID

func (d Dashboard) UID() string

UID returns the unique UID for the dashboard.

type DashboardIterator

type DashboardIterator func(ctx context.Context, d *Dashboard) error

The DashboardIterator is a function that is invoked for each dashboard when using Client.IterateDashboards.

type DataSource

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

The DataSource type is an io.Reader implementation that contains raw JSON representing the data source.

func (DataSource) ID

func (d DataSource) ID() string

ID returns the unique ID for the data source.

func (*DataSource) Read

func (d *DataSource) Read(p []byte) (int, error)

Read the content of the data source JSON, copying it to p.

type DataSourceIterator

type DataSourceIterator func(ctx context.Context, d *DataSource) error

The DataSourceIterator is a function that is invoked for each dashboard when using Client.IterateDataSources.

Jump to

Keyboard shortcuts

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