Skip to content

Commit

Permalink
patch for single char shareflow
Browse files Browse the repository at this point in the history
  • Loading branch information
danistrebel committed Jan 24, 2022
1 parent a97f9d3 commit a7f9d48
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion tools/apigee-sackmesser/cmd/export/export.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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')"
Expand Down
11 changes: 7 additions & 4 deletions tools/apigee-sackmesser/cmd/report/report.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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
Expand All @@ -204,7 +203,7 @@ do
echo "<td>$policycount</td>" >> "$report_html"
echo "<td>$flowcount</td>" >> "$report_html"
echo "</tr>" >> "$report_html"
done < <("$export_folder/apigeelint/proxies/"*.json -print0)
done < <(find "$export_folder/apigeelint/proxies/"*.json -print0)

echo "</tbody></table></div>" >> "$report_html"

Expand All @@ -224,7 +223,11 @@ echo "<tbody>" >> "$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 "<tr>" >> "$report_html"
echo "<th scope=\"row\"><a href=\"$(resource_link "proxies/$proxyname" "$linkrevision")\" target=\"_blank\">$proxyname</a></th>" >> "$report_html"

Expand Down

0 comments on commit a7f9d48

Please sign in to comment.