Documentation
¶
Overview ¶
Package lokitest is a fake Loki 3 for the tests of the packages that open a Loki source (the session, the engine through it): an http.Handler over in-memory entries that answers the requests locklog sends (labels, label values, query_range for streams and for the metric form, the instant metric query), with Loki's paging (limit over all streams, forward, end excluded) and categorized labels, behind basic authentication unless Open.
The loki package's own tests have a richer fake of their own; this one only needs to be faithful to the subset a session reads.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Entry ¶
type Entry struct {
TS int64 // Unix nanoseconds
Labels map[string]string
Meta map[string]string
Line string
}
Entry is one log entry.
type Server ¶
type Server struct {
Entries []Entry
// User and Password authenticate a request (basic); Open serves every
// request without credentials.
User, Password string
Open bool
// contains filtered or unexported fields
}
Server is the fake. Set its fields before serving.
func (*Server) MetricQueries ¶ added in v0.2.0
MetricQueries returns the number of metric queries served (the count_over_time sums locklog sends), log queries excluded.