Documentation
¶
Index ¶
Constants ¶
const (
DEFAULT_TIMEOUT_MS = 5000
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶ added in v1.15.0
type Client struct {
// contains filtered or unexported fields
}
Client is an io.Writer that ships log lines to Loki in batches. Write never waits on the network: lines are buffered and pushed by a background goroutine, and dropped when the buffer is full or the client is closed. Call Close before the process exits to push what is still buffered.
func NewClient ¶ added in v1.15.0
func NewClient(params *WithPromtailParams) (*Client, error)
type WithPromtailParams ¶
type WithPromtailParams struct {
App string
Environment string
PromtailHost string
PromtailUsername string
PromtailPassword string
PromtailLabels string
PromtailEnabled bool
PromtailTimeoutMS int
}
func (WithPromtailParams) EffectiveTimeoutMS ¶ added in v1.15.0
func (p WithPromtailParams) EffectiveTimeoutMS() int
EffectiveTimeoutMS returns the timeout the client uses for each batch push. The old client applied the timeout to every line, so values below legacyTimeoutThresholdMS are taken as leftovers from it and replaced with the batch default, as is zero.
func (WithPromtailParams) Validate ¶
func (p WithPromtailParams) Validate() error
Validate only requires the Loki connection settings when Promtail is enabled, so apps that don't ship logs can leave them out.