Skip to content

Commit

Permalink
docs(thanos): unhide configuration docs for thanos storage clients (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ashwanthgoli authored Feb 3, 2025
1 parent f524dfd commit 1cd95f5
Show file tree
Hide file tree
Showing 8 changed files with 617 additions and 644 deletions.
1,207 changes: 581 additions & 626 deletions docs/sources/shared/configuration.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pkg/loki/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ type Storage struct {
Hedging hedging.Config `yaml:"hedging"`
COS ibmcloud.COSConfig `yaml:"cos"`
CongestionControl congestion.Config `yaml:"congestion_control,omitempty"`
ObjectStore bucket.Config `yaml:"object_store" doc:"hidden"`
ObjectStore bucket.Config `yaml:"object_store"`
}

func (s *Storage) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/loki/loki.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ type Config struct {
Frontend lokifrontend.Config `yaml:"frontend,omitempty"`
QueryRange queryrange.Config `yaml:"query_range,omitempty"`
Ruler ruler.Config `yaml:"ruler,omitempty"`
RulerStorage rulestore.Config `yaml:"ruler_storage,omitempty" doc:"hidden"`
RulerStorage rulestore.Config `yaml:"ruler_storage,omitempty"`
IngesterClient ingester_client.Config `yaml:"ingester_client,omitempty"`
Ingester ingester.Config `yaml:"ingester,omitempty"`
BlockBuilder blockbuilder.Config `yaml:"block_builder,omitempty"`
Expand Down
4 changes: 3 additions & 1 deletion pkg/ruler/rulestore/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ package rulestore

import (
"flag"
"fmt"
"reflect"
"strings"

"github.com/grafana/dskit/flagext"

Expand All @@ -23,7 +25,7 @@ func (cfg *Config) RegisterFlags(f *flag.FlagSet) {

cfg.ExtraBackends = []string{local.Name}
cfg.Local.RegisterFlagsWithPrefix(prefix, f)
f.StringVar(&cfg.Backend, prefix+"backend", "filesystem", "Backend storage to use. Supported backends are: s3, gcs, azure, swift, filesystem.")
f.StringVar(&cfg.Backend, prefix+"backend", "filesystem", fmt.Sprintf("Backend storage to use. Supported backends are: local, %s", strings.Join(bucket.SupportedBackends, ", ")))
cfg.RegisterFlagsWithPrefix(prefix, f)
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/storage/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,8 @@ type Config struct {
DisableBroadIndexQueries bool `yaml:"disable_broad_index_queries"`
MaxParallelGetChunk int `yaml:"max_parallel_get_chunk"`

UseThanosObjstore bool `yaml:"use_thanos_objstore" doc:"hidden"`
ObjectStore bucket.ConfigWithNamedStores `yaml:"object_store" doc:"hidden"`
UseThanosObjstore bool `yaml:"use_thanos_objstore"`
ObjectStore bucket.ConfigWithNamedStores `yaml:"object_store"`

MaxChunkBatchSize int `yaml:"max_chunk_batch_size"`
BoltDBShipperConfig boltdb.IndexCfg `yaml:"boltdb_shipper" doc:"description=Configures storing index in an Object Store (GCS/S3/Azure/Swift/COS/Filesystem) in the form of boltdb files. Required fields only required when boltdb-shipper is defined in config."`
Expand Down
21 changes: 20 additions & 1 deletion tools/doc-generator/parse/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ type ConfigEntry struct {
Block *ConfigBlock
BlockDesc string
Root bool
Inline bool

// In case the Kind is KindField
FieldFlag string
Expand Down Expand Up @@ -228,7 +229,25 @@ func config(block *ConfigBlock, cfg interface{}, flags map[uintptr]*flag.Flag, r
blocks = append(blocks, subBlock)
}
} else {
subBlock = block
// For inline fields, we still want to add them to the root blocks list
if isRoot {
subBlock = &ConfigBlock{
Name: rootName,
Desc: getFieldDescription(cfg, field, rootDesc),
}
blocks = append(blocks, subBlock)

// Add a field entry that references the root block
block.Add(&ConfigEntry{
Kind: KindBlock,
Block: subBlock,
BlockDesc: subBlock.Desc,
Root: true,
Inline: true,
})
} else {
subBlock = block
}
}

if field.Type.Kind() == reflect.Ptr {
Expand Down
15 changes: 4 additions & 11 deletions tools/doc-generator/parse/root_blocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,10 @@ import (
"github.com/grafana/loki/v3/pkg/querier/queryrange"
querier_worker "github.com/grafana/loki/v3/pkg/querier/worker"
"github.com/grafana/loki/v3/pkg/ruler"
"github.com/grafana/loki/v3/pkg/ruler/rulestore"
"github.com/grafana/loki/v3/pkg/runtime"
"github.com/grafana/loki/v3/pkg/scheduler"
"github.com/grafana/loki/v3/pkg/storage"
"github.com/grafana/loki/v3/pkg/storage/bucket/gcs"
"github.com/grafana/loki/v3/pkg/storage/bucket"
"github.com/grafana/loki/v3/pkg/storage/chunk/cache"
"github.com/grafana/loki/v3/pkg/storage/chunk/client/alibaba"
"github.com/grafana/loki/v3/pkg/storage/chunk/client/aws"
Expand Down Expand Up @@ -298,15 +297,9 @@ Named store from this example can be used by setting object_store to store-1 in
Desc: "Define actions for matching OpenTelemetry (OTEL) attributes.",
},
{
Name: "gcs_storage_backend",
StructType: []reflect.Type{reflect.TypeOf(gcs.Config{})},
Desc: "The gcs_storage_backend block configures the connection to Google Cloud Storage object storage backend.",
},
{
Name: "ruler_storage_config",
StructType: []reflect.Type{reflect.TypeOf(rulestore.Config{})},
Desc: `The ruler_storage_config configures ruler storage backend.
It uses thanos-io/objstore clients for connecting to object storage backends. This will become the default way of configuring object store clients in future releases.
Name: "thanos_object_store_config",
StructType: []reflect.Type{reflect.TypeOf(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.",
},
}
Expand Down
6 changes: 5 additions & 1 deletion tools/doc-generator/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@ func (w *specWriter) writeConfigEntry(e *parse.ConfigEntry, indent int) (written
}

// Block reference without entries, because it's a root block
w.out.WriteString(pad(indent) + "[" + e.Name + ": <" + e.Block.Name + ">]\n")
if e.Inline {
w.out.WriteString(pad(indent) + "[<" + e.Block.Name + ">]\n")
} else {
w.out.WriteString(pad(indent) + "[" + e.Name + ": <" + e.Block.Name + ">]\n")
}
} else {
// Description
w.writeComment(e.BlockDesc, indent, 0)
Expand Down

0 comments on commit 1cd95f5

Please sign in to comment.