mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-28 22:09:44 -05:00
jaeger wip
This commit is contained in:
@@ -7,7 +7,9 @@ from flask import _request_ctx_stack, request, g, jsonify, make_response
|
||||
from flask_sqlalchemy import SQLAlchemy as _SQLAlchemy
|
||||
from flask_marshmallow import Marshmallow
|
||||
from flask_migrate import Migrate
|
||||
from flask_opentracing import FlaskTracer
|
||||
from gds_metrics import GDSMetrics
|
||||
from jaeger_client import Config as JaegerConfig
|
||||
from time import monotonic
|
||||
from notifications_utils.clients.zendesk.zendesk_client import ZendeskClient
|
||||
from notifications_utils.clients.statsd.statsd_client import StatsdClient
|
||||
@@ -63,6 +65,7 @@ clients = Clients()
|
||||
|
||||
api_user = LocalProxy(lambda: _request_ctx_stack.top.api_user)
|
||||
authenticated_service = LocalProxy(lambda: _request_ctx_stack.top.authenticated_service)
|
||||
flask_tracer = FlaskTracer(initialize_tracer, False)
|
||||
|
||||
|
||||
def create_app(application):
|
||||
@@ -104,6 +107,9 @@ def create_app(application):
|
||||
register_blueprint(application)
|
||||
register_v2_blueprints(application)
|
||||
|
||||
flask_tracer = FlaskTracer(initialize_tracer, True, application)
|
||||
|
||||
|
||||
# avoid circular imports by importing this file later
|
||||
from app.commands import setup_commands
|
||||
setup_commands(application)
|
||||
@@ -311,3 +317,12 @@ def process_user_agent(user_agent_string):
|
||||
return "non-notify-user-agent"
|
||||
else:
|
||||
return "unknown"
|
||||
|
||||
def initialize_tracer():
|
||||
config = JaegerConfig(
|
||||
config={
|
||||
"sampler": {"type": "const", "param": 1}
|
||||
},
|
||||
service_name="notify-api"
|
||||
)
|
||||
return config.initialize_tracer()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from sqlalchemy.sql.expression import func
|
||||
|
||||
from app import db
|
||||
from app import db, flask_tracer
|
||||
from app.dao.dao_utils import VersionOptions, transactional, version_class
|
||||
from app.models import (
|
||||
Organisation,
|
||||
@@ -17,6 +17,7 @@ def dao_get_organisations():
|
||||
).all()
|
||||
|
||||
|
||||
@flask_tracer.trace()
|
||||
def dao_count_organisations_with_live_services():
|
||||
return db.session.query(Organisation.id).join(Organisation.services).filter(
|
||||
Service.active.is_(True),
|
||||
|
||||
@@ -20,6 +20,8 @@ marshmallow==2.21.0 # pyup: <3 # v3 throws errors
|
||||
psycopg2-binary==2.8.5
|
||||
PyJWT==1.7.1
|
||||
SQLAlchemy==1.3.17
|
||||
Flask-Opentracing==1.1.0
|
||||
jaeger-client==4.3.0
|
||||
|
||||
notifications-python-client==5.5.1
|
||||
|
||||
|
||||
@@ -22,6 +22,8 @@ marshmallow==2.21.0 # pyup: <3 # v3 throws errors
|
||||
psycopg2-binary==2.8.5
|
||||
PyJWT==1.7.1
|
||||
SQLAlchemy==1.3.17
|
||||
Flask-Opentracing==1.1.0
|
||||
jaeger-client==4.3.0
|
||||
|
||||
notifications-python-client==5.5.1
|
||||
|
||||
@@ -37,14 +39,14 @@ alembic==1.4.2
|
||||
amqp==1.4.9
|
||||
anyjson==0.3.3
|
||||
attrs==19.3.0
|
||||
awscli==1.18.75
|
||||
awscli==1.18.76
|
||||
bcrypt==3.1.7
|
||||
billiard==3.3.0.23
|
||||
bleach==3.1.4
|
||||
blinker==1.4
|
||||
boto==2.49.0
|
||||
boto3==1.10.38
|
||||
botocore==1.16.25
|
||||
botocore==1.16.26
|
||||
certifi==2020.4.5.2
|
||||
chardet==3.0.4
|
||||
click==7.1.2
|
||||
@@ -64,6 +66,7 @@ Mako==1.1.3
|
||||
MarkupSafe==1.1.1
|
||||
mistune==0.8.4
|
||||
monotonic==1.5
|
||||
opentracing==2.3.0
|
||||
orderedset==2.0.1
|
||||
phonenumbers==8.11.2
|
||||
prometheus-client==0.2.0
|
||||
@@ -83,6 +86,9 @@ s3transfer==0.3.3
|
||||
six==1.15.0
|
||||
smartypants==2.0.1
|
||||
statsd==3.3.0
|
||||
threadloop==1.0.2
|
||||
thrift==0.13.0
|
||||
tornado==6.0.4
|
||||
urllib3==1.25.9
|
||||
webencodings==0.5.1
|
||||
Werkzeug==1.0.1
|
||||
|
||||
Reference in New Issue
Block a user