mirror of
https://github.com/hanzoai/traces.git
synced 2026-10-30 18:20:41 +00:00
* Implement GCS delete retry when marking a block compacted * Include retry in additional delete for ClearBlock * Include max retries configuration for GCS compactor/retention operations * Update config manifest * Play golf using atomic.Int32 instead of an int32
38 lines
1.6 KiB
Go
38 lines
1.6 KiB
Go
package gcs
|
|
|
|
import (
|
|
"flag"
|
|
"time"
|
|
|
|
"github.com/grafana/tempo/pkg/util"
|
|
)
|
|
|
|
type Config struct {
|
|
BucketName string `yaml:"bucket_name"`
|
|
Prefix string `yaml:"prefix"`
|
|
ChunkBufferSize int `yaml:"chunk_buffer_size"`
|
|
Endpoint string `yaml:"endpoint"`
|
|
HedgeRequestsAt time.Duration `yaml:"hedge_requests_at"`
|
|
HedgeRequestsUpTo int `yaml:"hedge_requests_up_to"`
|
|
Insecure bool `yaml:"insecure"`
|
|
ObjectCacheControl string `yaml:"object_cache_control"`
|
|
ObjectMetadata map[string]string `yaml:"object_metadata"`
|
|
ListBlocksConcurrency int `yaml:"list_blocks_concurrency"`
|
|
MaxRetries int `yaml:"max_retries"`
|
|
}
|
|
|
|
func (cfg *Config) RegisterFlagsAndApplyDefaults(prefix string, f *flag.FlagSet) {
|
|
f.StringVar(&cfg.BucketName, util.PrefixConfig(prefix, "gcs.bucket"), "", "gcs bucket to store traces in.")
|
|
f.StringVar(&cfg.Prefix, util.PrefixConfig(prefix, "gcs.prefix"), "", "gcs bucket prefix to store traces in.")
|
|
f.IntVar(&cfg.ListBlocksConcurrency, util.PrefixConfig(prefix, "gcs.list_blocks_concurrency"), 3, "number of concurrent list calls to make to backend")
|
|
f.IntVar(&cfg.MaxRetries, util.PrefixConfig(prefix, "gcs.max_retries"), 3, "number of times to retry failed compaction/retention operations")
|
|
|
|
cfg.ChunkBufferSize = 10 * 1024 * 1024
|
|
cfg.HedgeRequestsUpTo = 2
|
|
}
|
|
|
|
func (cfg *Config) PathMatches(other *Config) bool {
|
|
// GCS bucket names are globally unique
|
|
return cfg.BucketName == other.BucketName && cfg.Prefix == other.Prefix
|
|
}
|