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

Updates documentation on how to send a test metric to the statsd receiver #30499

Conversation

swar8080
Copy link
Contributor

Description:
Updates the documentation on how to send a test metric to the statsd receiver, since the current command doesn't work on all machines.

The issue is that the component lets the net package decide whether to listen for either IPV6 or IPV4 UDP packets. That decision seems dependent on the OS. If the server picks IPV4, and localhost resolves to an IPV6 address, then the packet is not received.

This stackoverflow question helped me figure out the problem

Testing:
In my case, using macOS, the net library decides to use IPV4:

workspace/opentelemetry-collector-contrib - (improve_statsd_test_command_documentation) > lsof -i | grep 8125
___go_bui 42575 sswartz   10u  IPv4 0xa2b466eb54dcda69      0t0  UDP localhost:8125

So only sending a IPV4 packet (using -4) works:

echo "test.metric:42|c|#myKey:myVal" | nc -w 1 -u -4 localhost 8125;

…r which will work on more machines

The issue is the component lets the net package decide whether to listen for either IPV6 or IPV4 UDP packets. The decision seems dependent on the OS. If the server picks IPV4, and localhost resolves to an IPV6 address, then the packet is not received
@swar8080 swar8080 requested a review from a team January 12, 2024 23:54
@github-actions github-actions bot added the receiver/statsd statsd related issues label Jan 12, 2024
Copy link
Contributor

@codeboten codeboten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @swar8080!

@codeboten codeboten added the Skip Changelog PRs that do not require a CHANGELOG.md entry label Jan 16, 2024
@codeboten codeboten merged commit 14d4394 into open-telemetry:main Jan 16, 2024
90 of 91 checks passed
@github-actions github-actions bot added this to the next release milestone Jan 16, 2024
cparkins pushed a commit to AmadeusITGroup/opentelemetry-collector-contrib that referenced this pull request Feb 1, 2024
…iver (open-telemetry#30499)

Updates the documentation on how to send a test metric to the statsd
receiver, since the current command doesn't work on all machines.
    
The issue is that the component lets the `net` package decide whether to
listen for either IPV6 or IPV4 UDP packets. That decision seems
dependent on the OS. If the server picks IPV4, and localhost resolves to
an IPV6 address, then the packet is not received.

This
[stackoverflow](https://superuser.com/questions/1238038/trouble-with-netcat-over-udp)
question helped me figure out the problem

**Testing:** <Describe what testing was performed and which tests were
added.>
In my case, using macOS, the net library decides to use IPV4:

```
workspace/opentelemetry-collector-contrib - (improve_statsd_test_command_documentation) > lsof -i | grep 8125
___go_bui 42575 sswartz   10u  IPv4 0xa2b466eb54dcda69      0t0  UDP localhost:8125
```

So only sending a IPV4 packet (using `-4`) works:
```
echo "test.metric:42|c|#myKey:myVal" | nc -w 1 -u -4 localhost 8125;
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
receiver/statsd statsd related issues Skip Changelog PRs that do not require a CHANGELOG.md entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants