Skip to content

Commit

Permalink
Merge pull request #458 from danistrebel/feature/fix-sackmesser
Browse files Browse the repository at this point in the history
Feature/fix sackmesser
  • Loading branch information
OmidTahouri authored Jan 24, 2022
2 parents 4dcd548 + a7f9d48 commit e8ad3e2
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
2 changes: 0 additions & 2 deletions references/cloud-logging-shared-flow/pipeline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ if [ "$EXISTING_EMAIL" != "$SA_EMAIL" ]; then
--role="roles/logging.logWriter"
fi



sackmesser deploy --googleapi -d "$SCRIPTPATH" -t "$APIGEE_TOKEN" --deployment-sa "$SA_EMAIL"
sackmesser deploy --googleapi -d "$SCRIPTPATH/test/logging-example" -t "$APIGEE_TOKEN"

Expand Down
4 changes: 2 additions & 2 deletions tools/apigee-sackmesser/cmd/deploy/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ skip_deployment=true #skip maven deploy unless bundle contains proxy or shared f
if [ -d "$temp_folder/apiproxy" ]; then
loginfo "Configuring API Proxy"

if [ ! -f "$temp_folder/apiproxy/*.xml" ]; then
if [ -z "$(find "$temp_folder/apiproxy" -type f -name "*.xml" -maxdepth 1 -mindepth 1)" ]; then
if [ -z "$bundle_name" ]; then
bundle_name=$(basename "$source_dir")
fi
Expand Down Expand Up @@ -155,7 +155,7 @@ elif [ -d "$temp_folder/sharedflowbundle" ]; then

skip_deployment=false

if [ ! -f "$temp_folder/sharedflowbundle/*.xml" ]; then
if [ -z "$(find "$temp_folder/sharedflowbundle" -type f -name "*.xml" -maxdepth 1 -mindepth 1)" ]; then
if [ -z "$bundle_name" ]; then
bundle_name=$(basename "$source_dir")
fi
Expand Down
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
9 changes: 6 additions & 3 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 Down Expand Up @@ -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 e8ad3e2

Please sign in to comment.