[Asterisk-code-review] res chan stats: Fix bug to send correct statistics to StatsD (asterisk[master])

Tyler Cambron asteriskteam at digium.com
Wed Dec 9 10:38:29 CST 2015


Tyler Cambron has uploaded a new change for review.

  https://gerrit.asterisk.org/1792

Change subject: res_chan_stats: Fix bug to send correct statistics to StatsD
......................................................................

res_chan_stats: Fix bug to send correct statistics to StatsD

Fixed a bug that was originally would show a negative number of
active calls occuring in Asterisk. A guage is persistent so
incrementing and decrementing it would result in a much more
consistent performance. Also changed to the call to StatsD to use
ast_statsd_log_string() so that a "+" could be sent to StatsD.

ASTERISK-25619

Change-Id: Iaaeff5c4c6a46535366b4d16ea0ed0ee75ab2ee7
---
M res/res_chan_stats.c
1 file changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/92/1792/1

diff --git a/res/res_chan_stats.c b/res/res_chan_stats.c
index 8b188dc..dfca39a 100644
--- a/res/res_chan_stats.c
+++ b/res/res_chan_stats.c
@@ -111,7 +111,7 @@
 
 	if (!update->old_snapshot && update->new_snapshot) {
 		/* Initial cache entry; count a channel creation */
-		ast_statsd_log("channels.count", AST_STATSD_COUNTER, 1);
+		ast_statsd_log_string("channels.count", AST_STATSD_GAUGE, "+1", 1.0);
 	} else if (update->old_snapshot && !update->new_snapshot) {
 		/* Cache entry removed. Compute the age of the channel and post
 		 * that, as well as decrementing the channel count.
@@ -125,7 +125,7 @@
 		ast_statsd_log("channels.calltime", AST_STATSD_TIMER, age);
 
 		/* And decrement the channel count */
-		ast_statsd_log("channels.count", AST_STATSD_COUNTER, -1);
+		ast_statsd_log_string("channels.count", AST_STATSD_GAUGE, "-1", 1.0);
 	}
 }
 

-- 
To view, visit https://gerrit.asterisk.org/1792
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iaaeff5c4c6a46535366b4d16ea0ed0ee75ab2ee7
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Tyler Cambron <tcambron at digium.com>



More information about the asterisk-code-review mailing list