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

Feat/latest flask on legacy #386

Merged
merged 3 commits into from
Sep 16, 2022
Merged
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
11 changes: 6 additions & 5 deletions instana/instrumentation/flask/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,16 @@

@wrapt.patch_function_wrapper('flask', 'templating._render')
def render_with_instana(wrapped, instance, argv, kwargs):
ctx = argv[1]

# If we're not tracing, just return
if not hasattr(ctx['g'], 'scope'):
if not (hasattr(flask, 'g') and hasattr(flask.g, 'scope')):
return wrapped(*argv, **kwargs)

with tracer.start_active_span("render", child_of=ctx['g'].scope.span) as rscope:
parent_span = flask.g.scope.span

with tracer.start_active_span("render", child_of=parent_span) as rscope:
try:
template = argv[0]
flask_version = tuple(map(int, flask.__version__.split('.')))
template = argv[1] if flask_version >= (2, 2, 0) else argv[0]

rscope.span.set_tag("type", "template")
if template.name is None:
Expand Down
1 change: 1 addition & 0 deletions tests/clients/test_asynqp.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ async def fetch(self, session, url, headers=None):
except aiohttp.web_exceptions.HTTPException:
pass

@pytest.mark.skip(reason="Asynqp is an abandoned library, sometimes messages are duplicated randomly")
def test_publish(self):
@asyncio.coroutine
def test():
Expand Down
6 changes: 3 additions & 3 deletions tests/requirements-310.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ celery>=5.0.5
coverage>=5.5
Django>=3.2.10
fastapi>=0.65.1
flask>=2.0.0
flask>=2.2.0
markupsafe>=2.1.0
grpcio>=1.37.1
google-cloud-pubsub<=2.1.0
google-cloud-storage>=1.24.0
lxml>=4.6.3
mock>=4.0.3

# We have to increase the minimum moto version so we can keep markupsafe on the required minimum
# TODO: This appears to break 'test_get_secret_value' in test_boto3_secretsmanager.py
moto>=2.0
mysqlclient>=2.0.3
nose>=1.3.7
Expand All @@ -45,7 +45,7 @@ pytest-celery
redis>=3.5.3
requests-mock
responses<=0.17.0
sanic>=19.0.0,<21.9.0
sanic==21.6.2
sqlalchemy>=1.4.15
spyne>=2.13.16
suds-jurko>=0.6
Expand Down