lokishipper

package module
v0.0.0-...-0696984 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

README

Lokishipper

A standalone Loki client slightly modified from the official promtail client from https://github.com/grafana/loki.

See the GoDoc: https://godoc.org/github.com/1lann/lokishipper

License

Licensed under Apache 2.0 as a derivative work of Loki, which is also licensed under Apache 2.0.

Copyright 2019 Loki Authors (https://github.com/grafana/loki)

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

	http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Changes made

  • Isolated the promtail client.
  • Reduced dependencies by lifting code into the package directly.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	EntryHandler
	// Stop goroutine sending batch of entries.
	Stop()
}

Client pushes entries to Loki and can be stopped

func New

func New(cfg Config, logger log.Logger) (Client, error)

New makes a new Client.

func NewMulti

func NewMulti(logger log.Logger, cfgs ...Config) (Client, error)

NewMulti creates a new client

type Config

type Config struct {
	URL       *url.URL
	BatchWait time.Duration
	BatchSize int

	Client *http.Client

	// The labels to add to any time series or alerts when communicating with loki
	ExternalLabels model.LabelSet
	Timeout        time.Duration
}

Config describes configuration for a HTTP pusher client.

type EntryHandler

type EntryHandler interface {
	Handle(labels model.LabelSet, time time.Time, entry string) error
}

EntryHandler is something that can "handle" entries.

type MultiClient

type MultiClient []Client

MultiClient is client pushing to one or more loki instances.

func (MultiClient) Handle

func (m MultiClient) Handle(labels model.LabelSet, time time.Time, entry string) error

Handle Implements api.EntryHandler

func (MultiClient) Stop

func (m MultiClient) Stop()

Stop implements Client

type MultiError

type MultiError []error

The MultiError type implements the error interface, and contains the Errors used to construct it.

func (*MultiError) Add

func (es *MultiError) Add(err error)

Add adds the error to the error list if it is not nil.

func (MultiError) Err

func (es MultiError) Err() error

Err returns the error list as an error or nil if it is empty.

func (MultiError) Error

func (es MultiError) Error() string

Returns a concatenated string of the contained errors

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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