aio-libs / aio-libs/aiohttp

tracing support enhancements

Open
#3,084 4 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
16.5k
Forks
2.4k
Avg merge
17h 22m
Merged PRs (30d)
212

Description

## Long story short

After writing an ugly 2.x monkeypatch for client tracing support in datadog: https://github.com/DataDog/dd-trace-py/pull/294 a new aiohttp tracing strategy was discussed and created. I'm now trying to move this PR to use the new tracing support however have run into a few issues.

## Expected behaviour

Ability to trace major network activities in aiohttp

## Actual behaviour

1. Unable to trace when aiohttp is waiting for a request response headers: https://github.com/aio-libs/aiohttp/blob/v3.3.1/aiohttp/client.py#L387
2. Unable to trace chunked stream reads via `StreamReader.read()`

## Steps to reproduce

TBD

## Your environment

aiohttp 3.3.1

## Other Thoughts from a client perspective

1. Initially I thought a trace was missing for req.send: https://github.com/aio-libs/aiohttp/blob/v3.3.1/aiohttp/client.py#L385 however after tracing through that method and what it calls I don't think it needs to be an async function.
2. I think it would be a lot simpler if there was a trace per while loop of redirects, otherwise I have to piece together conn timeout + header send + header response
3. I'm not sure what `send_response_chunk_received` represents? It would be nice if there was a diagram describing when each one happens.
4. seems weird having `send_request_chunk_sent` w/o a received, basically sending request but never got response? What I see on a request from aiobotocore is: send_request_start -> send_conn_create_start -> send_conn_create_end -> send_request_chunk_sent -> send_request_end

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.