Skip to content

Commit

Permalink
Don't fill network peer for cassandra SniEndPoint (#10573)
Browse files Browse the repository at this point in the history
  • Loading branch information
laurit authored Feb 21, 2024
1 parent 5b5cad7 commit 1670dc3
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import com.datastax.oss.driver.api.core.metadata.EndPoint;
import com.datastax.oss.driver.api.core.metadata.Node;
import com.datastax.oss.driver.internal.core.metadata.DefaultEndPoint;
import com.datastax.oss.driver.internal.core.metadata.SniEndPoint;
import io.opentelemetry.instrumentation.api.semconv.network.NetworkAttributesGetter;
import java.net.InetSocketAddress;
import javax.annotation.Nullable;
Expand All @@ -28,12 +27,10 @@ public InetSocketAddress getNetworkPeerInetSocketAddress(
if (coordinator == null) {
return null;
}
// resolve() returns an existing InetSocketAddress, it does not do a dns resolve,
EndPoint endPoint = coordinator.getEndPoint();
if (endPoint instanceof DefaultEndPoint) {
return (InetSocketAddress) coordinator.getEndPoint().resolve();
} else if (endPoint instanceof SniEndPoint) {
return ((SniEndPoint) endPoint).resolve();
// resolve() returns an existing InetSocketAddress, it does not do a dns resolve,
return (InetSocketAddress) endPoint.resolve();
}
return null;
}
Expand Down

0 comments on commit 1670dc3

Please sign in to comment.