loki

package
v3.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: AGPL-3.0 Imports: 112 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Ring                     string = "ring"
	RuntimeConfig            string = "runtime-config"
	Overrides                string = "overrides"
	OverridesExporter        string = "overrides-exporter"
	TenantConfigs            string = "tenant-configs"
	Server                   string = "server"
	InternalServer           string = "internal-server"
	Distributor              string = "distributor"
	Querier                  string = "querier"
	CacheGenerationLoader    string = "cache-generation-loader"
	Ingester                 string = "ingester"
	PatternIngester          string = "pattern-ingester"
	PatternRingClient        string = "pattern-ring-client"
	IngesterQuerier          string = "ingester-querier"
	IngesterGRPCInterceptors string = "ingester-query-tags-interceptors"
	QueryFrontend            string = "query-frontend"
	QueryFrontendTripperware string = "query-frontend-tripperware"
	QueryLimiter             string = "query-limiter"
	QueryLimitsInterceptors  string = "query-limits-interceptors"
	QueryLimitsTripperware   string = "query-limits-tripper"
	RulerStorage             string = "ruler-storage"
	Ruler                    string = "ruler"
	RuleEvaluator            string = "rule-evaluator"
	Store                    string = "store"
	TableManager             string = "table-manager"
	MemberlistKV             string = "memberlist-kv"
	Compactor                string = "compactor"
	BloomGateway             string = "bloom-gateway"
	IndexGateway             string = "index-gateway"
	IndexGatewayRing         string = "index-gateway-ring"
	IndexGatewayInterceptors string = "index-gateway-interceptors"
	QueryScheduler           string = "query-scheduler"
	QuerySchedulerRing       string = "query-scheduler-ring"
	BloomCompactor           string = "bloom-compactor"
	BloomCompactorRing       string = "bloom-compactor-ring"
	BloomStore               string = "bloom-store"
	All                      string = "all"
	Read                     string = "read"
	Write                    string = "write"
	Backend                  string = "backend"
	Analytics                string = "analytics"
	InitCodec                string = "init-codec"
)

The various modules that make up Loki.

Variables

View Source
var ErrTooManyStorageConfigs = errors.New("too many storage configs provided in the common config, please only define one storage backend")

Functions

func DisableSignalHandling

func DisableSignalHandling(config *server.Config)

DisableSignalHandling puts a dummy signal handler

func NewServerService

func NewServerService(serv *server.Server, servicesToWaitFor func() []services.Service) services.Service

NewServerService constructs service from Server component. servicesToWaitFor is called when server is stopping, and should return all services that need to terminate before server actually stops. N.B.: this function is NOT Cortex specific, please let's keep it that way. Passed server should not react on signals. Early return from Run function is considered to be an error.

func PrintVersion

func PrintVersion(args []string) bool

func ValidateConfigCompatibility

func ValidateConfigCompatibility(c Config) []error

Types

type Codec

type Codec interface {
	transport.Codec
	worker.RequestCodec
}

Codec defines methods to encode and decode requests from HTTP, httpgrpc and Protobuf.

type Config

type Config struct {
	Target       flagext.StringSliceCSV `yaml:"target,omitempty"`
	AuthEnabled  bool                   `yaml:"auth_enabled,omitempty"`
	HTTPPrefix   string                 `yaml:"http_prefix" doc:"hidden"`
	BallastBytes int                    `yaml:"ballast_bytes"`

	Server              server.Config              `yaml:"server,omitempty"`
	InternalServer      internalserver.Config      `yaml:"internal_server,omitempty" doc:"hidden"`
	Distributor         distributor.Config         `yaml:"distributor,omitempty"`
	Querier             querier.Config             `yaml:"querier,omitempty"`
	QueryScheduler      scheduler.Config           `yaml:"query_scheduler"`
	Frontend            lokifrontend.Config        `yaml:"frontend,omitempty"`
	QueryRange          queryrange.Config          `yaml:"query_range,omitempty"`
	Ruler               ruler.Config               `yaml:"ruler,omitempty"`
	IngesterClient      ingester_client.Config     `yaml:"ingester_client,omitempty"`
	Ingester            ingester.Config            `yaml:"ingester,omitempty"`
	Pattern             pattern.Config             `yaml:"pattern_ingester,omitempty"`
	IndexGateway        indexgateway.Config        `yaml:"index_gateway"`
	BloomCompactor      bloomcompactor.Config      `yaml:"bloom_compactor,omitempty" category:"experimental"`
	BloomGateway        bloomgateway.Config        `yaml:"bloom_gateway,omitempty" category:"experimental"`
	StorageConfig       storage.Config             `yaml:"storage_config,omitempty"`
	ChunkStoreConfig    config.ChunkStoreConfig    `yaml:"chunk_store_config,omitempty"`
	SchemaConfig        config.SchemaConfig        `yaml:"schema_config,omitempty"`
	CompactorConfig     compactor.Config           `yaml:"compactor,omitempty"`
	CompactorHTTPClient compactorclient.HTTPConfig `yaml:"compactor_client,omitempty" doc:"hidden"`
	CompactorGRPCClient compactorclient.GRPCConfig `yaml:"compactor_grpc_client,omitempty" doc:"hidden"`
	LimitsConfig        validation.Limits          `yaml:"limits_config,omitempty"`
	Worker              worker.Config              `yaml:"frontend_worker,omitempty"`
	TableManager        index.TableManagerConfig   `yaml:"table_manager,omitempty"`
	MemberlistKV        memberlist.KVConfig        `yaml:"memberlist"`

	RuntimeConfig     runtimeconfig.Config `yaml:"runtime_config,omitempty"`
	OperationalConfig runtime.Config       `yaml:"operational_config,omitempty"`
	Tracing           tracing.Config       `yaml:"tracing"`
	Analytics         analytics.Config     `yaml:"analytics"`

	LegacyReadTarget bool `yaml:"legacy_read_target,omitempty" doc:"hidden|deprecated"`

	Common common.Config `yaml:"common,omitempty"`

	ShutdownDelay time.Duration `yaml:"shutdown_delay"`

	MetricsNamespace string `yaml:"metrics_namespace"`
}

Config is the root config for Loki.

func (*Config) Clone

func (c *Config) Clone() flagext.Registerer

Clone takes advantage of pass-by-value semantics to return a distinct *Config. This is primarily used to parse a different flag set without mutating the original *Config.

func (*Config) RegisterFlags

func (c *Config) RegisterFlags(f *flag.FlagSet)

RegisterFlags registers flag.

func (*Config) Validate

func (c *Config) Validate() error

Validate the config and returns an error if the validation doesn't pass

type ConfigWrapper

type ConfigWrapper struct {
	Config `yaml:",inline"`

	VerifyConfig    bool
	PrintConfig     bool
	ListTargets     bool
	LogConfig       bool
	ConfigFile      string
	ConfigExpandEnv bool
	// contains filtered or unexported fields
}

ConfigWrapper is a struct containing the Loki config along with other values that can be set on the command line for interacting with the config file or the application directly. ConfigWrapper implements cfg.DynamicCloneable, allowing configuration to be dynamically set based on the logic in ApplyDynamicConfig, which receives values set in config file

func (*ConfigWrapper) ApplyDynamicConfig

func (c *ConfigWrapper) ApplyDynamicConfig() cfg.Source

ApplyDynamicConfig satisfies WithCommonCloneable interface, and applies all rules for setting Loki config values from the common section of the Loki config file. This method's purpose is to simplify Loki's config in an opinionated way so that Loki can be run with the minimal amount of config options for most use cases. It also aims to reduce redundancy where some values are set multiple times through the Loki config.

func (*ConfigWrapper) Clone

func (c *ConfigWrapper) Clone() flagext.Registerer

Clone takes advantage of pass-by-value semantics to return a distinct *Config. This is primarily used to parse a different flag set without mutating the original *Config.

func (*ConfigWrapper) RegisterFlags

func (c *ConfigWrapper) RegisterFlags(f *flag.FlagSet)

type FormatQueryResponse

type FormatQueryResponse struct {
	Status string `json:"status"`
	Data   string `json:"data,omitempty"`
	Err    string `json:"error,omitempty"`
}

type Frontend

type Frontend interface {
	services.Service
	CheckReady(_ context.Context) error
}

type Loki

type Loki struct {
	Cfg Config

	// set during initialization
	ModuleManager *modules.Manager

	SignalHandler *signals.Handler

	Server         *server.Server
	InternalServer *server.Server

	Overrides limiter.CombinedLimits

	TenantLimits validation.TenantLimits

	Ingester          ingester.Interface
	PatternIngester   *pattern.Ingester
	PatternRingClient *pattern.RingClient
	Querier           querier.Querier

	Store      storage.Store
	BloomStore bloomshipper.StoreWithMetrics

	RulerStorage rulestore.RuleStore

	MemberlistKV *memberlist.KVInitService

	QueryFrontEndMiddleware queryrangebase.Middleware

	ClientMetrics storage.ClientMetrics

	Tee                distributor.Tee
	PushParserWrapper  push.RequestParserWrapper
	HTTPAuthMiddleware middleware.Interface

	Codec   Codec
	Metrics *server.Metrics

	UsageTracker push.UsageTracker
	// contains filtered or unexported fields
}

Loki is the root datastructure for Loki.

func New

func New(cfg Config) (*Loki, error)

New makes a new Loki.

func (*Loki) ListTargets

func (t *Loki) ListTargets()

ListTargets prints a list of available user visible targets and their dependencies

func (*Loki) Run

func (t *Loki) Run(opts RunOpts) error

Run starts Loki running, and blocks until a Loki stops.

type RunOpts

type RunOpts struct {
	// CustomConfigEndpointHandlerFn is the handlerFunc to be used by the /config endpoint.
	// If empty, default handlerFunc will be used.
	CustomConfigEndpointHandlerFn func(http.ResponseWriter, *http.Request)
	// StartTime is the time at which the main() function started executing.
	// It is used to determine the startup time as well as the running time of the Loki process.
	StartTime time.Time
}

RunOpts configures custom behavior for running Loki.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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