lokiclient

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	LokiURL    string
	LokiPrefix string
	Query      string
	Headers    map[string]string

	Username string
	Password string

	Since time.Duration
	Until time.Duration

	FailMaxDuration time.Duration

	DelayFor int
	Limit    int
}

type Data

type Data struct {
	ResultType string      `json:"resultType"`
	Result     []Stream    `json:"result"` // Warning, just stream value is handled
	Stats      interface{} `json:"stats"`  // Stats is boring, just ignore it
}

type DroppedEntry

type DroppedEntry struct {
	Labels    map[string]string `json:"labels"`
	Timestamp time.Time         `json:"timestamp"`
}

type Entry

type Entry struct {
	Timestamp time.Time
	Line      string
}

func (*Entry) UnmarshalJSON

func (e *Entry) UnmarshalJSON(b []byte) error

type LokiClient

type LokiClient struct {
	Logger *log.Entry
	// contains filtered or unexported fields
}

func NewLokiClient

func NewLokiClient(config Config) *LokiClient

func (*LokiClient) Get added in v1.6.1

func (lc *LokiClient) Get(url string) (*http.Response, error)

Create a wrapper for http.Get to be able to set headers and auth

func (*LokiClient) QueryRange

func (lc *LokiClient) QueryRange(ctx context.Context, infinite bool) chan *LokiQueryRangeResponse

func (*LokiClient) Ready

func (lc *LokiClient) Ready(ctx context.Context) error

func (*LokiClient) SetTomb

func (lc *LokiClient) SetTomb(t *tomb.Tomb)

func (*LokiClient) Tail

func (lc *LokiClient) Tail(ctx context.Context) (chan *LokiResponse, error)

type LokiQueryRangeResponse

type LokiQueryRangeResponse struct {
	Status string `json:"status"`
	Data   Data   `json:"data"`
}

LokiQuery GET response. See https://grafana.com/docs/loki/latest/api/#get-lokiapiv1query

type LokiResponse

type LokiResponse struct {
	Streams        []Stream      `json:"streams"`
	DroppedEntries []interface{} `json:"dropped_entries"` //We don't care about the actual content i think ?
}

type Stream

type Stream struct {
	Stream  map[string]string `json:"stream"`
	Entries []Entry           `json:"values"`
}

Jump to

Keyboard shortcuts

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