Ref #9 I've pulled across the implementation of memory profiling code from https://github.com/krmboya/dj-datadog and reworked the FDjangoDogMiddleware to be a bit more flexible in terms of metrics it can record.
I'm not 100% convinced how accurate the memory use metrics will be in a real world scenario - especially in the case of a django server running in something gunicorn (or other threaded or async frameworks), because the memory stats are taken from the process, but that process can be running multiple requests in parallel. However, for a basic setup where a single process services a single request, blocking end-to-end, the stats should be fairly reasonable.
Future work would be making the selection of stats to be recorded configurable, but for now it doesn't seem very pressing since there's only two and they're both 'cheap' to calculate.
@AlJohri is this broadly what you were looking for?
Ref #9 I've pulled across the implementation of memory profiling code from https://github.com/krmboya/dj-datadog and reworked the FDjangoDogMiddleware to be a bit more flexible in terms of metrics it can record.
I'm not 100% convinced how accurate the memory use metrics will be in a real world scenario - especially in the case of a django server running in something gunicorn (or other threaded or async frameworks), because the memory stats are taken from the process, but that process can be running multiple requests in parallel. However, for a basic setup where a single process services a single request, blocking end-to-end, the stats should be fairly reasonable.
Future work would be making the selection of stats to be recorded configurable, but for now it doesn't seem very pressing since there's only two and they're both 'cheap' to calculate.
@AlJohri is this broadly what you were looking for?