loki

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2023 License: AGPL-3.0 Imports: 102 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"
	Ingester                 string = "ingester"
	Querier                  string = "querier"
	CacheGenerationLoader    string = "cache-generation-loader"
	IngesterQuerier          string = "ingester-querier"
	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"
	IndexGateway             string = "index-gateway"
	IndexGatewayRing         string = "index-gateway-ring"
	QueryScheduler           string = "query-scheduler"
	QuerySchedulerRing       string = "query-scheduler-ring"
	All                      string = "all"
	Read                     string = "read"
	Write                    string = "write"
	Backend                  string = "backend"
	Analytics                string = "analytics"
)

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 AdjustForTimeoutsMigration

func AdjustForTimeoutsMigration(c *Config) error

AdjustForTimeoutsMigration will adjust Loki timeouts configuration to be in accordance with the next major release.

We're preparing to unify the querier:engine:timeout and querier:query_timeout into a single timeout named limits_config:query_timeout. The migration encompasses of: - If limits_config:query_timeout is explicitly configured, use it everywhere as it is a new configuration and by configuring it, users are expressing that they're willing of using it. - If none are explicitly configured, use the default engine:timeout everywhere as it is longer than the default limits_config:query_timeout and otherwise users would start to experience shorter timeouts without expecting it. - If only the querier:engine:timeout was explicitly configured, warn the user and use it everywhere.

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 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"`

	// TODO(dannyk): Remove these config options before next release; they don't need to be configurable.
	//				 These are only here to allow us to test the new functionality.
	UseBufferedLogger bool `yaml:"use_buffered_logger" doc:"hidden"`
	UseSyncLogger     bool `yaml:"use_sync_logger" doc:"hidden"`

	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"`
	IndexGateway        indexgateway.Config         `yaml:"index_gateway"`
	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 compactor_client.HTTPConfig `yaml:"compactor_client,omitempty" doc:"hidden"`
	CompactorGRPCClient compactor_client.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"`
	Tracing       tracing.Config       `yaml:"tracing"`
	Analytics     analytics.Config     `yaml:"analytics"`

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

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

	ShutdownDelay time.Duration `yaml:"shutdown_delay" category:"experimental"`
}

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
	Querier  querier.Querier

	Store storage.Store

	RulerStorage rulestore.RuleStore

	MemberlistKV *memberlist.KVInitService

	QueryFrontEndTripperware basetripper.Tripperware

	HTTPAuthMiddleware middleware.Interface
	// 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)
}

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