summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2010-09-13 11:05:02 +0100
committerSimon MacMullen <simon@rabbitmq.com>2010-09-13 11:05:02 +0100
commitaa067e39b4339bd3d3feac49c81a6f7ebf24e2bf (patch)
tree16693ccd530cd70f7944dda57dd700113798d611
parent518b808b0ad0d14abf1250907c04de653c0d2bfc (diff)
downloadrabbitmq-server-aa067e39b4339bd3d3feac49c81a6f7ebf24e2bf.tar.gz
Only emit stats if level != none.
-rw-r--r--src/rabbit_amqqueue_process.erl8
-rw-r--r--src/rabbit_channel.erl8
-rw-r--r--src/rabbit_reader.erl8
3 files changed, 18 insertions, 6 deletions
diff --git a/src/rabbit_amqqueue_process.erl b/src/rabbit_amqqueue_process.erl
index 63c0b7ac..d07aa99e 100644
--- a/src/rabbit_amqqueue_process.erl
+++ b/src/rabbit_amqqueue_process.erl
@@ -152,7 +152,8 @@ init_expires(State = #q{q = #amqqueue{arguments = Arguments}}) ->
declare(Recover, From,
State = #q{q = Q = #amqqueue{name = QName, durable = IsDurable},
- backing_queue = BQ, backing_queue_state = undefined}) ->
+ backing_queue = BQ, backing_queue_state = undefined,
+ stats_timer = StatsTimer}) ->
case rabbit_amqqueue:internal_declare(Q, Recover) of
not_found -> {stop, normal, not_found, State};
Q -> gen_server2:reply(From, {new, Q}),
@@ -166,7 +167,10 @@ declare(Recover, From,
State1 = init_expires(State#q{backing_queue_state = BQS}),
rabbit_event:notify(queue_created,
infos(?CREATION_EVENT_KEYS, State1)),
- emit_stats(State1),
+ case rabbit_event:stats_level(StatsTimer) of
+ none -> ok;
+ _ -> emit_stats(State1)
+ end,
noreply(State1);
Q1 -> {stop, normal, {existing, Q1}, State}
end.
diff --git a/src/rabbit_channel.erl b/src/rabbit_channel.erl
index 19d85589..d518e59b 100644
--- a/src/rabbit_channel.erl
+++ b/src/rabbit_channel.erl
@@ -157,6 +157,7 @@ init([Channel, ReaderPid, WriterPid, Username, VHost, CollectorPid,
StartLimiterFun]) ->
process_flag(trap_exit, true),
ok = pg_local:join(rabbit_channels, self()),
+ StatsTimer = rabbit_event:init_stats_timer(),
State = #ch{state = starting,
channel = Channel,
reader_pid = ReaderPid,
@@ -174,9 +175,12 @@ init([Channel, ReaderPid, WriterPid, Username, VHost, CollectorPid,
consumer_mapping = dict:new(),
blocking = dict:new(),
queue_collector_pid = CollectorPid,
- stats_timer = rabbit_event:init_stats_timer()},
+ stats_timer = StatsTimer},
rabbit_event:notify(channel_created, infos(?CREATION_EVENT_KEYS, State)),
- internal_emit_stats(State),
+ case rabbit_event:stats_level(StatsTimer) of
+ none -> ok;
+ _ -> internal_emit_stats(State)
+ end,
{ok, State, hibernate,
{backoff, ?HIBERNATE_AFTER_MIN, ?HIBERNATE_AFTER_MIN, ?DESIRED_HIBERNATE}}.
diff --git a/src/rabbit_reader.erl b/src/rabbit_reader.erl
index 0ddc60e8..795a2a92 100644
--- a/src/rabbit_reader.erl
+++ b/src/rabbit_reader.erl
@@ -765,7 +765,8 @@ handle_method0(#'connection.open'{virtual_host = VHostPath},
connection = Connection = #connection{
user = User,
protocol = Protocol},
- sock = Sock}) ->
+ sock = Sock,
+ stats_timer = StatsTimer}) ->
ok = rabbit_access_control:check_vhost_access(User, VHostPath),
NewConnection = Connection#connection{vhost = VHostPath},
ok = send_on_channel0(Sock, #'connection.open_ok'{}, Protocol),
@@ -775,7 +776,10 @@ handle_method0(#'connection.open'{virtual_host = VHostPath},
connection = NewConnection}),
rabbit_event:notify(connection_created,
infos(?CREATION_EVENT_KEYS, State1)),
- internal_emit_stats(State1),
+ case rabbit_event:stats_level(StatsTimer) of
+ none -> ok;
+ _ -> internal_emit_stats(State1)
+ end,
State1;
handle_method0(#'connection.close'{}, State) when ?IS_RUNNING(State) ->
lists:foreach(fun rabbit_framing_channel:shutdown/1, all_channels()),