[prev in list] [next in list] [prev in thread] [next in thread]
List: serdev
Subject: Re: [sr-dev] Kamailio module statsd
From: Daniel-Constantin Mierla <miconda () gmail ! com>
Date: 2014-11-27 22:36:23
Message-ID: 5477A767.1090903 () gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
Hello,
given that the module is providing the connector from kamailio.cfg to
statsd, it indeed is fine from this point of view -- no new
stats/counters being defined inside the module.
Overall the module is ok, before pushing it to official repository, few
things have to be taken care of.
Important:
- the README in the module directory must be the one generated from the
xml doc, right now is the markdown version of an install guide for the
module being hosted out of kamailio repo, which will become irrelevant
once included there
- the stats.txt from doc subfolder should not be added
- README file can be generated with: make modules-readme
modules=modules/statsd (you can add nocatalog=yes if stucks when trying
to generate on mac os x)
Can be dealt after the import:
- variables must be declared at the beginning of functions (or blocks)
-- it ensures the compatibility with old or strict C standard
- add IDs to the xml docbook sections for functions and parameters to
have proper alphabetic indexing - guidelines here:
http://kamailio.org/wiki/devel/module-docbook-readme#section_ids
- a long integer is printed in a 20 byte buffer, being signed and zero
terminated, can end up with 21 bytes - not the case of such value (time
being printed at least as I could see), but it is better to be safe
- use snprintf() instead of sprintf() when printing the statsd commands
to ensure that it doesn't exceed the declared buffer size -- as I could
spot, key can be given as parameter, with no restriction on lenght
Since we are here, a wish list for the future:
- add option to push an internal stats/counter value to statsd on demand
from config by giving the stats name as parameter and eventually on a
timer task based on a module parameter listing the names of the stats to
be pushed
- make the functions to take parameters with variables -- should be easy
by looking at other modules that export functions accepting variables
Cheers,
Daniel
On 24/11/14 11:54, Eloy Coto Pereiro wrote:
> Hi,
>
> Thanks for your replies.
>
> - About the doc, it's in xml, but I copied plaintext file. [0]
> - Yes, but in this case the counter is not stored by kamailio. Counter
> is a datatype into statsd [1]. BTW: I didn't use snmpagent in the
> last year, I will have a look to check if exist any best way.
>
> [0]
> https://raw.githubusercontent.com/eloycoto/statsd/master/doc/statsd.xml
> [1] https://github.com/etsy/statsd/blob/master/docs/metric_types.md
>
> Regards
>
> 2014-11-23 10:07 GMT+00:00 Olle E. Johansson <oej@edvina.net
> <mailto:oej@edvina.net>>:
>
> Great stuff! Very useful functions.
>
> Some notes:
> - The documentation needs to be in xml format, not a text file
>
> - we already have to modules handling one set of counters/stats
> objects in the core. Maybe you should look into
> using those counters instead of adding a new set. These counters
> are also exposed in kamcmd and some in
> snmpagent automatically, so you gain a lot by using them.
>
> - I wonder if this module should be focused on the connection to
> statsd and the timing functions
> should be somewhere else. I can't point to where now...
>
> /O
>
> On 21 Nov 2014, at 21:26, Daniel-Constantin Mierla
> <miconda@gmail.com <mailto:miconda@gmail.com>> wrote:
>
> > Hello,
> >
> > thanks for the contribution, we will grant you git access to push
> > the module in the official repository. I will send you another
> > email asking the afferent details.
> >
> > Meanwhile I will do a bit of a review just in case some exiting
> > parts worth to be re-used.
> >
> > Cheers,
> > Daniel
> >
> > On 19/11/14 21:08, Eloy Coto Pereiro wrote:
> > > Hi all Kamailio developers,
> > >
> > > I would like to propose a new module that I've written recently, that provide \
> > > native integration with statsd[0]/graphite[1].
> > > The module provides the ability to send information to statsd (You can use \
> > > InfluxDB too) with different kind of information. I wrote small post in my \
> > > blog[2] and doc are in the repo [3].
> > > The typical scenario for this module is for monitoring features into kamailio. \
> > > For example:
> > > - Monitor how long we need to reply a new request.
> > > - Store how many errors send our providers.
> > > - Check how long take one sqlquery.
> > > - Check how many times are using the new feature
> > >
> > > Nowadays we[4]are using kamailio-statsd and we track in simple dashboard[5][6] \
> > > all information that we get from kamailio, and other software (Asterisk, Django \
> > > Backend, Diamond[7]) and we have in simple click all the information that we \
> > > want.
> > > The module doesn't have any special deps, it's a simple socket that connect to \
> > > Graphite. For timing function I'm using avp to set init_time.
> > > I hope that this contribution could be useful for the community and I look \
> > > forward to hearing your feedback, thoughts, suggestions.
> > > Best regards,
> > > Eloy Coto.
> > >
> > > [0] https://github.com/etsy/statsd/
> > > [1] http://graphite.wikidot.com/
> > > [2] http://acalustra.com/kamailio-statsd-better-statistics-in-your-voip-platform.html
> > > [3] https://github.com/eloycoto/statsd
> > > [4] http://www.foehn.co.uk <http://www.foehn.co.uk/>
> > > [5] http://grafana.org <http://grafana.org/>
> > > [6] http://play.grafana.org/#/dashboard/db/new-features-in-v19
> > > [7] https://github.com/BrightcoveOS/Diamond
> > >
> > >
> > > _______________________________________________
> > > sr-dev mailing list
> > > sr-dev@lists.sip-router.org <mailto:sr-dev@lists.sip-router.org>
> > > http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
> >
> > --
> > Daniel-Constantin Mierla
> > http://twitter.com/#!/miconda <http://twitter.com/#%21/miconda> - \
> > http://www.linkedin.com/in/miconda \
> > _______________________________________________ sr-dev mailing list
> > sr-dev@lists.sip-router.org <mailto:sr-dev@lists.sip-router.org>
> > http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
>
>
--
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
[Attachment #5 (text/html)]
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hello,<br>
<br>
given that the module is providing the connector from kamailio.cfg
to statsd, it indeed is fine from this point of view -- no new
stats/counters being defined inside the module.<br>
<br>
Overall the module is ok, before pushing it to official repository,
few things have to be taken care of.<br>
<br>
Important:<br>
- the README in the module directory must be the one generated from
the xml doc, right now is the markdown version of an install guide
for the module being hosted out of kamailio repo, which will become
irrelevant once included there<br>
- the stats.txt from doc subfolder should not be added<br>
- README file can be generated with: make modules-readme
modules=modules/statsd (you can add nocatalog=yes if stucks when
trying to generate on mac os x)<br>
<br>
Can be dealt after the import:<br>
- variables must be declared at the beginning of functions (or
blocks) -- it ensures the compatibility with old or strict C
standard<br>
- add IDs to the xml docbook sections for functions and parameters
to have proper alphabetic indexing - guidelines here:
<a class="moz-txt-link-freetext" \
href="http://kamailio.org/wiki/devel/module-docbook-readme#section_ids">http://kamailio.org/wiki/devel/module-docbook-readme#section_ids</a><br>
- a long integer is printed in a 20 byte buffer, being signed and
zero terminated, can end up with 21 bytes - not the case of such
value (time being printed at least as I could see), but it is better
to be safe<br>
- use snprintf() instead of sprintf() when printing the statsd
commands to ensure that it doesn't exceed the declared buffer size
-- as I could spot, key can be given as parameter, with no
restriction on lenght<br>
<br>
Since we are here, a wish list for the future:<br>
- add option to push an internal stats/counter value to statsd on
demand from config by giving the stats name as parameter and
eventually on a timer task based on a module parameter listing the
names of the stats to be pushed<br>
- make the functions to take parameters with variables -- should be
easy by looking at other modules that export functions accepting
variables<br>
<br>
Cheers,<br>
Daniel<br>
<br>
<br>
<div class="moz-cite-prefix">On 24/11/14 11:54, Eloy Coto Pereiro
wrote:<br>
</div>
<blockquote
cite="mid:CAFZDoUDwHqeRPVp=Yhw+sQddHt6ev+HPHZETOH65V5hPBYXMVw@mail.gmail.com"
type="cite">
<div dir="ltr">
<div>Hi,<br>
<br>
Thanks for your replies. <br>
<br>
- About the doc, it's in xml, but I copied plaintext file. [0]<br>
- Yes, but in this case the counter is not stored by kamailio.
Counter is a datatype into statsd [1]. BTW: I didn't use
snmpagent in the last year, I will have a look to check if
exist any best way.<br>
<br>
[0] <a moz-do-not-send="true"
href="https://raw.githubusercontent.com/eloycoto/statsd/master/doc/statsd.xml">https://raw.githubusercontent.com/eloycoto/statsd/master/doc/statsd.xml</a><br>
[1] <a moz-do-not-send="true"
href="https://github.com/etsy/statsd/blob/master/docs/metric_types.md">https://github.com/etsy/statsd/blob/master/docs/metric_types.md</a><br>
<br>
</div>
<div>Regards<br>
</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">2014-11-23 10:07 GMT+00:00 Olle E.
Johansson <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:oej@edvina.net" \
target="_blank">oej@edvina.net</a>></span>:<br> <blockquote class="gmail_quote" \
style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word">
<div>Great stuff! Very useful functions.</div>
<div><br>
</div>
Some notes:
<div>- The documentation needs to be in xml format, not a
text file</div>
<div><br>
</div>
<div>- we already have to modules handling one set of
counters/stats objects in the core. Maybe you should
look into</div>
<div> using those counters instead of adding a new set.
These counters are also exposed in kamcmd and some in</div>
<div> snmpagent automatically, so you gain a lot by using
them.</div>
<div><br>
</div>
<div>- I wonder if this module should be focused on the
connection to statsd and the timing functions</div>
<div> should be somewhere else. I can't point to where
now... </div>
<span class="HOEnZb"><font color="#888888">
<div><br>
</div>
<div>/O</div>
</font></span>
<div>
<div class="h5">
<div><br>
<div>
<div>On 21 Nov 2014, at 21:26, Daniel-Constantin
Mierla <<a moz-do-not-send="true"
href="mailto:miconda@gmail.com"
target="_blank">miconda@gmail.com</a>>
wrote:</div>
<br>
<blockquote type="cite">
<div bgcolor="#FFFFFF" text="#000000"> Hello,<br>
<br>
thanks for the contribution, we will grant you
git access to push the module in the official
repository. I will send you another email
asking the afferent details.<br>
<br>
Meanwhile I will do a bit of a review just in
case some exiting parts worth to be re-used.<br>
<br>
Cheers,<br>
Daniel<br>
<br>
<div>On 19/11/14 21:08, Eloy Coto Pereiro
wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<pre>Hi all Kamailio developers,
I would like to propose a new module that I've written recently, that provide native \
integration with statsd[0]/graphite[1].
The module provides the ability to send information to statsd (You can use InfluxDB \
too) with different kind of information. I wrote small post in my blog[2] and doc are \
in the repo [3].
The typical scenario for this module is for monitoring features into kamailio. For \
example:
- Monitor how long we need to reply a new request.
- Store how many errors send our providers.
- Check how long take one sqlquery.
- Check how many times are using the new feature
Nowadays we[4]are using kamailio-statsd and we track in simple dashboard[5][6] all \
information that we get from kamailio, and other software (Asterisk, Django Backend, \
Diamond[7]) and we have in simple click all the information that we want.
The module doesn't have any special deps, it's a simple socket that connect to \
Graphite. For timing function I'm using avp to set init_time.
I hope that this contribution could be useful for the community and I look forward to \
hearing your feedback, thoughts, suggestions.
Best regards,
Eloy Coto.
[0] <a moz-do-not-send="true" href="https://github.com/etsy/statsd/" \
target="_blank">https://github.com/etsy/statsd/</a> [1] <a moz-do-not-send="true" \
href="http://graphite.wikidot.com/" target="_blank">http://graphite.wikidot.com/</a> \
[2] <a moz-do-not-send="true" \
href="http://acalustra.com/kamailio-statsd-better-statistics-in-your-voip-platform.html" \
target="_blank">http://acalustra.com/kamailio-statsd-better-statistics-in-your-voip-platform.html</a>
[3] <a moz-do-not-send="true" href="https://github.com/eloycoto/statsd" \
target="_blank">https://github.com/eloycoto/statsd</a> [4] <a moz-do-not-send="true" \
href="http://www.foehn.co.uk/" target="_blank">http://www.foehn.co.uk</a> [5] <a \
moz-do-not-send="true" href="http://grafana.org/" \
target="_blank">http://grafana.org</a> [6] <a moz-do-not-send="true" \
href="http://play.grafana.org/#/dashboard/db/new-features-in-v19" \
target="_blank">http://play.grafana.org/#/dashboard/db/new-features-in-v19</a> [7] <a \
moz-do-not-send="true" href="https://github.com/BrightcoveOS/Diamond" \
target="_blank">https://github.com/BrightcoveOS/Diamond</a></pre> </div>
<br>
<fieldset></fieldset>
<br>
<pre>_______________________________________________
sr-dev mailing list
<a moz-do-not-send="true" href="mailto:sr-dev@lists.sip-router.org" \
target="_blank">sr-dev@lists.sip-router.org</a> <a moz-do-not-send="true" \
href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev" \
target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev</a> \
</pre> </blockquote>
<br>
<pre cols="72">--
Daniel-Constantin Mierla
<a moz-do-not-send="true" href="http://twitter.com/#%21/miconda" \
target="_blank">http://twitter.com/#!/miconda</a> - <a moz-do-not-send="true" \
href="http://www.linkedin.com/in/miconda" \
target="_blank">http://www.linkedin.com/in/miconda</a></pre> </div>
_______________________________________________<br>
sr-dev mailing list<br>
<a moz-do-not-send="true"
href="mailto:sr-dev@lists.sip-router.org"
target="_blank">sr-dev@lists.sip-router.org</a><br>
<a moz-do-not-send="true"
\
href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev"
\
target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev</a><br> \
</blockquote> </div>
<br>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Daniel-Constantin Mierla
<a class="moz-txt-link-freetext" \
href="http://twitter.com/#!/miconda">http://twitter.com/#!/miconda</a> - <a \
class="moz-txt-link-freetext" \
href="http://www.linkedin.com/in/miconda">http://www.linkedin.com/in/miconda</a></pre>
</body>
</html>
_______________________________________________
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic