In local development StatsD is raising `OSError: [WinError 10049] The requested address is not valid in its context` when env variable `STATSD_HOST` is not set. This seems to just be a Windows issue as the error suggests, because I can't get it to happen inside Docker.

This is happening because the default empty string of `settings.STATSD_HOST` gets set as the default host of `statsd.Connection`, and the empty string is not a valid host name in Windows.

https://github.com/PostHog/posthog/blob/1357df0c137e36478be19a1b8739dcdba93d2327/posthog/settings.py#L181
https://github.com/PostHog/posthog/blob/1ec12f26e707489e77077be029ddb79ceeefd944/posthog/celery.py#L35

StatsD sets the default `host` value to `'localhost'`, and restoring this default fixes the errors. I can make a PR tomorrow, but just wanted to check on this:
https://github.com/PostHog/posthog/blob/1357df0c137e36478be19a1b8739dcdba93d2327/posthog/settings.py#L217-L219

I can change it to `if os.environ.get("STATSD_HOST", False):`, but it might make more sense as a separate env variable like `STATSD_ENABLED`. My only concern with that is it's probably a breaking change. Are there any better options?



posthog/settings.py
if PRIMARY_DB == CLICKHOUSE:
    TEST_RUNNER = os.environ.get("TEST_RUNNER", "ee.clickhouse.clickhouse_test_runner.ClickhouseTestRunner")
else:
    TEST_RUNNER = os.environ.get("TEST_RUNNER", "django.test.runner.DiscoverRunner")
# IP block settings
ALLOWED_IP_BLOCKS = get_list(os.environ.get("ALLOWED_IP_BLOCKS", ""))
TRUSTED_PROXIES = os.environ.get("TRUSTED_PROXIES", False)
TRUST_ALL_PROXIES = os.environ.get("TRUST_ALL_PROXIES", False)
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
DEFAULT_SECRET_KEY = "<randomly generated secret key>"
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = os.environ.get("SECRET_KEY", DEFAULT_SECRET_KEY)
ALLOWED_HOSTS = get_list(os.environ.get("ALLOWED_HOSTS", "*"))
# Metrics - StatsD
STATSD_HOST = os.environ.get("STATSD_HOST", "")
STATSD_PORT = os.environ.get("STATSD_PORT", 8125)
STATSD_PREFIX = os.environ.get("STATSD_PREFIX", "")
# Application definition
INSTALLED_APPS = [
    "django.contrib.admin",
    "django.contrib.auth",
    "django.contrib.contenttypes",
    "django.contrib.sessions",
    "django.contrib.messages",
    "django.contrib.staticfiles",
    "posthog.apps.PostHogConfig",
    "rest_framework",
    "loginas",
    "corsheaders",