Collect reductions per process.
[beam_stats.git] / src / beam_stats_msg_graphite.erl
index bb89320..6939653 100644 (file)
@@ -136,8 +136,9 @@ of_memory(Memory, <<NodeID/binary>>, Timestamp) ->
     [t()].
 of_ets(PerTableStats, <<NodeID/binary>>, Timestamp) ->
     OfEtsTable = fun (Table) -> of_ets_table(Table, NodeID, Timestamp) end,
-    NestedMsgs = lists:map(OfEtsTable, PerTableStats),
-    lists:append(NestedMsgs).
+    MsgsNested = lists:map(OfEtsTable, PerTableStats),
+    MsgsFlattened = lists:append(MsgsNested),
+    aggregate_by_path(MsgsFlattened, Timestamp).
 
 -spec of_ets_table(beam_stats_ets_table:t(), binary(), erlang:timestamp()) ->
     [t()].
@@ -150,9 +151,13 @@ of_ets_table(#beam_stats_ets_table
     <<NodeID/binary>>,
     Timestamp
 ) ->
-    IDBin     = beam_stats_ets_table:id_to_bin(ID),
+    IDType =
+        case ID =:= Name
+        of  true  -> <<"NAMED">>
+        ;   false -> <<"TID">>
+        end,
     NameBin   = atom_to_binary(Name, latin1),
-    NameAndID = [NameBin, IDBin],
+    NameAndID = [NameBin, IDType],
     [ cons([NodeID, <<"ets_table">>, <<"size">>   | NameAndID], Size  , Timestamp)
     , cons([NodeID, <<"ets_table">>, <<"memory">> | NameAndID], Memory, Timestamp)
     ].
@@ -200,6 +205,7 @@ of_process(
     , total_heap_size   = TotalHeapSize
     , stack_size        = StackSize
     , message_queue_len = MsgQueueLen
+    , reductions        = Reductions
     }=Process,
     <<NodeID/binary>>,
     Timestamp
@@ -212,6 +218,7 @@ of_process(
     , cons([N, <<"process_total_heap_size">>   , OriginBin], TotalHeapSize , Ts)
     , cons([N, <<"process_stack_size">>        , OriginBin], StackSize     , Ts)
     , cons([N, <<"process_message_queue_len">> , OriginBin], MsgQueueLen   , Ts)
+    , cons([N, <<"process_reductions">>        , OriginBin], Reductions    , Ts)
     ].
 
 -spec aggregate_by_path([t()], erlang:timestamp()) ->
This page took 0.029911 seconds and 4 git commands to generate.