diff options
| author | Arnaud Cogoluègnes <acogoluegnes@gmail.com> | 2019-01-15 15:17:10 +0100 |
|---|---|---|
| committer | Arnaud Cogoluègnes <acogoluegnes@gmail.com> | 2019-01-15 15:17:10 +0100 |
| commit | 4b02cc51d510cce9738d580115fb65f3e01489d9 (patch) | |
| tree | e29232b38b3eb48b4a9fe608086322aa1434a8ec /deps/rabbitmq_management_agent | |
| parent | 04ddec2d59e12c340696db327774cca8697f1020 (diff) | |
| download | rabbitmq-server-git-4b02cc51d510cce9738d580115fb65f3e01489d9.tar.gz | |
Add single active consumer flag in consumer metrics
[#163089472]
References rabbitmq/rabbitmq-management#649
Diffstat (limited to 'deps/rabbitmq_management_agent')
| -rw-r--r-- | deps/rabbitmq_management_agent/src/rabbit_mgmt_metrics_collector.erl | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/deps/rabbitmq_management_agent/src/rabbit_mgmt_metrics_collector.erl b/deps/rabbitmq_management_agent/src/rabbit_mgmt_metrics_collector.erl index 0f89fe59f2..b21eb6e54a 100644 --- a/deps/rabbitmq_management_agent/src/rabbit_mgmt_metrics_collector.erl +++ b/deps/rabbitmq_management_agent/src/rabbit_mgmt_metrics_collector.erl @@ -11,7 +11,7 @@ %% The Original Code is RabbitMQ. %% %% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2017 Pivotal Software, Inc. All rights reserved. +%% Copyright (c) 2007-2019 Pivotal Software, Inc. All rights reserved. %% -module(rabbit_mgmt_metrics_collector). @@ -403,7 +403,7 @@ aggregate_entry({Id, Reductions}, NextStats, Ops0, Ops = insert_entry_ops(channel_process_stats, Id, false, Entry, Ops0, BPolicies), {NextStats, Ops, State}; -aggregate_entry({Id, Exclusive, AckRequired, PrefetchCount, Args}, +aggregate_entry({Id, Exclusive, AckRequired, PrefetchCount, SingleActive, Args}, NextStats, Ops0, #state{table = consumer_created} = State) -> case ets:lookup(consumer_stats, Id) of @@ -411,10 +411,27 @@ aggregate_entry({Id, Exclusive, AckRequired, PrefetchCount, Args}, Fmt = rabbit_mgmt_format:format([{exclusive, Exclusive}, {ack_required, AckRequired}, {prefetch_count, PrefetchCount}, + {single_active, SingleActive}, {arguments, Args}], {[], false}), Entry = ?consumer_stats(Id, Fmt), Ops = insert_with_index_op(consumer_stats, Id, Entry, Ops0), - {NextStats, Ops ,State}; + {NextStats, Ops , State}; + [{_K, V}] -> + % consumer updated only when promoted to single active consumer + CurrentSingleActive = proplists:get_value(single_active, V, undefined), + case {SingleActive, CurrentSingleActive} of + {true, false} -> + Fmt = rabbit_mgmt_format:format([{exclusive, Exclusive}, + {ack_required, AckRequired}, + {prefetch_count, PrefetchCount}, + {single_active, SingleActive}, + {arguments, Args}], {[], false}), + Entry = ?consumer_stats(Id, Fmt), + Ops = insert_with_index_op(consumer_stats, Id, Entry, Ops0), + {NextStats, Ops , State}; + _ -> + {NextStats, Ops0, State} + end; _ -> {NextStats, Ops0, State} end; |
