Add rollbar configuration to loadgenerator
This commit is contained in:
parent
fee184176f
commit
a01a60fb9e
5 changed files with 24 additions and 3 deletions
1
src/loadgenerator/.gitignore
vendored
Normal file
1
src/loadgenerator/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
credentials.py
|
|
@ -12,7 +12,7 @@
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
FROM python:3-slim as base
|
FROM python:3.6-slim as base
|
||||||
|
|
||||||
FROM base as builder
|
FROM base as builder
|
||||||
|
|
||||||
|
@ -22,6 +22,8 @@ RUN apt-get -qq update \
|
||||||
|
|
||||||
COPY requirements.txt .
|
COPY requirements.txt .
|
||||||
|
|
||||||
|
#RUN python -m pip install --force-reinstall pip==20.1.1
|
||||||
|
#RUN pip install --install-option="--prefix=/install" -r requirements.txt
|
||||||
RUN pip install --prefix="/install" -r requirements.txt
|
RUN pip install --prefix="/install" -r requirements.txt
|
||||||
|
|
||||||
FROM base
|
FROM base
|
||||||
|
|
|
@ -25,11 +25,15 @@ fi
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
# if one request to the frontend fails, then exit
|
# if one request to the frontend fails, then exit
|
||||||
STATUSCODE=$(curl --silent --output /dev/stderr --write-out "%{http_code}" http://${FRONTEND_ADDR})
|
STATUSCODE=$(curl --silent --output /dev/stderr --write-out "%{http_code}" ${FRONTEND_ADDR})
|
||||||
|
#revert line above to the following if running all microservices together or http
|
||||||
|
#STATUSCODE=$(curl --silent --output /dev/stderr --write-out "%{http_code}" http://${FRONTEND_ADDR})
|
||||||
if test $STATUSCODE -ne 200; then
|
if test $STATUSCODE -ne 200; then
|
||||||
echo "Error: Could not reach frontend - Status code: ${STATUSCODE}"
|
echo "Error: Could not reach frontend - Status code: ${STATUSCODE}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# else, run loadgen
|
# else, run loadgen
|
||||||
locust --host="http://${FRONTEND_ADDR}" --no-web -c "${USERS:-10}" 2>&1
|
locust --host="${FRONTEND_ADDR}" --no-web -c "${USERS:-10}" 2>&1
|
||||||
|
#revert line above to the following if running all microservices together or http
|
||||||
|
#locust --host="http://${FRONTEND_ADDR}" --no-web -c "${USERS:-10}" 2>&1
|
||||||
|
|
|
@ -16,6 +16,19 @@
|
||||||
|
|
||||||
import random
|
import random
|
||||||
from locust import HttpLocust, TaskSet, between
|
from locust import HttpLocust, TaskSet, between
|
||||||
|
import credentials
|
||||||
|
|
||||||
|
import rollbar
|
||||||
|
rollbar.init(credentials.POST_SERVER_ITEM_ACCESS_TOKEN, 'production') # access_token, environment
|
||||||
|
|
||||||
|
try:
|
||||||
|
main_app_loop()
|
||||||
|
except IOError:
|
||||||
|
rollbar.report_message('Got an IOError in the main loop', 'warning')
|
||||||
|
except:
|
||||||
|
# catch-all
|
||||||
|
rollbar.report_exc_info()
|
||||||
|
# equivalent to rollbar.report_exc_info(sys.exc_info())
|
||||||
|
|
||||||
products = [
|
products = [
|
||||||
'0PUK6V6EV0',
|
'0PUK6V6EV0',
|
||||||
|
|
|
@ -19,6 +19,7 @@ markupsafe==1.1.0 # via jinja2
|
||||||
msgpack-python==0.5.6 # via locustio
|
msgpack-python==0.5.6 # via locustio
|
||||||
pyzmq==17.0.0 # via locustio
|
pyzmq==17.0.0 # via locustio
|
||||||
requests==2.21.0 # via locustio
|
requests==2.21.0 # via locustio
|
||||||
|
rollbar
|
||||||
six==1.12.0 # via geventhttpclient-wheels, locustio
|
six==1.12.0 # via geventhttpclient-wheels, locustio
|
||||||
urllib3==1.24.2 # via requests
|
urllib3==1.24.2 # via requests
|
||||||
werkzeug==0.14.1 # via flask
|
werkzeug==0.14.1 # via flask
|
||||||
|
|
Loading…
Add table
Reference in a new issue