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

Changing Statsd to UDS does not reset telemetry labels / max payload size #794

Open
paulkirby-hotjar opened this issue Sep 7, 2023 · 2 comments
Labels
kind/bug Bug related issue stale Stale - Bot reminder

Comments

@paulkirby-hotjar
Copy link

paulkirby-hotjar commented Sep 7, 2023

Describe the bug
The docs currently suggest that the way to start using UDS instead of UDP for statsd communication is to call datadog.initialize(statsd_socket_path='/some/path')

While this does change the socket to communicate over UDS, there are two issues here.

  1. Any consumers of the global datadog.statsd object will be sending over UDP before this initialize call is run. Not that big of a deal as you shouldn't be sending metrics before running initialize but it's a bit confusing
  2. The larger issue - because initialize() does not re-run DogStatsd's __init__(), changing from UDP to UDS does not cause the telemetry tags to be reset, so the telemetry still suggests you're sending over UDP even though you aren't. It also does not reset the _max_payload_size for the DogStatsd object, so the optimal payload length for UDS is never set which is highly sub-optimal.

To Reproduce

  • In a new python app, call datadog.initialize and pass a valid statsd_socket_path
  • Check the reported metric datadog.dogstatsd.client.metrics and observe that this metric will still report for your host exclusively with client_transport:udp

Expected behavior
When changing to UDS, the telemetry tags should reflect this, and the proper payload length should be set.

Environment and Versions (please complete the following information):
datadogpy v 0.44.0
Python 3.10

Additional context
As a hacky method of solving this, prior to running datadog.initialize(), we run datadog.statsd.__init__(statsd_socket_path='/some/path') and that reinitializes things properly. Almost seems as if the statsd global should be initialized in datadog's initialization instead of at import time by DogStatsd?

@paulkirby-hotjar paulkirby-hotjar added the kind/bug Bug related issue label Sep 7, 2023
@github-actions
Copy link

github-actions bot commented Oct 8, 2023

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 Oct 8, 2023
@paulkirby-hotjar
Copy link
Author

Still present in datadogpy v0.47.0

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

No branches or pull requests

1 participant