Closed kellanburket closed 2 years ago
Hi,
datadog.statsd
isn't an alias, it's an instance of the DogStatsd
class. AFAIK the statsd_host
setting works as expected:
>>> import datadog
>>> datadog.initialize(statsd_host="example.com")
>>> datadog.statsd.host
'example.com'
It's indeed not a requirement to pass them, but passing them should work.
There is another documentation page which gives you what you're looking for: https://docs.datadoghq.com/developers/dogstatsd/?tab=hostagent: If you use DogStatsD with the Container Agent or in Kubernetes, you must instantiate the host to which StatsD metrics are forwarded to with the $DD_DOGSTATSD_SOCKET environment variable if using a Unix Domain Socket, or with the $DD_AGENT_HOST environment variable if you are using the host port binding method.
.
According to the Dogstatsd documentation, Datadog needs to be initialized with
statsd_host
andstatsd_port
configuration. However, this isn't actually a requirement to submit metrics to statsd. Furthermore, theinitialize
function doesn't respect thestatsd_host
andstatsd_port
configurations.datadog.statsd
is really an alias forDogstatsd()
, which initializes statsd withlocalhost:8125
unless you set the environment variablesDD_AGENT_HOST
andDD_DOGSTATSD_PORT
, which isn't mentioned anywhere in the existing documentation.This is a real problem for users of datadog on kubernetes or any setup where metrics aren't submitted over the default host and port.