From 72cc791b39625f6e060433ca4867f093e355b907 Mon Sep 17 00:00:00 2001 From: Mateusz Rzeszutek Date: Mon, 21 Nov 2022 20:30:40 +0100 Subject: [PATCH] Remove deprecated HTTP semconv code (#7259) --- .../http/HttpServerAttributesExtractor.java | 46 ------------------- .../http/HttpServerAttributesGetter.java | 14 ------ .../net/NetClientAttributesGetter.java | 32 +------------ 3 files changed, 2 insertions(+), 90 deletions(-) diff --git a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerAttributesExtractor.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerAttributesExtractor.java index e319593fbafb..7b23a3fa3757 100644 --- a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerAttributesExtractor.java +++ b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerAttributesExtractor.java @@ -36,17 +36,6 @@ public final class HttpServerAttributesExtractor REQUEST, RESPONSE, HttpServerAttributesGetter> implements SpanKeyProvider { - /** - * Creates the HTTP server attributes extractor with default configuration. - * - * @deprecated Use {@link #create(HttpServerAttributesGetter, NetServerAttributesGetter)} instead. - */ - @Deprecated - public static HttpServerAttributesExtractor create( - HttpServerAttributesGetter httpAttributesGetter) { - return create(httpAttributesGetter, new NoopNetServerAttributesGetter<>()); - } - /** Creates the HTTP server attributes extractor with default configuration. */ public static HttpServerAttributesExtractor create( HttpServerAttributesGetter httpAttributesGetter, @@ -54,19 +43,6 @@ public static HttpServerAttributesExtractor HttpServerAttributesExtractorBuilder builder( - HttpServerAttributesGetter httpAttributesGetter) { - return builder(httpAttributesGetter, new NoopNetServerAttributesGetter<>()); - } - /** * Returns a new {@link HttpServerAttributesExtractorBuilder} that can be used to configure the * HTTP client attributes extractor. @@ -186,26 +162,4 @@ private String clientIp(REQUEST request) { public SpanKey internalGetSpanKey() { return SpanKey.HTTP_SERVER; } - - private static class NoopNetServerAttributesGetter - implements NetServerAttributesGetter { - - @Nullable - @Override - public String transport(REQUEST request) { - return null; - } - - @Nullable - @Override - public String hostName(REQUEST request) { - return null; - } - - @Nullable - @Override - public Integer hostPort(REQUEST request) { - return null; - } - } } diff --git a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerAttributesGetter.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerAttributesGetter.java index b2a94929927b..6e3b1a311495 100644 --- a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerAttributesGetter.java +++ b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerAttributesGetter.java @@ -30,18 +30,4 @@ public interface HttpServerAttributesGetter @Nullable String scheme(REQUEST request); - - /** - * The primary server name of the matched virtual host. This should be obtained via configuration, - * not from the Host header. If no such configuration can be obtained, this method should return - * {@code null}. - * - * @deprecated This method is deprecated and will be removed in the next release. - */ - @Nullable - @Deprecated - default String serverName(REQUEST request) { - throw new UnsupportedOperationException( - "This method is deprecated and will be removed in the next release"); - } } diff --git a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetClientAttributesGetter.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetClientAttributesGetter.java index 873d75669562..d5730be2b234 100644 --- a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetClientAttributesGetter.java +++ b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetClientAttributesGetter.java @@ -20,39 +20,11 @@ public interface NetClientAttributesGetter { @Nullable String transport(REQUEST request, @Nullable RESPONSE response); - /** - * Logical remote hostname. - * - * @deprecated This method is deprecated and will be removed in the next release. - */ - @Deprecated @Nullable - default String peerName(REQUEST request, @Nullable RESPONSE response) { - throw new UnsupportedOperationException( - "This method is deprecated and will be removed in the next release"); - } - - @Nullable - default String peerName(REQUEST request) { - return peerName(request, null); - } + String peerName(REQUEST request); - /** - * Logical remote port number. - * - * @deprecated This method is deprecated and will be removed in the next release. - */ - @Deprecated @Nullable - default Integer peerPort(REQUEST request, @Nullable RESPONSE response) { - throw new UnsupportedOperationException( - "This method is deprecated and will be removed in the next release"); - } - - @Nullable - default Integer peerPort(REQUEST request) { - return peerPort(request, null); - } + Integer peerPort(REQUEST request); @Nullable default String sockFamily(REQUEST request, @Nullable RESPONSE response) {