Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async def make_app():
app = web.Application()
app.router.add_get('/api/v1/data', handler)
zipkin_address = 'http://127.0.0.1:9411/api/v2/spans'
endpoint = az.create_endpoint('service_c', ipv4=host, port=port)
tracer = await az.create(zipkin_address, endpoint, sample_rate=1.0)
az.setup(app, tracer)
return app
async def make_app():
app = web.Application()
app.router.add_get('/api/v1/data', handler)
zipkin_address = 'http://127.0.0.1:9411/api/v2/spans'
endpoint = az.create_endpoint('service_d', ipv4=host, port=port)
tracer = await az.create(zipkin_address, endpoint, sample_rate=1.0)
az.setup(app, tracer)
return app
async def make_app(host, port):
app = web.Application()
app.router.add_get('/', index)
session = aiohttp.ClientSession()
app['session'] = session
zipkin_address = 'http://127.0.0.1:9411/api/v2/spans'
endpoint = az.create_endpoint('frontend', ipv4=host, port=port)
tracer = await az.create(zipkin_address, endpoint, sample_rate=1.0)
az.setup(app, tracer)
return app
async def run():
# setup zipkin client
zipkin_address = 'http://127.0.0.1:9411/api/v2/spans'
# address and name of current machine for better trace information
endpoint = az.create_endpoint('minimal_example', ipv4='127.0.0.1')
# creates tracer object that tracer all calls if you want sample
# only 50% just set sample_rate=0.5
async with az.create(zipkin_address, endpoint, sample_rate=1.0) as tracer:
# create and setup new trace
with tracer.new_trace() as span:
# here we just add name to the span for better search in UI
span.name('root::span')
# imitate long SQL query
await asyncio.sleep(0.1)
print('Done, check zipkin UI')
async def make_app():
app = web.Application()
app.router.add_get('/api/v1/data', handler)
app.router.add_get('/', handler)
endpoint = az.create_endpoint('service_a', ipv4=host, port=port)
tracer = await az.create(zipkin_address, endpoint, sample_rate=1.0)
trace_config = az.make_trace_config(tracer)
session = aiohttp.ClientSession(trace_configs=[trace_config])
app['session'] = session
async def close_session(app):
await app['session'].close()
app.on_cleanup.append(close_session)
az.setup(app, tracer)
TEMPLATES_ROOT = pathlib.Path(__file__).parent / 'templates'
aiohttp_jinja2.setup(
app, loader=jinja2.FileSystemLoader(str(TEMPLATES_ROOT))
async def make_app():
app = web.Application()
app.router.add_get('/api/v1/data', handler)
zipkin_address = 'http://127.0.0.1:9411/api/v2/spans'
endpoint = az.create_endpoint('service_e', ipv4=host, port=port)
tracer = await az.create(zipkin_address, endpoint, sample_rate=1.0)
az.setup(app, tracer)
return app
async def make_app():
app = web.Application()
app.router.add_get('/api/v1/data', handler)
zipkin_address = 'http://127.0.0.1:9411/api/v2/spans'
endpoint = az.create_endpoint('service_b', ipv4=host, port=port)
tracer = await az.create(zipkin_address, endpoint, sample_rate=1.0)
az.setup(app, tracer)
trace_config = az.make_trace_config(tracer)
session = aiohttp.ClientSession(trace_configs=[trace_config])
app['session'] = session
async def close_session(app):
await app['session'].close()
app.on_cleanup.append(close_session)
return app