]> git.ipfire.org Git - thirdparty/asterisk.git/commit
res_statsd: Add functions that support variable arguments 52/1652/1
authorMatt Jordan <mjordan@digium.com>
Wed, 18 Nov 2015 16:05:07 +0000 (10:05 -0600)
committerMatt Jordan <mjordan@digium.com>
Wed, 18 Nov 2015 22:48:13 +0000 (16:48 -0600)
commit3354b325c67824b4aa052fb81693d28e792886a6
tree736eb29bfe70db91cb3397d884c7a04103d3a0ea
parent1e0040b88f83688e67d71521177cf4fa962bf32a
res_statsd: Add functions that support variable arguments

Often, the metric names of statistics we are generating for StatsD have some
dynamic component to them. This can be the name of a particular resource, or
some internal status label in Asterisk. With the current set of functions,
callers of the statsd API must first build the metric name themselves, then
pass this to the API functions. This results in a large amount of boilerplate
code and usage of either fixed length static buffers or dynamic memory
allocation, neither of which is desireable.

This patch adds two new functions to the StatsD API that support a printf
style format specifier for constructing the metric name. A dynamic string,
allocated in threadstorage, is used to build the metric name. This eases
the burden on users of the StatsD API.

Change-Id: If533c72d1afa26d807508ea48b4d8c7b32f414ea
include/asterisk/statsd.h
res/res_statsd.c