Newrelic raising warnings on Sanic instrumentation
GabrielCappelli opened this issue · 0 comments
Description
When running a Sanic app with NewRelic I see this warnings on the logs after every request.
Expected Behavior
NOTE: # ( Tell us what you expected to happen. )
Troubleshooting or NR Diag results
NOTE: # ( Provide any other relevant log data. )
[TIP]: # ( Scrub logs and diagnostic information for sensitive information )
/usr/local/lib/python3.9/site-packages/sanic/app.py:779: RuntimeWarning: coroutine 'BaseHTTPResponse.send' was never awaited
Coroutine created at (most recent call last)
File "/app/server.py", line 59, in <module>
application.run(
File "/usr/local/lib/python3.9/site-packages/sanic/app.py", line 976, in run
serve_single(server_settings)
File "/usr/local/lib/python3.9/site-packages/sanic/server.py", line 724, in serve_single
serve(**server_settings)
File "/usr/local/lib/python3.9/site-packages/sanic/server.py", line 577, in serve
loop.run_forever()
File "/usr/local/lib/python3.9/site-packages/sanic/server.py", line 197, in connection_task
await self._http.http1()
File "/usr/local/lib/python3.9/site-packages/sanic/http.py", line 133, in http1
await self.protocol.request_handler(self.request)
File "/usr/local/lib/python3.9/site-packages/newrelic/common/async_proxy.py", line 148, in __next__
return self.send(None)
File "/usr/local/lib/python3.9/site-packages/newrelic/common/async_proxy.py", line 120, in send
return self.__wrapped__.send(value)
File "/usr/local/lib/python3.9/site-packages/sanic/app.py", line 779, in handle_request
await response.send(end_stream=True)
File "/usr/local/lib/python3.9/site-packages/newrelic/hooks/framework_sanic.py", line 192, in _nr_sanic_response_send
return wrapped(*args, **kwargs)
await response.send(end_stream=True)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Steps to Reproduce
NOTE: # ( Please be as specific as possible. )
[TIP]: # ( Link a sample application that demonstrates the issue. )
Start a Sanic app with a class based controller and newrelic instrumentation. Curl the URL, you see the warning. Same CURL without Newrelic has no warning.
from sanic import Sanic
from sanic.response import text
from sanic.views import HTTPMethodView
class TestController(HTTPMethodView):
async def get(self, request):
return text("hi")
app = Sanic("testapp")
app.add_route(TestController.as_view(), "/test")
Your Environment
[TIP]: # ( Include as many relevant details about your environment as possible including the running version of New Relic software and any relevant configurations. )
newrelic 8.0.0.179
sanic 21.6.2
Additional context
[TIP]: # ( Add any other context about the problem here. For example, relevant community posts or support tickets. )