async def app(tracer_server, loop): tracer_host = '127.0.0.1' tracer_port = (await tracer_server()).port tracer_addr = 'http://%s:%s/' % (tracer_host, tracer_port) app = Application(loop=loop) app.setup_logging(tracer_driver='zipkin', tracer_addr=tracer_addr, tracer_name='test') yield app await app.run_shutdown()
app = Application(loop=loop) app.add('http_server', http.Server('127.0.0.1', 8080, HttpHandler)) app.add('db', db.PgDb('postgres://*****:*****@localhost:15432/db', pool_min_size=2, pool_max_size=19, pool_max_queries=50000, pool_max_inactive_connection_lifetime=300., connect_max_attempts=10, connect_retry_delay=1), stop_after=['http_server']) app.add( 'tg', chat.Telegram( api_token='143877684:AAFZ4C-wrlyhT-zIPZMwZnrxmasvg2kzaUw', handler=TelegramHandler, connect_max_attempts=10, connect_retry_delay=1, )) app.setup_logging(tracer_driver='zipkin', tracer_addr='http://localhost:9411/', tracer_name='test-svc', tracer_sample_rate=1.0, tracer_send_inteval=3, metrics_driver='statsd', metrics_addr='localhost:8125', metrics_name='test_svc_') app.run()