File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -151,11 +151,17 @@ init_ingest_data() {
151
151
152
152
# Static arrays
153
153
METHODS=(" GET" " POST" " PUT" " DELETE" " PATCH" " HEAD" )
154
+ METHODS_LEN=${# METHODS[@]}
154
155
STATUS_CODES=(200 400 401 500 503)
156
+ STATUS_CODES_LEN=${# STATUS_CODES[@]}
155
157
SERVICES=(" frontend" " api" " auth" " cart" " payment" )
158
+ SERVICES_LEN=${# SERVICES[@]}
156
159
ENDPOINTS=(" /products" " /cart" " /login" " /checkout" " /search" )
160
+ ENDPOINTS_LEN=${# ENDPOINTS[@]}
157
161
USER_AGENTS=(" curl/7.88.1" " python-requests/2.32.3" " Mozilla/5.0" )
162
+ USER_AGENTS_LEN=${# USER_AGENTS[@]}
158
163
CLUSTERS=(" web" " api" " db" )
164
+ CLUSTERS_LEN=${# CLUSTERS[@]}
159
165
}
160
166
161
167
# Generate batch data
@@ -175,12 +181,12 @@ generate_batch() {
175
181
for (( i= 0 ; i< batch_size; i++ )) ; do
176
182
# Use modulo for cycling through pre-computed arrays
177
183
idx=$(( i % 100 ))
178
- method_idx=$(( i % 6 ))
179
- status_idx=$(( i % 5 ))
180
- service_idx=$(( i % 5 ))
181
- endpoint_idx=$(( i % 5 ))
182
- agent_idx=$(( i % 3 ))
183
- cluster_idx=$(( i % 3 ))
184
+ method_idx=$(( i % METHODS_LEN ))
185
+ status_idx=$(( i % STATUS_CODES_LEN ))
186
+ service_idx=$(( i % SERVICES_LEN ))
187
+ endpoint_idx=$(( i % ENDPOINTS_LEN ))
188
+ agent_idx=$(( i % USER_AGENTS_LEN ))
189
+ cluster_idx=$(( i % CLUSTERS_LEN ))
184
190
185
191
# Direct array access
186
192
trace_id=${TRACE_IDS[$idx]}
You can’t perform that action at this time.
0 commit comments