end user monitoring
This commit is contained in:
@@ -69,6 +69,5 @@ If you are using a cloud Kubernetes / Openshift / Mesosphere then it will be ava
|
||||
## 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, edit this and set the HOST environment variable to point the load at where you are running the application. You could run this inside an orchestration system (K8s) as well if you want to, how to do this is left as an exercise for the reader.
|
||||
|
||||
## TO DO
|
||||
|
||||
- End User Monitoring
|
||||
## End User Monitoring
|
||||
To enable End User Monitoring (EUM) see the official [documentation](https://docs.instana.io/products/website_monitoring/) for how to create a configuration. There is no need to inject the javascript fragment into the page, this will be handled automatically. Just make a note of the unique key and set the environment variable INSTANA_EUM_KEY for the *web* image, see *docker-compose.yaml* for an example.
|
||||
|
@@ -103,6 +103,9 @@ services:
|
||||
- "8080:8080"
|
||||
networks:
|
||||
- robot-shop
|
||||
# Uncomment to enable Instana EUM
|
||||
# environment:
|
||||
# INSTANA_EUM_KEY: <your eum key here>
|
||||
|
||||
networks:
|
||||
robot-shop:
|
||||
|
@@ -2,8 +2,8 @@ FROM nginx:1.13.8
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
# RUN apt-get update -y && apt-get install -y curl iputils-ping dnsutils
|
||||
# RUN mkdir -p /var/cache/nginx && chmod 777 /var/cache/nginx
|
||||
COPY entrypoint.sh /root/
|
||||
ENTRYPOINT ["/root/entrypoint.sh"]
|
||||
|
||||
COPY default.conf /etc/nginx/conf.d/default.conf
|
||||
COPY static /usr/share/nginx/html
|
||||
|
@@ -8,6 +8,7 @@ server {
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html index.htm;
|
||||
ssi on;
|
||||
}
|
||||
|
||||
#error_page 404 /404.html;
|
||||
|
23
web/entrypoint.sh
Executable file
23
web/entrypoint.sh
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# set -x
|
||||
|
||||
# echo "arg 1 $1"
|
||||
|
||||
BASE_DIR=/usr/share/nginx/html
|
||||
|
||||
if [ -n "$1" ]
|
||||
then
|
||||
exec "$@"
|
||||
fi
|
||||
|
||||
if [ -n "$INSTANA_EUM_KEY" ]
|
||||
then
|
||||
echo "Enabling Instana EUM"
|
||||
sed -e "/ineum/s/INSTANA_EUM_KEY/$INSTANA_EUM_KEY/" $BASE_DIR/eum-tmpl.html > $BASE_DIR/eum.html
|
||||
else
|
||||
cp $BASE_DIR/empty.html $BASE_DIR/eum.html
|
||||
fi
|
||||
|
||||
exec nginx -g "daemon off;"
|
||||
|
1
web/static/empty.html
Normal file
1
web/static/empty.html
Normal file
@@ -0,0 +1 @@
|
||||
<!-- EUM not enabled. Add INSTANA_EUM_KEY to envrinment for docker image -->
|
10
web/static/eum-tmpl.html
Normal file
10
web/static/eum-tmpl.html
Normal file
@@ -0,0 +1,10 @@
|
||||
<!-- EUM include -->
|
||||
<script>
|
||||
(function(i,s,o,g,r,a,m){i['InstanaEumObject']=r;i[r]=i[r]||function(){
|
||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||
})(window,document,'script','//eum.instana.io/eum.min.js','ineum');
|
||||
ineum('apiKey', 'INSTANA_EUM_KEY');
|
||||
</script>
|
||||
<!-- EUM include end -->
|
||||
|
@@ -1,6 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<!--# include file="eum.html" -->
|
||||
<title>Stan's Robot Shop</title>
|
||||
<style type="text/css">
|
||||
@import url('https://fonts.googleapis.com/css?family=Orbitron');
|
||||
|
@@ -51,6 +51,24 @@
|
||||
console.log('>>> clearing cache');
|
||||
$templateCache.removeAll();
|
||||
});
|
||||
|
||||
// Instana EUM
|
||||
// may not be loaded so check for ineum object
|
||||
$rootScope.$on('$routeChangeStart', (event, next, current) => {
|
||||
if(typeof ineum !== 'undefined') {
|
||||
ineum('startSpaPageTransition');
|
||||
}
|
||||
});
|
||||
$rootScope.$on('$routeChangeSuccess', (event, next, current) => {
|
||||
if(typeof ineum !== 'undefined') {
|
||||
ineum('endSpaPageTransition', {'status': 'completed', 'url': window.location.href});
|
||||
}
|
||||
});
|
||||
$rootScope.$on('$routeChangeError', (event, next, current) => {
|
||||
if(typeof ineum !== 'undefined') {
|
||||
ineum('endSpaPageTransition', {'status': 'error'});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
robotshop.controller('shopform', function($scope, $http, $location, currentUser) {
|
||||
|
Reference in New Issue
Block a user