AllSpiceIO / py-allspice

An AllSpice-API wrapper in Python
MIT License
0 stars 0 forks source link

Add profiling to py-gitea #12

Open danielallspice opened 1 year ago

danielallspice commented 1 year ago

Add some ability for end-users to "turn-on" profiling and see what parts of their code is slowing things down.

shrik450 commented 1 year ago

I was thinking about this earlier, and given that this is an API client, the best way to do this IMO would be request logging. For example, if a user calls:

Repository.request(client, "test", "test")

The library would log:

[Mon Jul 10 14:13:53] Received 200 OK from https://hub.allspice.io/api/v1/repos/test/test in 200ms

This would help the user see what requests their script is making, how long each is taking, and therefore investigate what they could do to minimize the time spent. This would be better than a "general" profiling system since py-allspice is IO bound, and the rest of the profile would just be noise.