Added basic tracking

This commit is contained in:
Pünkösd Marcell 2021-08-04 16:57:27 +02:00
parent edbd17f79d
commit d8b62f20a2
2 changed files with 19 additions and 1 deletions

View File

@ -14,6 +14,11 @@ from views import SVMView, CNNView, RootView
from config import Config
# Tracing stuffs
import jaeger_client
import opentracing
from flask_opentracing import FlaskTracing
if Config.SENTRY_DSN:
sentry_sdk.init(
dsn=Config.SENTRY_DSN,
@ -43,6 +48,16 @@ def create_db():
# register error handlers
register_all_error_handlers(app)
# Setup tracing
def initialize_tracer():
jaeger_cfg = jaeger_client.Config(config={}, service_name='cnn-classification-service', validate=True)
tracer = jaeger_cfg.initialize_tracer()
return tracer
tracing = FlaskTracing(initialize_tracer, True, app)
# register views
for view in [SVMView, CNNView, RootView]:
view.register(app, trailing_slash=False, route_prefix='/model')

View File

@ -30,4 +30,7 @@ python-dateutil==2.8.1
scikit-learn==0.21.3
scipy==1.4.1
simplejson==3.17.0
six==1.14.0
six==1.14.0
jaeger-client
Flask-Opentracing