Help us shape the future of Go! Take the 2026 Go Developer Survey

parse

package
v3.7.8 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: AGPL-3.0 Imports: 58 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// RootBlocks is an ordered list of root blocks with their associated descriptions.
	// The order is the same order that will follow the markdown generation.
	// Root blocks map to the configuration variables defined in Config of pkg/loki/loki.go
	RootBlocks = []RootBlock{
		{
			Name:       "server",
			StructType: []reflect.Type{reflect.TypeFor[server.Config]()},
			Desc:       "Configures the server of the launched module(s).",
		},
		{
			Name:       "distributor",
			StructType: []reflect.Type{reflect.TypeFor[distributor.Config]()},
			Desc:       "Configures the distributor.",
		},
		{
			Name:       "querier",
			StructType: []reflect.Type{reflect.TypeFor[querier.Config]()},
			Desc:       "Configures the querier. Only appropriate when running all modules or just the querier.",
		},
		{
			Name:       "query_scheduler",
			StructType: []reflect.Type{reflect.TypeFor[scheduler.Config]()},
			Desc:       "The query_scheduler block configures the Loki query scheduler. When configured it separates the tenant query queues from the query-frontend.",
		},
		{
			Name:       "frontend",
			StructType: []reflect.Type{reflect.TypeFor[frontend.Config]()},
			Desc:       "The frontend block configures the Loki query-frontend.",
		},
		{
			Name:       "query_range",
			StructType: []reflect.Type{reflect.TypeFor[queryrange.Config]()},
			Desc:       "The query_range block configures the query splitting and caching in the Loki query-frontend.",
		},
		{
			Name:       "ruler",
			StructType: []reflect.Type{reflect.TypeFor[ruler.Config]()},
			Desc:       "The ruler block configures the Loki ruler.",
		},
		{
			Name:       "ingester_client",
			StructType: []reflect.Type{reflect.TypeFor[ingester_client.Config]()},
			Desc:       "The ingester_client block configures how the distributor will connect to ingesters. Only appropriate when running all components, the distributor, or the querier.",
		},
		{
			Name:       "ingester",
			StructType: []reflect.Type{reflect.TypeFor[ingester.Config]()},
			Desc:       "The ingester block configures the ingester and how the ingester will register itself to a key value store.",
		},
		{
			Name:       "index_gateway",
			StructType: []reflect.Type{reflect.TypeFor[indexgateway.Config]()},
			Desc:       "The index_gateway block configures the Loki index gateway server, responsible for serving index queries without the need to constantly interact with the object store.",
		},
		{
			Name:       "storage_config",
			StructType: []reflect.Type{reflect.TypeFor[storage.Config]()},
			Desc:       "The storage_config block configures one of many possible stores for both the index and chunks. Which configuration to be picked should be defined in schema_config block.",
		},
		{
			Name:       "chunk_store_config",
			StructType: []reflect.Type{reflect.TypeFor[storage_config.ChunkStoreConfig]()},
			Desc:       "The chunk_store_config block configures how chunks will be cached and how long to wait before saving them to the backing store.",
		},
		{
			Name:       "schema_config",
			StructType: []reflect.Type{reflect.TypeFor[storage_config.SchemaConfig]()},
			Desc:       "Configures the chunk index schema and where it is stored.",
		},
		{
			Name:       "compactor",
			StructType: []reflect.Type{reflect.TypeFor[compactor.Config]()},
			Desc:       "The compactor block configures the compactor component, which compacts index shards for performance.",
		},
		{
			Name:       "bloom_gateway",
			StructType: []reflect.Type{reflect.TypeFor[bloomgateway.Config]()},
			Desc:       "Experimental: The bloom_gateway block configures the Loki bloom gateway server, responsible for serving queries for filtering chunks based on filter expressions.",
		},
		{
			Name:       "bloom_build",
			StructType: []reflect.Type{reflect.TypeFor[bloombuild.Config]()},
			Desc:       "Experimental: The bloom_build block configures the Loki bloom planner and builder servers, responsible for building bloom filters.",
		},
		{
			Name:       "limits_config",
			StructType: []reflect.Type{reflect.TypeFor[validation.Limits]()},
			Desc:       "The limits_config block configures global and per-tenant limits in Loki. The values here can be overridden in the `overrides` section of the runtime_config file",
		},
		{
			Name:       "frontend_worker",
			StructType: []reflect.Type{reflect.TypeFor[querier_worker.Config]()},
			Desc:       "The frontend_worker configures the worker - running within the Loki querier - picking up and executing queries enqueued by the query-frontend.",
		},
		{
			Name:       "table_manager",
			StructType: []reflect.Type{reflect.TypeFor[index.TableManagerConfig]()},
			Desc:       "The table_manager block configures the table manager for retention.",
		},

		{
			Name:       "runtime_config",
			StructType: []reflect.Type{reflect.TypeFor[runtimeconfig.Config]()},
			Desc:       "Configuration for 'runtime config' module, responsible for reloading runtime configuration file.",
		},
		{
			Name:       "operational_config",
			StructType: []reflect.Type{reflect.TypeFor[runtime.Config]()},
			Desc:       "These are values which allow you to control aspects of Loki's operation, most commonly used for controlling types of higher verbosity logging, the values here can be overridden in the `configs` section of the `runtime_config` file.",
		},
		{
			Name:       "tracing",
			StructType: []reflect.Type{reflect.TypeFor[tracing.Config]()},
			Desc:       "Configuration for tracing.",
		},
		{
			Name:       "analytics",
			StructType: []reflect.Type{reflect.TypeFor[analytics.Config]()},
			Desc:       "Configuration for analytics.",
		},
		{
			Name:       "profiling",
			StructType: []reflect.Type{reflect.TypeFor[loki.ProfilingConfig]()},
			Desc:       "Configuration for profiling options.",
		},

		{
			Name:       "common",
			StructType: []reflect.Type{reflect.TypeFor[common.Config]()},
			Desc:       "Common configuration to be shared between multiple modules. If a more specific configuration is given in other sections, the related configuration within this section will be ignored.",
		},

		{
			Name:       "consul",
			StructType: []reflect.Type{reflect.TypeFor[consul.Config]()},
			Desc:       "Configuration for a Consul client. Only applies if the selected kvstore is consul.",
		},
		{
			Name:       "etcd",
			StructType: []reflect.Type{reflect.TypeFor[etcd.Config]()},
			Desc:       "Configuration for an ETCD v3 client. Only applies if the selected kvstore is etcd.",
		},
		{
			Name:       "memberlist",
			StructType: []reflect.Type{reflect.TypeFor[memberlist.KVConfig]()},
			Desc: `Configuration for memberlist client. Only applies if the selected kvstore is memberlist.

When a memberlist config with atleast 1 join_members is defined, kvstore of type memberlist is automatically selected for all the components that require a ring unless otherwise specified in the component's configuration section.`,
		},

		{
			Name:       "grpc_client",
			StructType: []reflect.Type{reflect.TypeFor[grpcclient.Config]()},
			Desc:       "The grpc_client block configures the gRPC client used to communicate between a client and server component in Loki.",
		},

		{
			Name:       "tls_config",
			StructType: []reflect.Type{reflect.TypeFor[tls.ClientConfig]()},
			Desc:       "The TLS configuration.",
		},

		{
			Name:       "cache_config",
			StructType: []reflect.Type{reflect.TypeFor[cache.Config]()},
			Desc:       "The cache_config block configures the cache backend for a specific Loki component.",
		},

		{
			Name:       "period_config",
			StructType: []reflect.Type{reflect.TypeFor[storage_config.PeriodConfig]()},
			Desc:       "The period_config block configures what index schemas should be used for from specific time periods.",
		},

		{
			Name: "aws_storage_config",

			StructType: []reflect.Type{reflect.TypeFor[aws.StorageConfig](), reflect.TypeFor[storage.NamedAWSStorageConfig]()},
			Desc:       "The aws_storage_config block configures the connection to dynamoDB and S3 object storage. Either one of them or both can be configured.",
		},
		{
			Name:       "azure_storage_config",
			StructType: []reflect.Type{reflect.TypeFor[azure.BlobStorageConfig](), reflect.TypeFor[storage.NamedBlobStorageConfig]()},
			Desc:       "The azure_storage_config block configures the connection to Azure object storage backend.",
		},
		{
			Name:       "alibabacloud_storage_config",
			StructType: []reflect.Type{reflect.TypeFor[alibaba.OssConfig](), reflect.TypeFor[storage.NamedOssConfig]()},
			Desc:       "The alibabacloud_storage_config block configures the connection to Alibaba Cloud Storage object storage backend.",
		},
		{
			Name:       "gcs_storage_config",
			StructType: []reflect.Type{reflect.TypeFor[gcp.GCSConfig](), reflect.TypeFor[storage.NamedGCSConfig]()},
			Desc:       "The gcs_storage_config block configures the connection to Google Cloud Storage object storage backend.",
		},
		{
			Name:       "s3_storage_config",
			StructType: []reflect.Type{reflect.TypeFor[aws.S3Config]()},
			Desc:       "The s3_storage_config block configures the connection to Amazon S3 object storage backend.",
		},
		{
			Name:       "bos_storage_config",
			StructType: []reflect.Type{reflect.TypeFor[baidubce.BOSStorageConfig](), reflect.TypeFor[storage.NamedBOSStorageConfig]()},
			Desc:       "The bos_storage_config block configures the connection to Baidu Object Storage (BOS) object storage backend.",
		},
		{
			Name:       "swift_storage_config",
			StructType: []reflect.Type{reflect.TypeFor[openstack.SwiftConfig](), reflect.TypeFor[storage.NamedSwiftConfig]()},
			Desc:       "The swift_storage_config block configures the connection to OpenStack Object Storage (Swift) object storage backend.",
		},
		{
			Name:       "cos_storage_config",
			StructType: []reflect.Type{reflect.TypeFor[ibmcloud.COSConfig](), reflect.TypeFor[storage.NamedCOSConfig]()},
			Desc:       "The cos_storage_config block configures the connection to IBM Cloud Object Storage (COS) backend.",
		},
		{
			Name:       "local_storage_config",
			StructType: []reflect.Type{reflect.TypeFor[local.FSConfig](), reflect.TypeFor[storage.NamedFSConfig]()},
			Desc:       "The local_storage_config block configures the usage of local file system as object storage backend.",
		},
		{
			Name:       "named_stores_config",
			StructType: []reflect.Type{reflect.TypeFor[storage.NamedStores]()},
			Desc: `Configures additional object stores for a given storage provider.
Supported stores: aws, azure, bos, filesystem, gcs, swift.
Example:
` + "```yaml" + `
    storage_config:
      named_stores:
        aws:
          store-1:
            endpoint: s3://foo-bucket
            region: us-west1
` + "```" + `
Named store from this example can be used by setting object_store to store-1 in period_config.`,
		},
		{
			Name:       "attributes_config",
			StructType: []reflect.Type{reflect.TypeFor[push.AttributesConfig]()},
			Desc:       "Define actions for matching OpenTelemetry (OTEL) attributes.",
		},
		{
			Name:       "thanos_object_store_config",
			StructType: []reflect.Type{reflect.TypeFor[bucket.Config]()},
			Desc: `The thanos_object_store_config block configures the connection to object storage backend using thanos-io/objstore clients. This will become the default way of configuring object store clients in future releases.
Currently this is opt-in and takes effect only when ` + "`-use-thanos-objstore` " + "is set to true.",
		},
	}
)

Functions

func FindFlagsPrefix

func FindFlagsPrefix(flags []string) []string

func Flags

func Flags(cfg flagext.Registerer) map[uintptr]*flag.Flag

Types

type ConfigBlock

type ConfigBlock struct {
	Name          string
	Desc          string
	Entries       []*ConfigEntry
	FlagsPrefix   string
	FlagsPrefixes []string
}

func Config

func Config(cfg interface{}, flags map[uintptr]*flag.Flag, rootBlocks []RootBlock) ([]*ConfigBlock, error)

Config returns a slice of ConfigBlocks. The first ConfigBlock is a recursively expanded cfg. The remaining entries in the slice are all (root or not) ConfigBlocks.

func (*ConfigBlock) Add

func (b *ConfigBlock) Add(entry *ConfigEntry)

type ConfigEntry

type ConfigEntry struct {
	Kind     EntryKind
	Name     string
	Required bool

	// In case the Kind is KindBlock
	Block     *ConfigBlock
	BlockDesc string
	Root      bool
	Inline    bool

	// In case the Kind is KindField
	FieldFlag    string
	FieldDesc    string
	FieldType    string
	FieldDefault string
	FieldExample *FieldExample

	// In case the Kind is KindMap or KindSlice
	Element *ConfigBlock
}

func (ConfigEntry) Description

func (e ConfigEntry) Description() string

type EntryKind

type EntryKind string
const (
	KindBlock EntryKind = "block"
	KindField EntryKind = "field"
	KindSlice EntryKind = "slice"
	KindMap   EntryKind = "map"
)

type ExamplerConfig

type ExamplerConfig interface {
	ExampleDoc() (comment string, yaml interface{})
}

ExamplerConfig can be implemented by configs to provide examples. If string is non-empty, it will be added as comment. If yaml value is non-empty, it will be marshaled as yaml under the same key as it would appear in config.

type FieldExample

type FieldExample struct {
	Comment string
	Yaml    interface{}
}

type RootBlock

type RootBlock struct {
	Name string
	Desc string
	// multiple entries are useful if the root blocks share the same
	// underlying type
	StructType []reflect.Type
}

Jump to

Keyboard shortcuts

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