From a7f9d48ce1b11d6c7aa781f9c66f78626646e525 Mon Sep 17 00:00:00 2001 From: Daniel Strebel Date: Mon, 24 Jan 2022 15:04:14 +0100 Subject: [PATCH] patch for single char shareflow --- tools/apigee-sackmesser/cmd/export/export.sh | 2 +- tools/apigee-sackmesser/cmd/report/report.sh | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/tools/apigee-sackmesser/cmd/export/export.sh b/tools/apigee-sackmesser/cmd/export/export.sh index 28ff20efd..e73ad65ea 100755 --- a/tools/apigee-sackmesser/cmd/export/export.sh +++ b/tools/apigee-sackmesser/cmd/export/export.sh @@ -41,7 +41,7 @@ fi loginfo "exporting to $export_folder" mkdir -p "$export_folder" -sackmesser list "organizations/$organization/sharedflows" | jq -r -c '.[]|.'| while read -r sharedflow; do +sackmesser list "organizations/$organization/sharedflows" | jq -r -c '.[]|. | select((. | length) > 1)' | while read -r sharedflow; do loginfo "download shared flow: $sharedflow" mkdir -p "$export_folder/sharedflows/$sharedflow" latest="$(sackmesser list "organizations/$organization/sharedflows/$sharedflow" | jq '.revision | map(tonumber) | max')" diff --git a/tools/apigee-sackmesser/cmd/report/report.sh b/tools/apigee-sackmesser/cmd/report/report.sh index 87fff9b4c..5892b9dca 100755 --- a/tools/apigee-sackmesser/cmd/report/report.sh +++ b/tools/apigee-sackmesser/cmd/report/report.sh @@ -93,7 +93,7 @@ performancequery="organizations/$organization/environments/$environment/stats/ap performancequery+="?limit=14400&offset=0" performancequery+="&select=sum(message_count)/3600.0,sum(is_error),avg(target_response_time),avg(total_response_time)" performancequery+="&timeUnit=day" -PERFORMANCE_Q_START=$(date -u -v1d '+%m/%d/%Y%%2000:00:00' 2&>/dev/null || date -u -d "1 day ago" '+%m/%d/%Y%%2000:00:00' || date -u -d "@$(( $(date +%s ) - 86400 ))" '+%m/%d/%Y%%2000:00:00') +PERFORMANCE_Q_START=$(date -u -v1d '+%m/%d/%Y%%2000:00:00' 2&>/dev/null || date -u -d "1 day ago" '+%m/%d/%Y%%2000:00:00' || date -u -d "@$(( $(date +%s ) - 86400 ))" '+%m/%d/%Y%%2000:00:00' || echo '') performancequery+="&timeRange=$PERFORMANCE_Q_START~$(date -u '+%m/%d/%Y%%2000:00:00')" sackmesser list "$performancequery" > "$export_folder/performance-$environment.json" @@ -182,7 +182,6 @@ do echo "$linkrevision" > "$export_folder/scratch/proxyrevisions/$proxyname" - if [ -d "$proxyexportpath/apiproxy/policies" ];then policycount=$(find "$proxyexportpath"/apiproxy/policies/*.xml | wc -l) else @@ -204,7 +203,7 @@ do echo "$policycount" >> "$report_html" echo "$flowcount" >> "$report_html" echo "" >> "$report_html" -done < <("$export_folder/apigeelint/proxies/"*.json -print0) +done < <(find "$export_folder/apigeelint/proxies/"*.json -print0) echo "" >> "$report_html" @@ -224,7 +223,11 @@ echo "" >> "$report_html" while IFS= read -r -d '' policyusage do proxyname=$(basename "${policyusage%%-indexed.*}") - linkrevision=$(cat "$export_folder/scratch/proxyrevisions/$proxyname") + if [ -f "$export_folder/scratch/proxyrevisions/$proxyname" ]; then + linkrevision=$(cat "$export_folder/scratch/proxyrevisions/$proxyname") + else + linkrevision="unknown" + fi echo "" >> "$report_html" echo "$proxyname" >> "$report_html"