tom-draper / api-analytics

Lightweight monitoring and analytics for API frameworks.
https://apianalytics.dev
MIT License
194 stars 26 forks source link

Updating to version 1.2.3 causes significant performance issues #45

Open Snailedlt opened 2 months ago

Snailedlt commented 2 months ago

Recently a dependabot updating fastapi-analytics from 1.2.2 to 1.2.3 caused the API deployment to fail due to stability issues. The performance was also significantly slower than before for no apparant reason I could find.

Before:

image

After:

image

You'll find some more info in the dependabot PR here: https://github.com/Snailedlt/Markdown-Videos/pull/563

On a sidenote: Having release notes and a changelog would help in knowing which change(s) cause issues to occur. I'll make a separate issue about that though.

tom-draper commented 2 months ago

Ah interesting! The main difference with 1.2.3 is debug logging with the python logging module. Do you have your logging level set to debug with something like logging.basicConfig(level=logging.DEBUG)? Documentation pointed to a minimal impact on performance if the logging level is set below. I'll run some benchmarks and confirm the cause. Thanks again.

Snailedlt commented 2 months ago

Interesting. I haven't touched logging, so I have no idea what it's set to. Couldn't find anything in the source code when searching for logging

This is the only setup for fastapi-analytics afaik: https://github.com/Snailedlt/Markdown-Videos/blob/98013ff4e8f12cf95a61c9b0ff7cd2495c4c7078/apps/api/main.py#L36-L37

Feel free to check out the source code for more info though. It's all open source