mirror of
https://github.com/weaveworks/scope.git
synced 2026-08-18 20:07:06 +00:00
Update example app.
This commit is contained in:
@@ -48,12 +48,26 @@ def ignore_error(f):
|
||||
logging.error("Error executing function", exc_info=sys.exc_info())
|
||||
return "Error"
|
||||
|
||||
@app.route('/')
|
||||
# this root is for the tracing demo
|
||||
@app.route('/hello')
|
||||
def hello():
|
||||
qotd_msg = do_qotd()
|
||||
qotd_msg = do_echo(qotd_msg)
|
||||
return qotd_msg
|
||||
|
||||
# this is for normal demos
|
||||
@app.route('/')
|
||||
def root():
|
||||
counter_future = pool.submit(do_redis)
|
||||
search_future = pool.submit(do_search)
|
||||
qotd_future = pool.submit(do_qotd)
|
||||
echo_future = pool.submit(lambda: do_echo("foo"))
|
||||
result = 'Hello World! I have been seen %s times.' % ignore_error(counter_future.result)
|
||||
result += ignore_error(search_future.result)
|
||||
result += ignore_error(qotd_future.result)
|
||||
result += ignore_error(echo_future.result)
|
||||
return result
|
||||
|
||||
if __name__ == "__main__":
|
||||
logging.basicConfig(format='%(asctime)s %(levelname)s %(filename)s:%(lineno)d - %(message)s', level=logging.INFO)
|
||||
WSGIRequestHandler.protocol_version = "HTTP/1.1"
|
||||
|
||||
Reference in New Issue
Block a user