Skip to content

Commit

Permalink
Merge pull request instana#134 from instana/Remove_Stripping_of_trail…
Browse files Browse the repository at this point in the history
…ing_slash

Removed stripping of the trailing / of Instana Reporting Url for End User Monitoring .
  • Loading branch information
bincydan authored Mar 6, 2023
2 parents fa38ab3 + 1109eef commit 55292e2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ $ kubectl get svc web
If you are using a cloud Kubernetes / Openshift / Mesosphere then it will be available on the load balancer of that system.

## Load Generation
A separate load generation utility is provided in the `load-gen` directory. This is not automatically run when the application is started. The load generator is built with Python and [Locust](https://locust.io). The `build.sh` script builds the Docker image, optionally taking *push* as the first argument to also push the image to the registry. The registry and tag settings are loaded from the `.env` file in the parent directory. The script `load-gen.sh` runs the image, it takes a number of command line arguments. You could run the container inside an orchestration system (K8s) as well if you want to, an example descriptor is provided in K8s directory. For more details see the [README](load-gen/README.md) in the load-gen directory.
A separate load generation utility is provided in the `load-gen` directory. This is not automatically run when the application is started. The load generator is built with Python and [Locust](https://locust.io). The `build.sh` script builds the Docker image, optionally taking *push* as the first argument to also push the image to the registry. The registry and tag settings are loaded from the `.env` file in the parent directory. The script `load-gen.sh` runs the image, it takes a number of command line arguments. You could run the container inside an orchestration system (K8s) as well if you want to, an example descriptor is provided in K8s directory. For End-user Monitoring ,load is not automatically generated but by navigating through the Robotshop from the browser .For more details see the [README](load-gen/README.md) in the load-gen directory.

## Website Monitoring / End-User Monitoring

Expand Down
22 changes: 16 additions & 6 deletions web/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

# echo "arg 1 $1"


BASE_DIR=/usr/share/nginx/html

if [ -n "$1" ]
Expand All @@ -14,12 +15,21 @@ fi
if [ -n "$INSTANA_EUM_KEY" -a -n "$INSTANA_EUM_REPORTING_URL" ]
then
echo "Enabling Instana EUM"
# use | instead of / as command delimiter to avoid eacaping the url
# strip off any trailing /
SAFE_URL=$(echo "$INSTANA_EUM_REPORTING_URL" | sed 's|/*$||')
sed -i "s|INSTANA_EUM_KEY|$INSTANA_EUM_KEY|" $BASE_DIR/eum-tmpl.html
sed -i "s|INSTANA_EUM_REPORTING_URL|$SAFE_URL|" $BASE_DIR/eum-tmpl.html
cp $BASE_DIR/eum-tmpl.html $BASE_DIR/eum.html
result=$(curl -kv -s --connect-timeout 10 "$INSTANA_EUM_REPORTING_URL" 2>&1 | grep "301 Moved Permanently")
if [ -n "$result" ];
then
echo '301 Moved Permanently found!'
[[ "${INSTANA_EUM_REPORTING_URL}" != */ ]] && INSTANA_EUM_REPORTING_URL="${INSTANA_EUM_REPORTING_URL}/"
sed -i "s|INSTANA_EUM_KEY|$INSTANA_EUM_KEY|" $BASE_DIR/eum-tmpl.html
sed -i "s|INSTANA_EUM_REPORTING_URL|$INSTANA_EUM_REPORTING_URL|" $BASE_DIR/eum-tmpl.html
cp $BASE_DIR/eum-tmpl.html $BASE_DIR/eum.html
else
echo "Go with the user input"
sed -i "s|INSTANA_EUM_KEY|$INSTANA_EUM_KEY|" $BASE_DIR/eum-tmpl.html
sed -i "s|INSTANA_EUM_REPORTING_URL|$INSTANA_EUM_REPORTING_URL|" $BASE_DIR/eum-tmpl.html
cp $BASE_DIR/eum-tmpl.html $BASE_DIR/eum.html
fi

else
echo "EUM not enabled"
cp $BASE_DIR/empty.html $BASE_DIR/eum.html
Expand Down

0 comments on commit 55292e2

Please sign in to comment.