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

Add IPv6 support #783

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Add IPv6 support #783

wants to merge 4 commits into from

Conversation

phil-scale
Copy link

@phil-scale phil-scale commented Jul 16, 2023

What does this PR do?

Adds IPv6 support to the DogStatsd class

Description of the Change

Adds a method to detect if a hostname can be resolved as an IPv6 hostname, and if so, uses the socket.AF_INET6 family of sockets

Alternate Designs

Possible Drawbacks

Verification Process

Before PR:

>>> from datadog.dogstatsd.base import DogStatsd
>>> DogStatsd._get_udp_socket("0.0.0.1", 8126)
<socket.socket fd=4, family=AddressFamily.AF_INET, type=SocketKind.SOCK_DGRAM, proto=0, laddr=('10.254.0.78', 57605), raddr=('0.0.0.1', 8126)>
>>> DogStatsd._get_udp_socket("::", 8126)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/miniconda3/envs/hmi/lib/python3.8/site-packages/datadog/dogstatsd/base.py", line 544, in _get_udp_socket
    sock.connect((host, port))
socket.gaierror: [Errno 8] nodename nor servname provided, or not known

After:

>>> from datadog.dogstatsd.base import DogStatsd
>>> DogStatsd._get_udp_socket("0.0.0.1", 8126)
<socket.socket fd=4, family=AddressFamily.AF_INET, type=SocketKind.SOCK_DGRAM, proto=0, laddr=('10.254.0.78', 57605), raddr=('0.0.0.1', 8126)>
>>> DogStatsd._get_udp_socket("::", 8126)
<socket.socket fd=5, family=AddressFamily.AF_INET6, type=SocketKind.SOCK_DGRAM, proto=0, laddr=('::1', 63924, 0, 0), raddr=('::1', 8126, 0, 0)>

Additional Notes

Release Notes

Review checklist (to be filled by reviewers)

  • Feature or bug fix MUST have appropriate tests (unit, integration, etc...)
  • PR title must be written as a CHANGELOG entry (see why)
  • Files changes must correspond to the primary purpose of the PR as described in the title (small unrelated changes should have their own PR)
  • PR must have one changelog/ label attached. If applicable it should have the backward-incompatible label attached.
  • PR should not have do-not-merge/ label attached.
  • If Applicable, issue must have kind/ and severity/ labels attached at least.

@github-actions
Copy link

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.

@github-actions github-actions bot added the stale Stale - Bot reminder label Aug 30, 2023
@nextmat
Copy link

nextmat commented Aug 30, 2023

I'm running into issues with IPv6 support as well, any change of getting this merged?

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

Successfully merging this pull request may close these issues.

3 participants