From d1560eb66582d35297e1c02f1bddf26b6c94dd7b Mon Sep 17 00:00:00 2001 From: Kushal Shukla Date: Sat, 23 Nov 2024 00:33:45 +0530 Subject: [PATCH] 1. Replaced "key" Keyword with "bucket" Keyword. 2. Replaced images to prominfra docker registery. Signed-off-by: Kushal Shukla --- .../prombench/benchmark/6_loadgen.yaml | 4 +-- tools/load-generator/main.go | 30 +++++++++---------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/prombench/manifests/prombench/benchmark/6_loadgen.yaml b/prombench/manifests/prombench/benchmark/6_loadgen.yaml index 2a51af75d..c031b55a8 100644 --- a/prombench/manifests/prombench/benchmark/6_loadgen.yaml +++ b/prombench/manifests/prombench/benchmark/6_loadgen.yaml @@ -127,7 +127,7 @@ spec: spec: initContainers: - name: download-key - image: kushalshukla/builder + image: docker.io/prominfra/prometheus-builder:master imagePullPolicy: Always command: [ "/go/src/github.com/key.sh" ] env: @@ -144,7 +144,7 @@ spec: mountPath: /storage-paths containers: - name: prom-load-generator - image: kushalshukla/load-generator + image: docker.io/prominfra/load-generator:master imagePullPolicy: Always args: - "prombench-{{ .PR_NUMBER }}" diff --git a/tools/load-generator/main.go b/tools/load-generator/main.go index b021f9312..823790a69 100644 --- a/tools/load-generator/main.go +++ b/tools/load-generator/main.go @@ -92,14 +92,14 @@ type QueryGroup struct { Step string `yaml:"step,omitempty"` } -type KeyConfig struct { - Key string `yaml:"key"` +type BucketConfig struct { + Path string `yaml:"path"` MinTime int64 `yaml:"minTime"` MaxTime int64 `yaml:"maxTime"` } type configState struct { - keyConfig *KeyConfig + bucketConfig *BucketConfig Err error absoluteTime int64 } @@ -132,9 +132,9 @@ func NewQuerier(groupID int, target, prNumber string, qg QueryGroup) *Querier { } } -// Function to load `minTime` and `maxTime` from key.yml -func loadKeyConfig() (*KeyConfig, error) { - filePath := "/config/key.yml" +// Function to load `minTime` and `maxTime` from bucket-config.yml +func loadKeyConfig() (*BucketConfig, error) { + filePath := "/config/bucket-config.yml" _, err := os.Stat(filePath) if os.IsNotExist(err) { return nil, fmt.Errorf("file not found: %s", filePath) @@ -145,22 +145,22 @@ func loadKeyConfig() (*KeyConfig, error) { return nil, fmt.Errorf("error reading file: %w", err) } - var keyConfig KeyConfig - err = yaml.Unmarshal(data, &keyConfig) + var bucketConfig BucketConfig + err = yaml.Unmarshal(data, &bucketConfig) if err != nil { return nil, fmt.Errorf("error parsing YAML: %w", err) } - return &keyConfig, nil + return &bucketConfig, nil } -func configstate(v *KeyConfig, err error) *configState { +func configstate(v *BucketConfig, err error) *configState { var absolutetime int64 if v != nil { absolutetime = v.MaxTime } return &configState{ - keyConfig: v, + bucketConfig: v, Err: err, absoluteTime: absolutetime, } @@ -213,7 +213,7 @@ func (q *Querier) query(expr string, timeMode string, timeBound *configState) { qParams.Set("end", fmt.Sprintf("%d", int64(time.Now().Add(-q.end).Unix()))) qParams.Set("step", q.step) } else { - endTime := time.Unix(0, timeBound.keyConfig.MaxTime*int64(time.Millisecond)) + endTime := time.Unix(0, timeBound.bucketConfig.MaxTime*int64(time.Millisecond)) qParams.Set("start", fmt.Sprintf("%d", int64(endTime.Add(-q.start).Unix()))) qParams.Set("end", fmt.Sprintf("%d", int64(endTime.Add(-q.end).Unix()))) qParams.Set("step", q.step) @@ -286,11 +286,11 @@ func main() { var wg sync.WaitGroup - keyConfig, err := loadKeyConfig() + bucketConfig, err := loadKeyConfig() if err != nil { - fmt.Printf("key.yml file is not present: %v\n", err) + fmt.Printf("bucket-config.yml file is not present: %v\n", err) } - timeBound := configstate(keyConfig, err) + timeBound := configstate(bucketConfig, err) for i, group := range config.Querier.Groups { wg.Add(1)