You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 29, 2026. It is now read-only.
Describe the bug
We noticed that our instrumented Starlette application does not show up in Dynatrace. The issue seems to be in the instrumentation code at autodynatrace/wrappers/starlette/wrapper.py:
definstrument():
@wrapt.patch_function_wrapper("starlette.responses", "Response.__init__")defstarlette_parsing_dynatrace(wrapped, instance, args, kwargs):
# FastAPI creates a empty response at the beginning of a request, ignore itifkwargs.get("status_code") isNone:
returnwrapped(*args, **kwargs)
logger.debug("Tracing starlette.Response.__init__")
withsdk.trace_custom_service("Response.render", "starlette"):
returnwrapped(*args, **kwargs)
The first if statement checks for a status_code argument in kwargs on initialization of a Response, but this is not reliable, since the status code may also be passed as normal argument. In our case, the Starlette JSONResponse passes its constructor arguments to its superclass as positional arguments, not keyword arguments. Because of this, the tracing code is never reached.
Describe the bug
We noticed that our instrumented Starlette application does not show up in Dynatrace. The issue seems to be in the instrumentation code at
autodynatrace/wrappers/starlette/wrapper.py:The first if statement checks for a
status_codeargument inkwargson initialization of aResponse, but this is not reliable, since the status code may also be passed as normal argument. In our case, the StarletteJSONResponsepasses its constructor arguments to its superclass as positional arguments, not keyword arguments. Because of this, the tracing code is never reached.