From 90e17e11a94db8164b865ff1f70fccf123771b9a Mon Sep 17 00:00:00 2001 From: Lauri Tulmin Date: Fri, 16 Feb 2024 11:25:06 +0200 Subject: [PATCH] Don't fill network peer for cassandra SniEndPoint --- .../cassandra/v4_4/CassandraNetworkAttributesGetter.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/instrumentation/cassandra/cassandra-4.4/library/src/main/java/io/opentelemetry/instrumentation/cassandra/v4_4/CassandraNetworkAttributesGetter.java b/instrumentation/cassandra/cassandra-4.4/library/src/main/java/io/opentelemetry/instrumentation/cassandra/v4_4/CassandraNetworkAttributesGetter.java index 08b0a270b411..532dcb0646f6 100644 --- a/instrumentation/cassandra/cassandra-4.4/library/src/main/java/io/opentelemetry/instrumentation/cassandra/v4_4/CassandraNetworkAttributesGetter.java +++ b/instrumentation/cassandra/cassandra-4.4/library/src/main/java/io/opentelemetry/instrumentation/cassandra/v4_4/CassandraNetworkAttributesGetter.java @@ -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; @@ -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; }