-
Notifications
You must be signed in to change notification settings - Fork 890
Description
Version 0.34b0
In the aiohttp-client instrumentation, the response_hook is called before setting the status and the status_code of the span. This means the user cannot set a custom status on the span, as it will be immediately overridden by the default value.
In my specific usecase I am making requests as a cache, where a cache-miss returns a 404 response. These spans are than tagged with the StatusCode.ERROR, which is a bit annoying to me as these responses are completely expected and accepted. Therefore I would like to override the StatusCode on those requests in the response_hook.
I am happy to provide a fix for this.
What is the expected behavior?
reponse_hook should be called after setting the span status, to allow for overriding it.
What is the actual behavior?
reponse_hook is called before setting the span status
Additional context
I compared this with the httpx and requests instrumentation. In those instrumentations, overriding the status in the hook is possible.