Browse Source

Optimize code

zhouzb 6 years ago
parent
commit
790c729b1f
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/emqx_metrics.erl

+ 1 - 1
src/emqx_metrics.erl

@@ -363,7 +363,7 @@ init([]) ->
     % Store reserved indices
     % Store reserved indices
     lists:foreach(fun({Type, Name}) ->
     lists:foreach(fun({Type, Name}) ->
                           Idx = reserved_idx(Name),
                           Idx = reserved_idx(Name),
-                          Metric = #metric{name = Name, type = Type, idx = reserved_idx(Name)},
+                          Metric = #metric{name = Name, type = Type, idx = Idx},
                           true = ets:insert(?TAB, Metric),
                           true = ets:insert(?TAB, Metric),
                           ok = counters:put(CRef, Idx, 0)
                           ok = counters:put(CRef, Idx, 0)
                   end,?BYTES_METRICS ++ ?PACKET_METRICS ++ ?MESSAGE_METRICS ++ ?CHAN_METRICS ++ ?MQTT_METRICS),
                   end,?BYTES_METRICS ++ ?PACKET_METRICS ++ ?MESSAGE_METRICS ++ ?CHAN_METRICS ++ ?MQTT_METRICS),