Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support the standard DD_DOGSTATSD_URL environment variable #805

Open
andrewthauer opened this issue Dec 15, 2023 · 5 comments
Open

Support the standard DD_DOGSTATSD_URL environment variable #805

andrewthauer opened this issue Dec 15, 2023 · 5 comments
Labels
kind/feature-request Feature request related issue stale Stale - Bot reminder

Comments

@andrewthauer
Copy link

Note:

Is your feature request related to a problem? Please describe.

Currently the only way to configure a connection to a unix domain socket requires doing this in code for every application.

Some of the other Datadog dogstatsd libraries support the DD_DOGSTATSD_URL environment variable for setting either host/port or a unix domain socket. For example https://github.com/DataDog/dogstatsd-ruby gem does this. Also the Datadog Kubernetes operator also automatically adds the DD_DOGSTATSD_URL environment variable to a mounted socket into all pods.

Describe the solution you'd like

This library should support reading the DD_DOGSTATSD_URL environment variable to configure either host/port or unix domain sockets. This will allow configuration outside of code and be consistent with other dogstatsd libraries.

Describe alternatives you've considered

Continue setting this in code and therefore being inconsistent with other Datadog libraries.

Additional context
Add any other context or screenshots about the feature request here.

@andrewthauer andrewthauer added the kind/feature-request Feature request related issue label Dec 15, 2023
Copy link

Thanks for your contribution!

This issue has been automatically marked as stale because it has not had activity in the last 30 days. Note that the issue will not be automatically closed, but this notification will remind us to investigate why there's been inactivity. Thank you for participating in the Datadog open source community.

If you would like this issue to remain open:

  1. Verify that you can still reproduce the issue in the latest version of this project.

  2. Comment that the issue is still reproducible and include updated details requested in the issue template.

@github-actions github-actions bot added the stale Stale - Bot reminder label Jan 15, 2024
@andrewthauer
Copy link
Author

Still interested in this!

@jianyuan
Copy link

I also agree this would be useful. This functionality is already supported in ddtrace.internal.dogstatsd.get_dogstatsd_client. You can find it here: https://github.com/DataDog/dd-trace-py/blob/fedf88e7161e7eff19038231c2b2fa8f8f75ddec/ddtrace/internal/dogstatsd.py#L9

@cdonadeo
Copy link

It may also be worth pointing out that the default behavior for the Admission Controller provided by DataDog/datadog-operator is to mount a Unix domain socket and set DD_DOGSTATSD_URL to unix:///var/run/datadog/dsd.socket inside pods. Making use of that with this Python library involves urllib.parse to check the scheme and then if it is unix:// passing the rest to statsd_socket_path. To handle all valid possibilities, I also need to check for udp:// and set statsd_host and statsd_port based on that.

It's a bit unexpected that Datadog's components aren't better integrated. It's not the worst thing ever, just a bit fussy.

@PrayagS
Copy link

PrayagS commented Sep 9, 2024

Bumping this up.

We are facing a situation where we're setting DD_AGENT_HOST for collecting traces but still want to use https://www.github.com/prometheus/statsd_exporter for statsd metrics.

Setting DD_AGENT_HOST overrides it globally and metrics don't work as expected.

A behavior similar to https://www.github.com/DataDog/dd-trace-py would be ideal where DD_DOGSTATSD_URL takes precedence over DD_AGENT_HOST.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature-request Feature request related issue stale Stale - Bot reminder
Projects
None yet
Development

No branches or pull requests

4 participants