File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change 2121from newrelic .common .system_info import physical_memory_used , total_physical_memory
2222from newrelic .samplers .decorators import data_source_generator
2323
24- PID = os .getpid ()
25-
2624
2725@data_source_generator (name = "Memory Usage" )
2826def memory_usage_data_source ():
2927 memory = physical_memory_used ()
3028 total_memory = total_physical_memory ()
29+ pid = os .getpid ()
3130
3231 # Calculate memory utilization without 0 division errors
3332 memory_utilization = (memory / total_memory ) if total_memory != 0 else 0
3433
3534 yield ("Memory/Physical" , memory )
36- yield ("Memory/Physical/%d" % (PID ), memory )
35+ yield ("Memory/Physical/%d" % (pid ), memory )
3736
3837 yield ("Memory/Physical/Utilization" , memory_utilization )
39- yield ("Memory/Physical/Utilization/%d" % (PID ), memory_utilization )
38+ yield ("Memory/Physical/Utilization/%d" % (pid ), memory_utilization )
You can’t perform that action at this time.
0 commit comments