-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
44 lines (31 loc) · 991 Bytes
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
from flask import Flask, json
import logging
app = Flask(__name__)
@app.route('/status')
def healthcheck():
app.logger.info('Healthcheck starting')
response = app.response_class(
response=json.dumps({"result": "OK - healthy"}),
status=200,
mimetype='application/json'
)
app.logger.info('Status request successfull')
return response
@app.route('/metrics')
def metrics():
response = app.response_class(
response=json.dumps({"status": "success", "code": 0, "data": {
"UserCount": 140, "UserCountActive": 23}}),
status=200,
mimetype='application/json'
)
app.logger.info('Metrics request successfull')
return response
@app.route("/")
def hello():
app.logger.info('Main request successfull')
return "Hello Krystal!"
if __name__ == "__main__":
# stream logs to a file
logging.basicConfig(filename='app.log', level=logging.DEBUG)
app.run(host='0.0.0.0')