Repository: newrelic/elixir_agent (elixir)

Issue:
Process spawn count
Store the number of processes spawned during the request as an attribute on the Transaction event

Pull request description:
Track process spawn count
Simple PR that counts the number of processes involved in a Transaction

closes #75 

Patch:
diff --git a/lib/new_relic/transaction/reporter.ex b/lib/new_relic/transaction/reporter.ex
index 9fbc463..472a6b4 100644
--- a/lib/new_relic/transaction/reporter.ex
+++ b/lib/new_relic/transaction/reporter.ex
@@ -107,6 +107,8 @@ defmodule NewRelic.Transaction.Reporter do
         trace_process_spawns: {:list, {pid, timestamp, original}},
         trace_process_names: {:list, {pid, NewRelic.Util.process_name(pid)}}
       )
+
+      AttrStore.incr(__MODULE__, original, process_spawns: 1)
     end
   end
 


Test patch:
diff --git a/test/transaction_test.exs b/test/transaction_test.exs
index 490e6d6..af8d068 100644
--- a/test/transaction_test.exs
+++ b/test/transaction_test.exs
@@ -225,7 +225,7 @@ defmodule TransactionTest do
     assert Enum.find(events, fn [_, event] ->
              event[:path] == "/spawn" && event[:inside] == "spawned" && event[:nested] == "spawn" &&
                event[:not_linked] == "still_tracked" && event[:nested_inside] == "nolink" &&
-               event[:rabbit] == "hole" && event[:status] == 200
+               event[:rabbit] == "hole" && event[:process_spawns] == 5 && event[:status] == 200
            end)
   end