Allow for statsd metrics to be prefixed

If multiple gunicorns are run in an infrastructure, it's necessary to namespace the resulting statsd metrics so the instrumentation generated by each instance can be evaluated.

This adds the `--statsd-prefix=""` option to gunicorn. By default the string is empty and does not change existing behavior. However, the prefix can be populated with any string, allowing for gunicorn metrics to be namespaced by host, environment, application, etc.

Typically, you'd want to set a prefix that ends in a `.` so the statsd metric is nested into the namespace, but this is not required.
Is there a reason it would ever not? As in, should we just add it if it's
missing?
On Sep 15, 2014 11:40 AM, "Alexis Lê-Quôc" <notifications@github.com> wrote:

> In gunicorn/config.py:
>
> > @@ -1649,3 +1649,14 @@ class StatsdHost(Setting):
> >      desc = """\
> >      host:port of the statsd server to log to
> >      """
> > +
> > +class StatsdPrefix(Setting):
> > +    name = "statsd_prefix"
> > +    section = "Logging"
> > +    cli = ["--statsd-prefix"]
> > +    meta = "STATSD_PREFIX"
> > +    default = ""
> > +    validator = validate_string
> > +    desc = """\
> > +    prefix to use when emitting statsd metrics
>
> I would recommend making clear that the prefix should end with a period.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/benoitc/gunicorn/pull/887/files#r17560564>.
>