Skip to content

Commit

Permalink
Minor changes and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rycus86 committed Dec 17, 2018
1 parent fcdc892 commit 9314c2d
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 18 deletions.
27 changes: 13 additions & 14 deletions .travis.yml
Expand Up @@ -28,22 +28,21 @@ script:
jobs:
include:
- stage: integration
- &integration-stage
stage: integration
sudo: true
script:
- sh examples/gunicorn/run_tests.sh
- stage: integration
sudo: true
script:
- sh examples/uwsgi/run_tests.sh
- stage: integration
sudo: true
script:
- sh examples/wsgi/run_tests.sh
- stage: integration
sudo: true
script:
- sh examples/reload/run_tests.sh
- sh examples/${TEST_NAME}/run_tests.sh
env: TEST_NAME=gunicorn

- <<: *integration-stage
env: TEST_NAME=uwsgi

- <<: *integration-stage
env: TEST_NAME=wsgi

- <<: *integration-stage
env: TEST_NAME=reload

- stage: deploy
script: skip
Expand Down
9 changes: 5 additions & 4 deletions README.md
Expand Up @@ -160,11 +160,12 @@ app with `debug=True`, are not going to be reflected in the metrics.
See [https://github.com/rycus86/prometheus_flask_exporter/issues/4](https://github.com/rycus86/prometheus_flask_exporter/issues/4)
for more details.

Alternatively - since version 0.5.1 -, if you set the `DEBUG_METRICS`
Alternatively - since version `0.5.1` - if you set the `DEBUG_METRICS`
environment variable, you will get metrics for the latest reloaded code.
These will be exported on the main Flask app, serving the metrics on
a different port is not going to work most probably - e.g.
`PrometheusMetrics.start_http_server(..)` is not expected to work.
These will be exported on the main Flask app.
Serving the metrics on a different port is not going to work
most probably - e.g. `PrometheusMetrics.start_http_server(..)` is not
expected to work.

## WSGI

Expand Down
7 changes: 7 additions & 0 deletions examples/wsgi/app.py
Expand Up @@ -17,5 +17,12 @@ def test():
return 'OK'


@app.route('/ping')
@metrics.do_not_track()
def ping():
return 'pong'



if __name__ == '__main__':
app.run()
10 changes: 10 additions & 0 deletions examples/wsgi/run_tests.sh
Expand Up @@ -10,6 +10,16 @@ _fail() {
docker build -f Dockerfile -t wsgi-sample ../../. > /dev/null || _fail
docker run -d --name wsgi-sample -p 8889:80 wsgi-sample > /dev/null || _fail

echo 'Waiting for the server to start...'

for _ in $(seq 1 10); do
if curl -fs http://localhost:8889/ping > /dev/null; then
break
else
sleep 0.2
fi
done

echo 'Starting the tests...'

for _ in $(seq 1 10); do
Expand Down

0 comments on commit 9314c2d

Please sign in to comment.