Skip to content

Commit

Permalink
Fix crash in memory metric calculations (#257)
Browse files Browse the repository at this point in the history
  • Loading branch information
TimPansino authored Jun 29, 2021
1 parent d40ff60 commit 697a326
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions newrelic/samplers/memory_usage.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@

@data_source_generator(name="Memory Usage")
def memory_usage_data_source():
yield ("Memory/Physical", physical_memory_used())
yield ("Memory/Physical/%d" % (PID), physical_memory_used())

yield (
"Memory/Physical/Utilization",
physical_memory_used() / total_physical_memory(),
)
yield (
"Memory/Physical/Utilization/%d" % (PID),
physical_memory_used() / total_physical_memory(),
memory = physical_memory_used()
total_memory = total_physical_memory()
memory_utilization = (
(memory / total_memory) if None not in (memory, total_memory) else None
)

yield ("Memory/Physical", memory)
yield ("Memory/Physical/%d" % (PID), memory)

yield ("Memory/Physical/Utilization", memory_utilization)
yield ("Memory/Physical/Utilization/%d" % (PID), memory_utilization)

0 comments on commit 697a326

Please sign in to comment.