[Asterisk-code-review] res_prometheus: Add Asterisk channel metrics (...asterisk[master])

Matt Jordan asteriskteam at digium.com
Tue May 21 09:25:46 CDT 2019


Matt Jordan has posted comments on this change. ( https://gerrit.asterisk.org/c/asterisk/+/11351 )

Change subject: res_prometheus: Add Asterisk channel metrics
......................................................................


Patch Set 4:

(1 comment)

> Patch Set 4: Code-Review+1
> 
> (1 comment)

https://gerrit.asterisk.org/#/c/11351/4/res/prometheus/channels.c 
File res/prometheus/channels.c:

https://gerrit.asterisk.org/#/c/11351/4/res/prometheus/channels.c@174 
PS4, Line 174: 
> Can you reverse the order of these "for" loops so you don't have to traverse the potentially large c […]
Thinking through this (I'm finding I have to type this to think through what the suggestion will do...)

Right now, we have a large array of metrics, where each grouping of metrics are contiguous within the array. Each group maintains a linked list between the related metrics within the family, making it look something like this:

[ metric_1_channel_1 | metric_1_channel_2 | metric_2_channel_1 | metric_2_channel_2 ]
      root ---------------> child                root ----------------> child

Because printing a metric walks all the children, we have to 'skip' through the array, which we do based on the metric families:

[ metric_1_channel_1 | metric_1_channel_2 | metric_2_channel_1 | metric_2_channel_2 ]
          ^                                         ^
        print                                     print

If we re-order it per your suggestion, that will do the following:

[ metric_1_channel_1 | metric_2_channel_1 | metric_1_channel_2 | metric_2_channel_2 ]
      root -------------------------------------> child
                            root ------------------------------------> child

For some reason I find that a bit harder to keep in my head when I'm thinking about it, but the code is probably just as clean as what exists today.

Printing it should be easy: just walk the first _n_ elements, where _n_ is the number of metrics.

I think this is doable.



-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/11351
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: I0db306ec94205d4f58d1e7fbabfe04b185869f59
Gerrit-Change-Number: 11351
Gerrit-PatchSet: 4
Gerrit-Owner: Matt Jordan <mjordan at digium.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>
Gerrit-Comment-Date: Tue, 21 May 2019 14:25:46 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: George Joseph <gjoseph at digium.com>
Gerrit-MessageType: comment
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190521/48dda376/attachment-0001.html>


More information about the asterisk-code-review mailing list