-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New app signals proposal to track connections and requests #2685
Comments
Agree in general but let's polish client tracing first. Also I think the best place for landing server signals is not |
Stopped until #2686 gets done. |
@asvetlov any idea how can we put the signals in the |
I would like to throw in two ideas. I have an internal library that does request tracing and saves each request to the database. For our application it was essential that we grab all the outgoing traffic as often a request has financial consequences and we need to maintain full history. The tracing feature seems very close to what we developed internally, however it missing:
|
Hi @kowalski thanks for your feedback, appreciate it! Just a couple of comments to try to put all of us in the same page. This issue is about the tracing in the server side, to track those news connections and requests that flows into the server. For the Client side perspective, Aiohttp already has an implementation of the Client tracing since 3.0 [1]. So, first of all. This is about the server or the client side? Regarding the Client side, current implementation allows passing static and dynamic configurations, maybe the solution is a bit overcomplicated but you should be able to make both things in your trace configs. The usage of one pattern or another was on the air at the moment of developing this feature, contextvars were discarded because Aiohttp gives support for Python versions > 3.5. So the current implementation does allow to pass contextual information per request using the [1] https://docs.aiohttp.org/en/stable/client_advanced.html#client-tracing |
Hi @pfreixes, sorry for confusion. I was not aware this issue is about the server-side tracing. Kindly point me what is the right way to make suggestions about extending that feature. Should I open another issue ? I'm aware of tracing mechanism and I that I can pass the On the other hand I can see a way to have context variables in the TraceConfig, but it's a hack. In my code I could have a For this reason my suggestion is to allow dynamic changes of |
please, @kowalski let's have a discussion in another issue that relates with client tracing and context integration. |
Any update on this issue? Is client implementation mature enough? |
Long story short
Right now there is not a set of signals in place to track connections and request for Aiohttp web server. The proposal would implement the following subset of signals, attached to the application.
on_connection_created(app, context)
Triggered when a new connection has been created.on_connection_closed(app, context)
Triggered when a connection has been closed.on_request_start(app, context, request)
Triggered when a new request start.on_request_end(app, context, request, response)
Triggered when a requests finishes.All signals will receive as a parameter the app instance and a context that would help the user to pass information to the next semantic signal. For example, the
context
related with the connection will be instantiated when theon_connection_created
is called and the value will be passed as a parameter for both connections methods, having the same for the request flavor.These signals will be only triggered by the root app.
Taking into account that already exists a group of signals for the App and these differ a bit of the proposed ones, lack of context and so on. We could discuss on have a new module called
web_tracing
that will implement the same pattern as the client tracing [1], this might imply some name changing.My 2cent about my cons with other ways to implement that:
run_app
that implements only these new signals. The problem with this solution is the incompatibility with environments that use the workers strategy to start the application such asgunicorn
.[1] https://github.com/aio-libs/aiohttp/blob/master/aiohttp/tracing.py
The text was updated successfully, but these errors were encountered: