From dfa848b1d8ce975fcb70918a279423618d930c55 Mon Sep 17 00:00:00 2001 From: marcsello Date: Mon, 9 Aug 2021 15:56:32 +0200 Subject: [PATCH] added basic tracing --- storage_service/app.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/storage_service/app.py b/storage_service/app.py index b2eb318..ecabb4e 100644 --- a/storage_service/app.py +++ b/storage_service/app.py @@ -13,6 +13,11 @@ from views import ObjectView from config import Config +# Tracing stuffs +import jaeger_client +import opentracing +from flask_opentracing import FlaskTracing + # Setup sentry if Config.SENTRY_DSN: sentry_sdk.init( @@ -38,6 +43,17 @@ health = HealthCheck() # register error handlers register_all_error_handlers(app) + +# Setup tracing +def initialize_tracer(): + app.logger.info("Initializing jaeger...") + jaeger_cfg = jaeger_client.Config(config={}, service_name='storage-service', validate=True) + tracer = jaeger_cfg.initialize_tracer() + return tracer + + +tracing = FlaskTracing(initialize_tracer, True, app) + # register views for view in [ObjectView]: view.register(app, trailing_slash=False)