From 2201f35425218dec5751cd32506ff519b1e7dcea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-S=C3=A9bastien=20P=C3=A9dron?= Date: Mon, 4 Feb 2019 17:22:24 +0100 Subject: rabbit_mgmt_data_compat: New `fill_consumer_active_fields()` function ... to add the new `active` and `activity_status` fields in consumer stats if they are missing. This is the case for consumer stats returned by a RabbitMQ 3.7.x node. [#163298456] --- .../src/rabbit_mgmt_data_compat.erl | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'deps/rabbitmq_management_agent') diff --git a/deps/rabbitmq_management_agent/src/rabbit_mgmt_data_compat.erl b/deps/rabbitmq_management_agent/src/rabbit_mgmt_data_compat.erl index 9d48e1f336..ad610a5786 100644 --- a/deps/rabbitmq_management_agent/src/rabbit_mgmt_data_compat.erl +++ b/deps/rabbitmq_management_agent/src/rabbit_mgmt_data_compat.erl @@ -17,7 +17,8 @@ -module(rabbit_mgmt_data_compat). -export([fill_get_empty_queue_metric/1, - drop_get_empty_queue_metric/1]). + drop_get_empty_queue_metric/1, + fill_consumer_active_fields/1]). fill_get_empty_queue_metric(Slide) -> exometer_slide:map( @@ -47,3 +48,14 @@ drop_get_empty_queue_metric(Slide) -> (Value) -> Value end, Slide). + +fill_consumer_active_fields(ConsumersStats) -> + [case proplists:get_value(active, ConsumerStats) of + undefined -> + [{active, true}, + {activity_status, up} + | ConsumerStats]; + _ -> + ConsumerStats + end + || ConsumerStats <- ConsumersStats]. -- cgit v1.2.1