Skip to content

Commit 6a56c11

Browse files
Modified Loadgenerator to get bucketconfig file from ConfigMap.
Signed-off-by: Kushal Shukla <[email protected]>
1 parent 8b752ef commit 6a56c11

File tree

2 files changed

+9
-20
lines changed

2 files changed

+9
-20
lines changed

prombench/manifests/prombench/benchmark/6_loadgen.yaml

+4-19
Original file line numberDiff line numberDiff line change
@@ -126,22 +126,6 @@ spec:
126126
app: loadgen-querier
127127
spec:
128128
initContainers:
129-
- name: download-key
130-
image: docker.io/prominfra/prometheus-builder:master
131-
imagePullPolicy: Always
132-
command: [ "/go/src/github.com/key.sh" ]
133-
env:
134-
- name: PR_NUMBER
135-
value: "{{ .PR_NUMBER }}"
136-
- name: GITHUB_ORG
137-
value: "{{ .GITHUB_ORG }}"
138-
- name: GITHUB_REPO
139-
value: "{{ .GITHUB_REPO }}"
140-
- name: STORAGE
141-
value: "/storage-paths"
142-
volumeMounts:
143-
- name: key
144-
mountPath: /storage-paths
145129
containers:
146130
- name: prom-load-generator
147131
image: docker.io/prominfra/load-generator:master
@@ -155,7 +139,7 @@ spec:
155139
volumeMounts:
156140
- name: config-volume
157141
mountPath: /etc/loadgen
158-
- name: key
142+
- name: blocksync-location-key
159143
mountPath: /config
160144
ports:
161145
- name: loadgen-port
@@ -164,8 +148,9 @@ spec:
164148
- name: config-volume
165149
configMap:
166150
name: prometheus-loadgen
167-
- name: key
168-
emptyDir: {}
151+
- name: blocksync-location-key
152+
configMap:
153+
name: blocksync-config
169154
nodeSelector:
170155
node-name: nodes-{{ .PR_NUMBER }}
171156
isolation: none

tools/load-generator/main.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ func (q *Querier) run(wg *sync.WaitGroup, timeBound *bucketState) {
175175
// If timeBound is not nil, both the "absolute" and "current" blocks will run;
176176
// otherwise, only the "current" block will execute. This execution pattern is used
177177
// because if Downloaded block data is present, both the head block and downloaded block
178-
// need to be processed.
178+
// need to be processed consecutively.
179179
runBlockMode := "current"
180180
for _, query := range q.queries {
181181
if runBlockMode == "current" {
@@ -211,20 +211,24 @@ func (q *Querier) query(expr string, timeMode string, timeBound *bucketState) {
211211
qParams := req.URL.Query()
212212
qParams.Set("query", expr)
213213
if q.qtype == "range" {
214+
// here query is for current block i.e headblock and its range query.
214215
if timeMode == "current" {
215216
qParams.Set("start", fmt.Sprintf("%d", int64(time.Now().Add(-q.start).Unix())))
216217
qParams.Set("end", fmt.Sprintf("%d", int64(time.Now().Add(-q.end).Unix())))
217218
qParams.Set("step", q.step)
218219
} else {
220+
// here query is for downloaded block and its range query.
219221
endTime := time.Unix(0, timeBound.bucketConfig.MaxTime*int64(time.Millisecond))
220222
qParams.Set("start", fmt.Sprintf("%d", int64(endTime.Add(-q.start).Unix())))
221223
qParams.Set("end", fmt.Sprintf("%d", int64(endTime.Add(-q.end).Unix())))
222224
qParams.Set("step", q.step)
223225
}
224226
} else if timeMode == "absolute" {
227+
// here query is for downloaded block and its instant query.
225228
blockinstime := time.Unix(0, timeBound.bucketConfig.MaxTime*int64(time.Millisecond))
226229
qParams.Set("time", fmt.Sprintf("%d", int64(blockinstime.Unix())))
227230
}
231+
// here query is for current block and its instant query i.e no need to specify the instant time.
228232
req.URL.RawQuery = qParams.Encode()
229233

230234
resp, err := http.DefaultClient.Do(req)

0 commit comments

Comments
 (0)