Skip to content

Commit

Permalink
1. Replaced "key" Keyword with "bucket" Keyword.
Browse files Browse the repository at this point in the history
2. Replaced images to prominfra docker registery.
Signed-off-by: Kushal Shukla <[email protected]>
  • Loading branch information
kushalShukla-web committed Nov 22, 2024
1 parent 7eaa555 commit d1560eb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions prombench/manifests/prombench/benchmark/6_loadgen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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 }}"
Expand Down
30 changes: 15 additions & 15 deletions tools/load-generator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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)
Expand All @@ -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,
}
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit d1560eb

Please sign in to comment.