Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add uptrace client. #23

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions flask_sqlalchemy_tutorial/__init__.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,33 @@
"""Initialize Flask app."""
import uptrace
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from ddtrace import patch_all
from opentelemetry.instrumentation.flask import FlaskInstrumentor
from opentelemetry.instrumentation.sqlalchemy import SQLAlchemyInstrumentor

upclient = uptrace.Client(dsn="")


db = SQLAlchemy()
patch_all()


def create_app():
"""Construct the core application."""
app = Flask(__name__, instance_relative_config=False)
app.config.from_object("config.Config")

FlaskInstrumentor().instrument_app(app)

db.init_app(app)

with app.app_context():
from . import routes # Import routes

db.create_all() # Create database tables for our data models

SQLAlchemyInstrumentor().instrument(
engine=db.engine,
service="database",
)

return app
Loading