UKHomeOffice / docker-nginx-proxy

A generic WAF proxy layer
MIT License
64 stars 37 forks source link

Statsd Connection send() error #124

Closed gambol99 closed 3 years ago

gambol99 commented 5 years ago

So adding STATSD_METRICS_ENABLED should have fixed it .. but they were still getting a connection send() error to statsd ...

2019/02/19 10:30:12 [error] 57#0: send() failed (111: Connection refused)

Dropping it into the container,

$ set | grep STATSD_METRICS_ENABLED
STATSD_METRICS_ENABLED=FALSE
$ tail -n 5 /go.sh
if [ "${STATSD_METRICS_ENABLED}" = "TRUE" ]; then
    msg "Setting up statsd configuration with server ${STATSD_SERVER}"
    echo "statsd_server ${STATSD_SERVER};" > ${NGIX_CONF_DIR}/nginx_statsd_server.conf
    echo "statsd_count \"waf.status.\$status\" 1;" > ${NGIX_CONF_DIR}/nginx_statsd_metrics.conf
fi
# so technically this should be disabled ...
but I see the statds service being created in the logs: $ kubectl logs <pod> | head -n 10 
...
SETUP:Adding extra config for server context.
SETUP:Setting up statsd configuration with server 127.0.0.1
..

Looking onto the docker entrypoint
$ head /go.sh 
#!/usr/bin/env bash
set -e
export LOG_UUID=FALSE
. /defaults.sh <--- suspicions
$ grep STATSD_METRICS_ENABLED /defaults.sh 
export STATSD_METRICS_ENABLED=${STATSD_METRICS:-'TRUE'}

# somewhat crap, but looks like the environment variable is already overwritten ..

To test, i change the environment variable from STATSD_METRICS_ENABLED -> STATSD_METRICS: False. And the Connection: send() is removed.