Skip to content

Don't set IP address for net.peer.name and set name for failed DNS lo…#584

Merged
anuraaga merged 6 commits into
open-telemetry:masterfrom
anuraaga:net-peer-name-no-ip
Jun 28, 2020
Merged

Don't set IP address for net.peer.name and set name for failed DNS lo…#584
anuraaga merged 6 commits into
open-telemetry:masterfrom
anuraaga:net-peer-name-no-ip

Conversation

@anuraaga

@anuraaga anuraaga commented Jun 26, 2020

Copy link
Copy Markdown
Contributor

…okup

When working on #562, I found onPeerConnection behavior to not match my expectations. While the spec doesn't say truly explicitly, I interpret it as reverse lookup an IP address and fill in the name result if available, but otherwise don't fill an IP literal into net.peer.name which currently happens.

https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/semantic_conventions/span-general.md#netname-attributes

Also, losing net.peer.name on DNS failure seems like a very unfortunate loss of important data, I added so it's always set.

The previous unit tests were missing cases of IP-address and really any coverage at all since they just called the code during expectations, hopefully as explicit expectations things are clearer now.

@trask trask left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nice catch on the failed DNS lookup 👍

I sent suggestions as PR: anuraaga#1

* PR suggestion

* Make test pass on Windows
if (remoteConnection != null) {
onPeerConnection(span, remoteConnection.getAddress());

InetAddress remoteAddress = remoteConnection.getAddress();

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@trask Just confirming we should use final with local vars? I personally don't like it much but happy to follow the style

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

you are in good company 😄, we recently decided against it, just opened #592 to track updating existing style

@anuraaga anuraaga merged commit b0237a8 into open-telemetry:master Jun 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants