Skip to content

Commit

Permalink
Reverts back to remove inetaddresss
Browse files Browse the repository at this point in the history
  • Loading branch information
anuragagarwal561994 committed Jan 28, 2023
1 parent 7760022 commit b0cfe98
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,6 @@ public static Integer getPeerPort(URI uri) {
return uri == null ? null : uri.getPort();
}

public static InetSocketAddress getPeerSocketAddress(HttpHost target) {
if (target == null) {
return null;
}
InetAddress inetAddress = target.getAddress();
return inetAddress == null ? null : new InetSocketAddress(inetAddress, target.getPort());
}

@Nullable
private static URI getCalculatedUri(HttpHost httpHost, URI uri) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,6 @@ public Integer getPeerPort() {
return ApacheHttpClientAttributesHelper.getPeerPort(uri);
}

@Nullable
public InetSocketAddress getPeerSocketAddress() {
return ApacheHttpClientAttributesHelper.getPeerSocketAddress(target);
}

@Override
public List<String> getHeader(String name) {
return ApacheHttpClientAttributesHelper.getHeader(httpRequest, name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@

package io.opentelemetry.javaagent.instrumentation.apachehttpclient.commons;

import io.opentelemetry.instrumentation.api.instrumenter.net.InetSocketAddressNetClientAttributesGetter;
import io.opentelemetry.instrumentation.api.instrumenter.net.NetClientAttributesGetter;
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes;
import java.net.InetSocketAddress;
import javax.annotation.Nullable;

public final class ApacheHttpClientNetAttributesGetter extends
InetSocketAddressNetClientAttributesGetter<OtelHttpRequest, OtelHttpResponse> {
public final class ApacheHttpClientNetAttributesGetter implements
NetClientAttributesGetter<OtelHttpRequest, OtelHttpResponse> {
@Override
public String getTransport(OtelHttpRequest request, @Nullable OtelHttpResponse response) {
return SemanticAttributes.NetTransportValues.IP_TCP;
Expand All @@ -27,11 +26,4 @@ public String getPeerName(OtelHttpRequest request) {
public Integer getPeerPort(OtelHttpRequest request) {
return request.getPeerPort();
}

@Nullable
@Override
public InetSocketAddress getPeerSocketAddress(
OtelHttpRequest request, @Nullable OtelHttpResponse response) {
return request.getPeerSocketAddress();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ public interface OtelHttpRequest {

Integer getPeerPort();

InetSocketAddress getPeerSocketAddress();

String getMethod();

String getUrl();
Expand Down

0 comments on commit b0cfe98

Please sign in to comment.