Help us shape the future of Go! Take the 2026 Go Developer Survey

client

package
v2.4.3 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2022 License: AGPL-3.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotSupported = errors.New("not supported")

Functions

This section is empty.

Types

type Client

type Client interface {
	Query(queryStr string, limit int, time time.Time, direction logproto.Direction, quiet bool) (*loghttp.QueryResponse, error)
	QueryRange(queryStr string, limit int, start, end time.Time, direction logproto.Direction, step, interval time.Duration, quiet bool) (*loghttp.QueryResponse, error)
	ListLabelNames(quiet bool, start, end time.Time) (*loghttp.LabelResponse, error)
	ListLabelValues(name string, quiet bool, start, end time.Time) (*loghttp.LabelResponse, error)
	Series(matchers []string, start, end time.Time, quiet bool) (*loghttp.SeriesResponse, error)
	LiveTailQueryConn(queryStr string, delayFor time.Duration, limit int, start time.Time, quiet bool) (*websocket.Conn, error)
	GetOrgID() string
}

Client contains all the methods to query a Loki instance, it's an interface to allow multiple implementations.

type DefaultClient

type DefaultClient struct {
	TLSConfig       config.TLSConfig
	Username        string
	Password        string
	Address         string
	OrgID           string
	Tripperware     Tripperware
	BearerToken     string
	BearerTokenFile string
	Retries         int
	QueryTags       string
}

Client contains fields necessary to query a Loki instance

func (*DefaultClient) GetOrgID

func (c *DefaultClient) GetOrgID() string

func (*DefaultClient) ListLabelNames

func (c *DefaultClient) ListLabelNames(quiet bool, start, end time.Time) (*loghttp.LabelResponse, error)

ListLabelNames uses the /api/v1/label endpoint to list label names

func (*DefaultClient) ListLabelValues

func (c *DefaultClient) ListLabelValues(name string, quiet bool, start, end time.Time) (*loghttp.LabelResponse, error)

ListLabelValues uses the /api/v1/label endpoint to list label values

func (*DefaultClient) LiveTailQueryConn

func (c *DefaultClient) LiveTailQueryConn(queryStr string, delayFor time.Duration, limit int, start time.Time, quiet bool) (*websocket.Conn, error)

LiveTailQueryConn uses /api/prom/tail to set up a websocket connection and returns it

func (*DefaultClient) Query

func (c *DefaultClient) Query(queryStr string, limit int, time time.Time, direction logproto.Direction, quiet bool) (*loghttp.QueryResponse, error)

Query uses the /api/v1/query endpoint to execute an instant query excluding interfacer b/c it suggests taking the interface promql.Node instead of logproto.Direction b/c it happens to have a String() method nolint:interfacer

func (*DefaultClient) QueryRange

func (c *DefaultClient) QueryRange(queryStr string, limit int, start, end time.Time, direction logproto.Direction, step, interval time.Duration, quiet bool) (*loghttp.QueryResponse, error)

QueryRange uses the /api/v1/query_range endpoint to execute a range query excluding interfacer b/c it suggests taking the interface promql.Node instead of logproto.Direction b/c it happens to have a String() method nolint:interfacer

func (*DefaultClient) Series

func (c *DefaultClient) Series(matchers []string, start, end time.Time, quiet bool) (*loghttp.SeriesResponse, error)

type FileClient

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

FileClient is a type of LogCLI client that do LogQL on log lines from the given file directly, instead get log lines from Loki servers.

func NewFileClient

func NewFileClient(r io.ReadCloser) *FileClient

NewFileClient returns the new instance of FileClient for the given `io.ReadCloser`

func (*FileClient) GetOrgID

func (f *FileClient) GetOrgID() string

func (*FileClient) ListLabelNames

func (f *FileClient) ListLabelNames(quiet bool, start, end time.Time) (*loghttp.LabelResponse, error)

func (*FileClient) ListLabelValues

func (f *FileClient) ListLabelValues(name string, quiet bool, start, end time.Time) (*loghttp.LabelResponse, error)

func (*FileClient) LiveTailQueryConn

func (f *FileClient) LiveTailQueryConn(queryStr string, delayFor time.Duration, limit int, start time.Time, quiet bool) (*websocket.Conn, error)

func (*FileClient) Query

func (f *FileClient) Query(q string, limit int, t time.Time, direction logproto.Direction, quiet bool) (*loghttp.QueryResponse, error)

func (*FileClient) QueryRange

func (f *FileClient) QueryRange(queryStr string, limit int, start, end time.Time, direction logproto.Direction, step, interval time.Duration, quiet bool) (*loghttp.QueryResponse, error)

func (*FileClient) Series

func (f *FileClient) Series(matchers []string, start, end time.Time, quiet bool) (*loghttp.SeriesResponse, error)

type Tripperware

type Tripperware func(http.RoundTripper) http.RoundTripper

Tripperware can wrap a roundtripper.

Jump to

Keyboard shortcuts

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