Add tag support for all published metrics
This request aims to provide the option to tag all published metrics with support for the Influx/Graphite/DOG statsd
formats, with tags being set using the RECC_METRICS_TAG_[key]=value
mapping, and the statsd format set with RECC_STATSD_FORMAT
.
For example, an action cache hit, using RECC_STATSD_FORMAT=influx
and RECC_METRICS_TAG_FOO=bar
would generate the metric: recc.action_cache_hit,foo=bar:1|c
.
And if RECC_STATSD_FORMAT=graphite
, it would output: recc.action_cache_hit;foo=bar:1|c
If no tag
or statsd format
is provided, the metric defaults to the no tagging format: recc.action_cache_hit:1|c
For multiple tags, such as RECC_METRICS_TAG_FOO=bar and RECC_METRICS_TAG_BAZ=zoo, the output metrics would be:
recc.action_cache_hit,baz=zoo,foo=bar:1|c [INFLUX]
recc.action_cache_hit;baz=zoo,foo=bar:1|c [GRAPHITE]
recc.action_cache_hit:1|c|#baz=zoo,foo=bar [DOG]
The implementation was tested locally with a buildgrid server (tox -e server), a bot (tox -e bot -- host-tools), and recc running a simple command like (./bin/recc /usr/bin/gcc -o hello.o -c hello.c). Using a recc.conf
with the following parameters set accordingly:
enable_metrics=1
statsd_format=influx
metrics_tag_foo=bar
metrics_tag_baz=zoo
skip_cache=1