config

package
v0.0.0-...-e951c9a Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2022 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StorageTypeAWS            = "aws"
	StorageTypeAWSDynamo      = "aws-dynamo"
	StorageTypeAzure          = "azure"
	StorageTypeBOS            = "bos"
	StorageTypeBoltDB         = "boltdb"
	StorageTypeCassandra      = "cassandra"
	StorageTypeInMemory       = "inmemory"
	StorageTypeBigTable       = "bigtable"
	StorageTypeBigTableHashed = "bigtable-hashed"
	StorageTypeFileSystem     = "filesystem"
	StorageTypeGCP            = "gcp"
	StorageTypeGCPColumnKey   = "gcp-columnkey"
	StorageTypeGCS            = "gcs"
	StorageTypeGrpc           = "grpc-store"
	StorageTypeLocal          = "local"
	StorageTypeS3             = "s3"
	StorageTypeSwift          = "swift"
	// BoltDBShipperType holds the index type for using boltdb with shipper which keeps flushing them to a shared storage
	BoltDBShipperType = "boltdb-shipper"
	TSDBType          = "tsdb"

	// ObjectStorageIndexRequiredPeriod defines the required index period for object storage based index stores like boltdb-shipper and tsdb
	ObjectStorageIndexRequiredPeriod = 24 * time.Hour
)

Variables

This section is empty.

Functions

func ActivePeriodConfig

func ActivePeriodConfig(configs []PeriodConfig) int

ActivePeriodConfig returns index of active PeriodicConfig which would be applicable to logs that would be pushed starting now. Note: Another PeriodicConfig might be applicable for future logs which can change index type.

func UsingObjectStorageIndex

func UsingObjectStorageIndex(configs []PeriodConfig) bool

Types

type ActiveTableProvisionConfig

type ActiveTableProvisionConfig struct {
	ProvisionedThroughputOnDemandMode bool  `yaml:"enable_ondemand_throughput_mode"`
	ProvisionedWriteThroughput        int64 `yaml:"provisioned_write_throughput"`
	ProvisionedReadThroughput         int64 `yaml:"provisioned_read_throughput"`

	WriteScale AutoScalingConfig `yaml:"write_scale"`
	ReadScale  AutoScalingConfig `yaml:"read_scale"`
}

func (ActiveTableProvisionConfig) BuildTableDesc

func (cfg ActiveTableProvisionConfig) BuildTableDesc(tableName string, tags Tags) TableDesc

func (*ActiveTableProvisionConfig) RegisterFlags

func (cfg *ActiveTableProvisionConfig) RegisterFlags(argPrefix string, f *flag.FlagSet)

RegisterFlags adds the flags required to config this to the given FlagSet. Make sure defaults are set in the respective fields before calling RegisterFlags.

type AutoScalingConfig

type AutoScalingConfig struct {
	Enabled     bool    `yaml:"enabled"`
	RoleARN     string  `yaml:"role_arn"`
	MinCapacity int64   `yaml:"min_capacity"`
	MaxCapacity int64   `yaml:"max_capacity"`
	OutCooldown int64   `yaml:"out_cooldown"`
	InCooldown  int64   `yaml:"in_cooldown"`
	TargetValue float64 `yaml:"target"`
}

AutoScalingConfig for DynamoDB tables.

func (*AutoScalingConfig) RegisterFlags

func (cfg *AutoScalingConfig) RegisterFlags(argPrefix string, f *flag.FlagSet)

RegisterFlags adds the flags required to config this to the given FlagSet.

type ChunkStoreConfig

type ChunkStoreConfig struct {
	ChunkCacheConfig       cache.Config `yaml:"chunk_cache_config"`
	WriteDedupeCacheConfig cache.Config `yaml:"write_dedupe_cache_config"`

	CacheLookupsOlderThan model.Duration `yaml:"cache_lookups_older_than"`

	// When DisableIndexDeduplication is true and chunk is already there in cache, only index would be written to the store and not chunk.
	DisableIndexDeduplication bool `yaml:"-"`

	// Limits query start time to be greater than now() - MaxLookBackPeriod, if set.
	// Will be deprecated in the next major release.
	MaxLookBackPeriod model.Duration `yaml:"max_look_back_period"`
	// contains filtered or unexported fields
}

func (*ChunkStoreConfig) ChunkCacheStubs

func (cfg *ChunkStoreConfig) ChunkCacheStubs() bool

func (*ChunkStoreConfig) RegisterFlags

func (cfg *ChunkStoreConfig) RegisterFlags(f *flag.FlagSet)

RegisterFlags adds the flags required to configure this flag set.

func (*ChunkStoreConfig) Validate

func (cfg *ChunkStoreConfig) Validate(logger log.Logger) error

type DayTime

type DayTime struct {
	model.Time
}

DayTime is a model.Time what holds day-aligned values, and marshals to/from YAML in YYYY-MM-DD format.

func (DayTime) MarshalYAML

func (d DayTime) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaller.

func (*DayTime) String

func (d *DayTime) String() string

func (*DayTime) UnmarshalYAML

func (d *DayTime) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml.Unmarshaller.

type InactiveTableProvisionConfig

type InactiveTableProvisionConfig struct {
	InactiveThroughputOnDemandMode bool  `yaml:"enable_inactive_throughput_on_demand_mode"`
	InactiveWriteThroughput        int64 `yaml:"inactive_write_throughput"`
	InactiveReadThroughput         int64 `yaml:"inactive_read_throughput"`

	InactiveWriteScale AutoScalingConfig `yaml:"inactive_write_scale"`
	InactiveReadScale  AutoScalingConfig `yaml:"inactive_read_scale"`

	InactiveWriteScaleLastN int64 `yaml:"inactive_write_scale_lastn"`
	InactiveReadScaleLastN  int64 `yaml:"inactive_read_scale_lastn"`
}

func (InactiveTableProvisionConfig) BuildTableDesc

func (cfg InactiveTableProvisionConfig) BuildTableDesc(tableName string, tags Tags, disableAutoscale bool) TableDesc

func (*InactiveTableProvisionConfig) RegisterFlags

func (cfg *InactiveTableProvisionConfig) RegisterFlags(argPrefix string, f *flag.FlagSet)

RegisterFlags adds the flags required to config this to the given FlagSet.

type PeriodConfig

type PeriodConfig struct {
	From        DayTime             `yaml:"from"`         // used when working with config
	IndexType   string              `yaml:"store"`        // type of index client to use.
	ObjectType  string              `yaml:"object_store"` // type of object client to use; if omitted, defaults to store.
	Schema      string              `yaml:"schema"`
	IndexTables PeriodicTableConfig `yaml:"index"`
	ChunkTables PeriodicTableConfig `yaml:"chunks"`
	RowShards   uint32              `yaml:"row_shards"`
	// contains filtered or unexported fields
}

PeriodConfig defines the schema and tables to use for a period of time

func (*PeriodConfig) GetIndexTableNumberRange

func (cfg *PeriodConfig) GetIndexTableNumberRange(schemaEndDate DayTime) TableRange

GetIndexTableNumberRange returns the table number range calculated based on the configured schema start date, index table period and the given schemaEndDate

func (*PeriodConfig) UnmarshalYAML

func (cfg *PeriodConfig) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml.Unmarshaller.

func (*PeriodConfig) VersionAsInt

func (cfg *PeriodConfig) VersionAsInt() (int, error)

type PeriodicTableConfig

type PeriodicTableConfig struct {
	Prefix string
	Period time.Duration
	Tags   Tags
}

PeriodicTableConfig is configuration for a set of time-sharded tables.

func (PeriodicTableConfig) MarshalYAML

func (cfg PeriodicTableConfig) MarshalYAML() (interface{}, error)

MarshalYAML implements the yaml.Marshaler interface.

func (*PeriodicTableConfig) PeriodicTables

func (cfg *PeriodicTableConfig) PeriodicTables(from, through model.Time, pCfg ProvisionConfig, beginGrace, endGrace time.Duration, retention time.Duration) []TableDesc

func (*PeriodicTableConfig) TableFor

func (cfg *PeriodicTableConfig) TableFor(t model.Time) string

TableFor calculates the table shard for a given point in time.

func (*PeriodicTableConfig) UnmarshalYAML

func (cfg *PeriodicTableConfig) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements the yaml.Unmarshaler interface.

type ProvisionConfig

type ProvisionConfig struct {
	ActiveTableProvisionConfig   `yaml:",inline"`
	InactiveTableProvisionConfig `yaml:",inline"`
}

ProvisionConfig holds config for provisioning capacity for index and chunk tables (on DynamoDB for now)

func (*ProvisionConfig) RegisterFlags

func (cfg *ProvisionConfig) RegisterFlags(argPrefix string, f *flag.FlagSet)

RegisterFlags adds the flags required to config this to the given FlagSet.

type SchemaConfig

type SchemaConfig struct {
	Configs []PeriodConfig `yaml:"configs"`
	// contains filtered or unexported fields
}

SchemaConfig contains the config for our chunk index schemas

func (SchemaConfig) ChunkTableFor

func (cfg SchemaConfig) ChunkTableFor(t model.Time) (string, error)

ChunkTableFor calculates the chunk table shard for a given point in time.

func (SchemaConfig) ExternalKey

func (cfg SchemaConfig) ExternalKey(ref logproto.ChunkRef) string

Generate the appropriate external key based on cfg.Schema, chunk.Checksum, and chunk.From

func (*SchemaConfig) ForEachAfter

func (cfg *SchemaConfig) ForEachAfter(t model.Time, f func(config *PeriodConfig))

ForEachAfter will call f() on every entry after t, splitting entries if necessary so there is an entry starting at t

func (*SchemaConfig) Load

func (cfg *SchemaConfig) Load() error

Load the yaml file, or build the config from legacy command-line flags

func (*SchemaConfig) RegisterFlags

func (cfg *SchemaConfig) RegisterFlags(f *flag.FlagSet)

RegisterFlags adds the flags required to config this to the given FlagSet.

func (SchemaConfig) SchemaForTime

func (cfg SchemaConfig) SchemaForTime(t model.Time) (PeriodConfig, error)

SchemaForTime returns the Schema PeriodConfig to use for a given point in time.

func (*SchemaConfig) Validate

func (cfg *SchemaConfig) Validate() error

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

func (SchemaConfig) VersionForChunk

func (cfg SchemaConfig) VersionForChunk(ref logproto.ChunkRef) int

VersionForChunk will return the schema version associated with the `From` timestamp of a chunk. The schema and chunk must be valid+compatible as the errors are not checked.

type TableDesc

type TableDesc struct {
	Name              string
	UseOnDemandIOMode bool
	ProvisionedRead   int64
	ProvisionedWrite  int64
	Tags              Tags
	WriteScale        AutoScalingConfig
	ReadScale         AutoScalingConfig
}

TableDesc describes a table.

func (TableDesc) Equals

func (desc TableDesc) Equals(other TableDesc) bool

Equals returns true if other matches desc.

type TableRange

type TableRange struct {
	Start, End   int64
	PeriodConfig *PeriodConfig
}

TableRange represents a range of table numbers built based on the configured schema start/end date and the table period. Both Start and End are inclusive.

type TableRanges

type TableRanges []TableRange

TableRanges represents a list of table ranges for multiple schemas.

func (TableRanges) ConfigForTableNumber

func (t TableRanges) ConfigForTableNumber(tableNumber int64) *PeriodConfig

func (TableRanges) TableInRange

func (t TableRanges) TableInRange(tableNumber int64, tableName string) bool

TableInRange tells whether given table falls in any of the ranges and the tableName has the right prefix based on the schema config.

type Tags

type Tags map[string]string

Tags is a string-string map that implements flag.Value.

func (Tags) Equals

func (ts Tags) Equals(other Tags) bool

Equals returns true is other matches ts.

func (*Tags) Set

func (ts *Tags) Set(s string) error

Set implements flag.Value

func (Tags) String

func (ts Tags) String() string

String implements flag.Value

func (*Tags) UnmarshalYAML

func (ts *Tags) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml.Unmarshaler.

Jump to

Keyboard shortcuts

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