newrelic-python-agent icon indicating copy to clipboard operation
newrelic-python-agent copied to clipboard

Memory usage is reported with wrong PID for forked processes

Open giladmaya opened this issue 3 years ago • 1 comments

Hi,

I've integrated newrelic agent into my gunicorn+flask application which uses preload hooks. All the metrics that are sent from my forked workers are sent under the PID of the main gunicorn process instead of their own id.

I believe the problem originates in here where PID is initialized when the modules are loaded on the main process, instead of getting the current PID https://github.com/newrelic/newrelic-python-agent/blob/905b82277fac1fd67940b2509333bf8ed3945bb2/newrelic/samplers/memory_usage.py#L24-L36

The values are correct and based on the current PID which is running the agent: https://github.com/newrelic/newrelic-python-agent/blob/905b82277fac1fd67940b2509333bf8ed3945bb2/newrelic/common/system_info.py#L279-L298

Can you please fix this issue? Thank you

giladmaya avatar Jun 13 '22 13:06 giladmaya

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Aug 13 '22 02:08 stale[bot]