@@ -19,8 +19,8 @@ curl_with_retry() {
19
19
local data=" $3 "
20
20
local content_type=" ${4:- application/ json} "
21
21
local max_retries=" ${5:- 3} "
22
+ local data_file=" $6 "
22
23
local retry_count=0
23
- local data_file=" $7 "
24
24
25
25
# Create temp file if data is provided (either as string or file)
26
26
if [[ -n " $data_file " ]]; then
@@ -214,7 +214,7 @@ send_batch() {
214
214
return 1
215
215
fi
216
216
217
- curl_with_retry " $P_URL /api/v1/ingest" " POST" " $data " " application/json" 3 15
217
+ curl_with_retry " $P_URL /api/v1/ingest" " POST" " $data " " application/json" 3
218
218
}
219
219
220
220
# Main ingest function
@@ -291,7 +291,7 @@ create_sql_filters() {
291
291
292
292
json=" {\" stream_name\" :\" sql\" ,\" filter_name\" :\" $name \" ,\" filter_description\" :\" $escaped_desc \" ,\" query\" :{\" filter_type\" :\" sql\" ,\" filter_query\" :\" $escaped_query \" },\" time_filter\" :null}"
293
293
294
- if curl_with_retry " $P_URL /api/v1/filters" " POST" " $json " " application/json" 3 10 ; then
294
+ if curl_with_retry " $P_URL /api/v1/filters" " POST" " $json " " application/json" 3; then
295
295
sql_success_count=$(( sql_success_count + 1 ))
296
296
echo " Created SQL filter: $name "
297
297
else
@@ -341,7 +341,7 @@ create_saved_filters() {
341
341
342
342
json=" {\" stream_name\" :\" $P_STREAM \" ,\" filter_name\" :\" $name \" ,\" filter_description\" :\" $escaped_desc \" ,\" query\" :{\" filter_type\" :\" filter\" ,\" filter_query\" :\" $escaped_query \" },\" time_filter\" :null,\" tableConfig\" :{\" visibleColumns\" :[$visible_cols_json ],\" pinnedColumns\" :[]},\" groupBy\" :\" $group_by \" }"
343
343
344
- if curl_with_retry " $P_URL /api/v1/filters" " POST" " $json " " application/json" 3 10 ; then
344
+ if curl_with_retry " $P_URL /api/v1/filters" " POST" " $json " " application/json" 3; then
345
345
saved_success_count=$(( saved_success_count + 1 ))
346
346
echo " Created saved filter: $name "
347
347
else
@@ -409,7 +409,7 @@ create_alerts() {
409
409
# Alert 1: Error Count (severity_number = 18)
410
410
alert1_json=" {\" severity\" :\" high\" ,\" title\" :\" error count\" ,\" stream\" :\" $P_STREAM \" ,\" alertType\" :\" threshold\" ,\" aggregates\" :{\" aggregateConfig\" :[{\" aggregateFunction\" :\" count\" ,\" conditions\" :{\" operator\" :null,\" conditionConfig\" :[{\" column\" :\" severity_number\" ,\" operator\" :\" =\" ,\" value\" :\" 18\" }]},\" column\" :\" severity_number\" ,\" operator\" :\" >\" ,\" value\" :1000}]},\" evalConfig\" :{\" rollingWindow\" :{\" evalStart\" :\" 5h\" ,\" evalEnd\" :\" now\" ,\" evalFrequency\" :1}},\" targets\" :[\" $target_id \" ]}"
411
411
412
- response1=$( curl_with_retry " $P_URL /api/v1/alerts" " POST" " $alert1_json " " application/json" 3 10 )
412
+ response1=$( curl_with_retry " $P_URL /api/v1/alerts" " POST" " $alert1_json " " application/json" 3)
413
413
if [[ $? -eq 0 ]]; then
414
414
echo " Alert 1 (Error Count) created successfully"
415
415
else
@@ -420,7 +420,7 @@ create_alerts() {
420
420
# Alert 2: 400 Errors
421
421
alert2_json=" {\" severity\" :\" critical\" ,\" title\" :\" 400 Errors\" ,\" stream\" :\" $P_STREAM \" ,\" alertType\" :\" threshold\" ,\" aggregates\" :{\" aggregateConfig\" :[{\" aggregateFunction\" :\" count\" ,\" conditions\" :{\" operator\" :null,\" conditionConfig\" :[{\" column\" :\" body\" ,\" operator\" :\" contains\" ,\" value\" :\" 400\" }]},\" column\" :\" body\" ,\" operator\" :\" >\" ,\" value\" :10}]},\" evalConfig\" :{\" rollingWindow\" :{\" evalStart\" :\" 5h\" ,\" evalEnd\" :\" now\" ,\" evalFrequency\" :1}},\" targets\" :[\" $target_id \" ]}"
422
422
423
- response2=$( curl_with_retry " $P_URL /api/v1/alerts" " POST" " $alert2_json " " application/json" 3 10 )
423
+ response2=$( curl_with_retry " $P_URL /api/v1/alerts" " POST" " $alert2_json " " application/json" 3)
424
424
if [[ $? -eq 0 ]]; then
425
425
echo " Alert 2 (400 Errors) created successfully"
426
426
else
@@ -431,7 +431,7 @@ create_alerts() {
431
431
# Alert 3: Trace ID or Span ID null
432
432
alert3_json=" {\" severity\" :\" high\" ,\" title\" :\" Trace ID or Span ID null\" ,\" stream\" :\" $P_STREAM \" ,\" alertType\" :\" threshold\" ,\" aggregates\" :{\" aggregateConfig\" :[{\" aggregateFunction\" :\" count\" ,\" conditions\" :{\" operator\" :null,\" conditionConfig\" :[{\" column\" :\" trace_id\" ,\" operator\" :\" is null\" ,\" value\" :\"\" }]},\" column\" :\" trace_id\" ,\" operator\" :\" >\" ,\" value\" :0}]},\" evalConfig\" :{\" rollingWindow\" :{\" evalStart\" :\" 5h\" ,\" evalEnd\" :\" now\" ,\" evalFrequency\" :1}},\" targets\" :[\" $target_id \" ]}"
433
433
434
- response3=$( curl_with_retry " $P_URL /api/v1/alerts" " POST" " $alert3_json " " application/json" 3 10 )
434
+ response3=$( curl_with_retry " $P_URL /api/v1/alerts" " POST" " $alert3_json " " application/json" 3)
435
435
if [[ $? -eq 0 ]]; then
436
436
echo " Alert 3 (Trace ID null) created successfully"
437
437
else
@@ -795,7 +795,7 @@ update_dashboard() {
795
795
EOF
796
796
)
797
797
798
- response=$( curl_with_retry " $P_URL /api/v1/dashboards/$dashboard_id " " PUT" " $dashboard_config " " application/json" 3 10 )
798
+ response=$( curl_with_retry " $P_URL /api/v1/dashboards/$dashboard_id " " PUT" " $dashboard_config " " application/json" 3)
799
799
if [[ $? -eq 0 ]]; then
800
800
echo " Dashboard updated successfully"
801
801
return 0
0 commit comments