diff options
| author | Michael Klishin <mklishin@pivotal.io> | 2019-04-24 17:55:43 +0300 |
|---|---|---|
| committer | Michael Klishin <mklishin@pivotal.io> | 2019-04-24 17:55:43 +0300 |
| commit | 07189e9d3802b9f586f49454e9511a28c2f6b54a (patch) | |
| tree | 39312b16b6611ca2f717e3bb014201ff8491602c /deps/rabbitmq_management_agent | |
| parent | bc0a41e22d0247cbaeea125825868be501793fd2 (diff) | |
| download | rabbitmq-server-git-07189e9d3802b9f586f49454e9511a28c2f6b54a.tar.gz | |
Hide drop_unroutable metric behind a feature flag
For mixed version cluster compatibility per
suggestion from @dumbbell.
Pair: @dcorbacho.
Part of rabbitmq/rabbitmq-server#1904.
[#165548314]
Diffstat (limited to 'deps/rabbitmq_management_agent')
3 files changed, 48 insertions, 3 deletions
diff --git a/deps/rabbitmq_management_agent/src/rabbit_mgmt_data.erl b/deps/rabbitmq_management_agent/src/rabbit_mgmt_data.erl index ca7a554d1b..bbeb6c57d6 100644 --- a/deps/rabbitmq_management_agent/src/rabbit_mgmt_data.erl +++ b/deps/rabbitmq_management_agent/src/rabbit_mgmt_data.erl @@ -377,6 +377,19 @@ lookup_all(Table, Ids, SecondKey) -> end. maybe_convert_for_compatibility(Table, Slide) + when Table =:= channel_stats_fine_stats orelse + Table =:= channel_exchange_stats_fine_stats orelse + Table =:= vhost_stats_fine_stats -> + ConversionNeeded = rabbit_feature_flags:is_disabled( + drop_unroutable_metric), + case ConversionNeeded of + false -> + Slide; + true -> + %% drop_drop because the metric is named "drop_unroutable" + rabbit_mgmt_data_compat:drop_drop_unroutable_metric(Slide) + end; +maybe_convert_for_compatibility(Table, Slide) when Table =:= channel_queue_stats_deliver_stats orelse Table =:= channel_stats_deliver_stats orelse Table =:= queue_stats_deliver_stats orelse 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 22ef01fbd9..850a2d1c02 100644 --- a/deps/rabbitmq_management_agent/src/rabbit_mgmt_data_compat.erl +++ b/deps/rabbitmq_management_agent/src/rabbit_mgmt_data_compat.erl @@ -26,8 +26,7 @@ fill_get_empty_queue_metric(Slide) -> (Value) when is_tuple(Value) andalso size(Value) =:= 8 -> Value; (Value) when is_tuple(Value) andalso size(Value) =:= 7 -> - %% We want to remote the last element, which is - %% the count of basic.get on empty queues. + %% Inject a 0 for the new metric list_to_tuple( tuple_to_list(Value) ++ [0]); (Value) -> @@ -38,7 +37,7 @@ drop_get_empty_queue_metric(Slide) -> exometer_slide:map( fun (Value) when is_tuple(Value) andalso size(Value) =:= 8 -> - %% We want to remote the last element, which is + %% We want to remove the last element, which is %% the count of basic.get on empty queues. list_to_tuple( lists:sublist( @@ -49,6 +48,33 @@ drop_get_empty_queue_metric(Slide) -> Value end, Slide). +fill_drop_unroutable_metric(Slide) -> + exometer_slide:map( + fun + (Value) when is_tuple(Value) andalso size(Value) =:= 4 -> + Value; + (Value) when is_tuple(Value) andalso size(Value) =:= 3 -> + %% Inject a 0 + list_to_tuple( + tuple_to_list(Value) ++ [0]); + (Value) -> + Value + end, Slide). + +drop_drop_unroutable_metric(Slide) -> + exometer_slide:map( + fun + (Value) when is_tuple(Value) andalso size(Value) =:= 4 -> + %% Remote the last element. + list_to_tuple( + lists:sublist( + tuple_to_list(Value), size(Value) - 1)); + (Value) when is_tuple(Value) andalso size(Value) =:= 3 -> + Value; + (Value) -> + Value + end, Slide). + fill_consumer_active_fields(ConsumersStats) -> [case proplists:get_value(active, ConsumerStats) of undefined -> diff --git a/deps/rabbitmq_management_agent/src/rabbit_mgmt_ff.erl b/deps/rabbitmq_management_agent/src/rabbit_mgmt_ff.erl index c1290b6095..46af69077a 100644 --- a/deps/rabbitmq_management_agent/src/rabbit_mgmt_ff.erl +++ b/deps/rabbitmq_management_agent/src/rabbit_mgmt_ff.erl @@ -21,3 +21,9 @@ #{desc => "Count AMQP `basic.get` on empty queues in stats", stability => stable }}). + +-rabbit_feature_flag( + {drop_unroutable_metric, + #{desc => "Count unroutable publishes to be dropped in stats", + stability => stable + }}). |
