Skip to content

Commit

Permalink
bootstrapping the xray sdk/middleware (#1923)
Browse files Browse the repository at this point in the history
* bootstrapping the xray sdk/middleware

* fixing formatting

* adding blank line

* fixing

* attempting Custom TEmplate loader

* just make a segment

* Update notify-dev-entrypoint.sh

* format fixes

* fix

* Trying this with a different initialization order

---------

Co-authored-by: Stephen Astels <[email protected]>
  • Loading branch information
P0NDER0SA and sastels authored Aug 7, 2024
1 parent 01f5548 commit a6f3abb
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 3 deletions.
5 changes: 4 additions & 1 deletion application.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import os

from apig_wsgi import make_lambda_handler
from aws_xray_sdk.core import xray_recorder
from aws_xray_sdk.ext.flask.middleware import XRayMiddleware
from dotenv import load_dotenv
from flask import Flask

Expand All @@ -12,7 +14,8 @@

application = Flask("app")
application.wsgi_app = ProxyFix(application.wsgi_app) # type: ignore

xray_recorder.configure(service='admin')
XRayMiddleware(application, xray_recorder)
create_app(application)

apig_wsgi_handler = make_lambda_handler(application, binary_support=True)
Expand Down
3 changes: 3 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,7 @@ ignore_missing_imports = True
ignore_missing_imports = True

[mypy-newrelic.*]
ignore_missing_imports = True

[mypy-aws_xray_sdk.*]
ignore_missing_imports = True
98 changes: 96 additions & 2 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ xlrd = "1.2.0" # this is pinned so that we can continue to support .xslm files;
# Putting upgrade on hold due to v1.0.0 using sha512 instead of sha1 by default
itsdangerous = "2.2.0" # pyup: <1.0.0
newrelic = "8.10.0" # Pinned to 8.10.0 for now, 8.11.0 caused a performance regression: https://gcdigital.slack.com/archives/C012W5K734Y/p1709668046344929
aws-xray-sdk = "^2.14.0"

[tool.poetry.group.test.dependencies]
isort = "5.13.2"
Expand Down

0 comments on commit a6f3abb

Please sign in to comment.