See updated changelog file (also check out the issue description for more information why this is being introduced).
Local Tests
api_traceback_on_500 = True by default, simulating an unhanded exception on a API route to create an internal server error, notice that the client will also have the full traceback, which is very helpful for also reporting issues, and this doesn't create performance penalties nor vulnerabilities in our open source code:
❯ http http://localhost:8181/api/kytos/of_lldp/v1/polling_time
HTTP/1.1 500 Internal Server Error
content-length: 1570
content-type: text/plain; charset=utf-8
date: Tue, 02 May 2023 13:42:28 GMT
server: uvicorn
Traceback (most recent call last):
File "/home/viniarck/repos/kytos/.direnv/python-3.9.16/lib/python3.9/site-packages/starlette/middleware/errors.py", line 162, in __call__
await self.app(scope, receive, _send)
File "/home/viniarck/repos/kytos/.direnv/python-3.9.16/lib/python3.9/site-packages/elasticapm/contrib/starlette/__init__.py", line 173, in __call__
await self.app(scope, _receive, wrapped_send)
File "/home/viniarck/repos/kytos/.direnv/python-3.9.16/lib/python3.9/site-packages/starlette/middleware/cors.py", line 84, in __call__
await self.app(scope, receive, send)
File "/home/viniarck/repos/kytos/.direnv/python-3.9.16/lib/python3.9/site-packages/starlette/middleware/exceptions.py", line 79, in __call__
raise exc
File "/home/viniarck/repos/kytos/.direnv/python-3.9.16/lib/python3.9/site-packages/starlette/middleware/exceptions.py", line 68, in __call__
await self.app(scope, receive, sender)
File "/home/viniarck/repos/kytos/.direnv/python-3.9.16/lib/python3.9/site-packages/starlette/routing.py", line 716, in __call__
await route.handle(scope, receive, send)
File "/home/viniarck/repos/kytos/.direnv/python-3.9.16/lib/python3.9/site-packages/starlette/routing.py", line 276, in handle
await self.app(scope, receive, send)
File "/home/viniarck/repos/kytos/.direnv/python-3.9.16/lib/python3.9/site-packages/starlette/routing.py", line 66, in app
response = await func(request)
File "/home/viniarck/repos/napps2/napps/kytos/of_lldp/main.py", line 621, in get_time
a
NameError: name 'a' is not defined
api_traceback_on_500 = False:
❯ http http://localhost:8181/api/kytos/of_lldp/v1/polling_time
HTTP/1.1 500 Internal Server Error
content-length: 21
content-type: text/plain; charset=utf-8
date: Tue, 02 May 2023 13:43:11 GMT
server: uvicorn
Internal Server Error
For both cases though, the traceback will always be in the logs, so the main benefit is really also that the traceback is included in the response, which has demonstrated to be very helpful for e2e tests too.
Closes #379
This PR is on top of PR #375
Summary
See updated changelog file (also check out the issue description for more information why this is being introduced).
Local Tests
api_traceback_on_500 = True
by default, simulating an unhanded exception on a API route to create an internal server error, notice that the client will also have the full traceback, which is very helpful for also reporting issues, and this doesn't create performance penalties nor vulnerabilities in our open source code:api_traceback_on_500 = False
:For both cases though, the traceback will always be in the logs, so the main benefit is really also that the traceback is included in the response, which has demonstrated to be very helpful for e2e tests too.
End-to-End Tests
Not necessary in this case