From 96790be6f783492c504c680857cd793121da89f0 Mon Sep 17 00:00:00 2001 From: Lulzette Date: Mon, 1 Nov 2021 04:46:07 +0300 Subject: [PATCH] =?UTF-8?q?=D0=92=D0=B5=D1=80=D0=BD=D1=83=D0=BB=20=D0=BC?= =?UTF-8?q?=D0=B5=D1=82=D1=80=D0=B8=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 10 ++++++++++ test.sh | 2 ++ 2 files changed, 12 insertions(+) diff --git a/main.py b/main.py index c09a7c4..4690a59 100755 --- a/main.py +++ b/main.py @@ -104,6 +104,16 @@ class Back(): return bool(posts.delete_one({'name': name}).deleted_count) +class Metrics: + def alive(): + return str("alive 1") + + +@route('/metrics') +def metrics(): + return Metrics.alive() + + @route('/post/') def post(name): ''' diff --git a/test.sh b/test.sh index 9c56f0c..45b7844 100644 --- a/test.sh +++ b/test.sh @@ -8,3 +8,5 @@ $curl_cmd $url/post/test && echo ": get Success" || echo ': get fail' $curl_cmd -X POST $url/admin/post/test -F 'body=testpage2' && echo ": Update success" || echo ': update fail' $curl_cmd -X DELETE $url/admin/post/test && echo ": delete success" || echo ': delete fail' + +$curl_cmd $url/metrics && echo ": metrics available" || echo ': metrics unavailable'