dynatrace-oss / OneAgent-SDK-Python-AutoInstrumentation

autodynatrace, a python library that implements automatic instrumentation using the OneAgent SDK for Python
Other
62 stars 28 forks source link

No tracing on bad requests, using starlette+connexion+flask #98

Open leclercmartin opened 6 months ago

leclercmartin commented 6 months ago

Describe the bug No trace is sent to Dynatrace on detected bad requests (HTTP status 400), when using the stack starlette:0.32.0.post1 + connexion:3.0.5 + flask:3.0.0.

When doing some other tests, I see tracing of requests for there use cases:

Here is my observation. The new version of connexion (v3 - ASGI) handles the request before delegating to flask. In the different scenarios listed above, successful processing, no resource found or internal error, they all pass through flask code. The case of bd request, connexion detects the base request and calls its error handling mechanism (which can be overriden)

To Reproduce Steps to reproduce the behavior:

  1. Create a dummy application using the connexion guideline, using FlaskApp, with simple openapi definition, adding a dependency on autodynatrace and appropriate configuration
  2. Send an valid vs invalid request
  3. Dynatrace will contain only the successful traces
  4. No error found in log...

Expected behavior I would expect that the bad requests be reported in Dynatrace.

Thanks in advance for your help.