nickva commented on code in PR #6065:
URL: https://github.com/apache/couchdb/pull/6065#discussion_r3572555988


##########
src/couch_prometheus/src/couch_prometheus.erl:
##########
@@ -418,26 +418,44 @@ get_database_count() ->
 
 get_ioq_stats() ->
     IOQData = ioq:get_disk_queues(),
-    Compaction = couch_util:get_value(compaction, IOQData, 0),
-    Low = couch_util:get_value(low, IOQData, 0),
-    Replication = couch_util:get_value(replication, IOQData, 0),
-    ChannelsList = couch_util:get_value(channels, IOQData, []),
-    Channels =
-        case ChannelsList of
-            {List} when is_list(List) -> List;
-            _ -> []
-        end,
-    NumChannels = length(Channels),
-    ChannelRequests = count_channel_requests(Channels),
-    TotalRequests = ChannelRequests + Compaction + Low + Replication,
-    [
-        to_prom(ioq_active_channels, gauge, "IOQ active channels", 
NumChannels),
-        to_prom(ioq_compaction_requests, gauge, "IOQ compaction queue 
requests", Compaction),
-        to_prom(ioq_low_requests, gauge, "IOQ low priority queue requests", 
Low),
-        to_prom(ioq_replication_requests, gauge, "IOQ replication queue 
requests", Replication),
-        to_prom(ioq_channel_requests, gauge, "IOQ channel requests", 
ChannelRequests),
-        to_prom(ioq_total_requests, gauge, "IOQ total active requests", 
TotalRequests)
-    ].
+    case IOQData of

Review Comment:
   Oops, I hadn't realized they actually return different data types maps vs kv 
lists. Instead of having to add handlers for both on every call let's instead 
make `get_disk_queues()` return a kv list.  It would be as simple as passing it 
through `maps:to_list(Map)`. For example:
   
   ```erlang
   > maps:to_list(#{a=>1}).
   [{a,1}]
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to