client

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2020 License: Apache-2.0 Imports: 16 Imported by: 31

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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, from, through time.Time, direction logproto.Direction, step, interval time.Duration, quiet bool) (*loghttp.QueryResponse, error)
	ListLabelNames(quiet bool, from, through time.Time) (*loghttp.LabelResponse, error)
	ListLabelValues(name string, quiet bool, from, through time.Time) (*loghttp.LabelResponse, error)
	Series(matchers []string, from, through time.Time, quiet bool) (*loghttp.SeriesResponse, error)
	LiveTailQueryConn(queryStr string, delayFor int, limit int, from int64, 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 added in v1.6.0

type DefaultClient struct {
	TLSConfig config.TLSConfig
	Username  string
	Password  string
	Address   string
	OrgID     string
}

Client contains fields necessary to query a Loki instance

func (*DefaultClient) GetOrgID added in v1.6.0

func (c *DefaultClient) GetOrgID() string

func (*DefaultClient) ListLabelNames added in v1.6.0

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

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

func (*DefaultClient) ListLabelValues added in v1.6.0

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

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

func (*DefaultClient) LiveTailQueryConn added in v1.6.0

func (c *DefaultClient) LiveTailQueryConn(queryStr string, delayFor int, limit int, from int64, quiet bool) (*websocket.Conn, error)

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

func (*DefaultClient) Query added in v1.6.0

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 added in v1.6.0

func (c *DefaultClient) QueryRange(queryStr string, limit int, from, through 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 added in v1.6.0

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

Jump to

Keyboard shortcuts

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