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

Fix net.peer.* setting for Cassandra 4.+ #1482

Merged
merged 1 commit into from
Oct 26, 2020

Conversation

iNikem
Copy link
Contributor

@iNikem iNikem commented Oct 26, 2020

#1427 removed max java version to run Cassandra 4 tests. This allowed testLatestDep job to actually run them (as it uses java 11 to run). This exposed that starting from some version of Cassandra client driver the value returned by node.getBroadcastRpcAddress() changed to 0.0.0.0 in our tests. This broke tests.

But this also exposed that we used wrong address for net.peer.* attributes in the first place. BroadcastRpcAddress means the address that Cassandra server accepts RPC connections. In case of containers/proxy this may be completely different address from the one used by client. But node.getEndPoint() returns "The information that the driver uses to connect to the node". Which seems like the correct one.

Closes #1478
Closes #1473
Closes #1472
Closes #1461
Closes #1460

@@ -47,8 +47,10 @@ protected InetSocketAddress peerAddress(CqlSession cqlSession) {
public void onResponse(Span span, ExecutionInfo executionInfo) {
Node coordinator = executionInfo.getCoordinator();
if (coordinator != null) {
Optional<InetSocketAddress> address = coordinator.getBroadcastRpcAddress();
address.ifPresent(inetSocketAddress -> NetPeerUtils.setNetPeer(span, inetSocketAddress));
SocketAddress socketAddress = coordinator.getEndPoint().resolve();
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think it's related to this PR since we have many instrumentations with the same pattern - I often worry about blocking an event loop with a DNS lookup just to set a span attribute. I want (someone) to remove the spec's language encouraging a DNS lookup just to resolve an attribute.

Just the word resolve makes it more obvious than Java where a seemingly normal getter has the chance to block and brought this point up for me :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. But this may be related to the general question of bringing performance considerations into semantic conventions...

Copy link
Member

Choose a reason for hiding this comment

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

I'd be interested if we force DNS resolution anywhere, I know we've tried to avoid that in the past.

In this case, I'm not sure why the method is named resolve(), at least the implementation I'm seeing when I look doesn't seem to resolve anything.

@iNikem iNikem merged commit 3db872e into open-telemetry:master Oct 26, 2020
@iNikem iNikem deleted the cassandra-endpoint branch October 26, 2020 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants